Debug

1.看到整個Array (If 不能用 print_r() or echo ) - 寫到file 裏面 $fp = fopen('\/tmp\/debug.txt', 'w'); fwrite($fp, print_r($, TRUE));fclose($fp);

error_log("Variables=$VAR\n"."Arrays ".print_r($array, true).":", 3, "\/tmp\/error_log.txt");

error_log("DEBUG: \n ".print_r(debug_backtrace(), true)."\n", 3, "\/tmp\/debug_log.txt"); \/\/

print all information in your function

2.writeValue, getValue in common.inc (Be careful to check file size) And common.inc is include in function.inc

3.php debugger \/etc\/php.ini error : on

PHP debugger : vi \/etc\/apache\/conf\/conf.d\/libphp4.conf displayerror : on apache_restart.sh

Single mode

  1. mount boot loader partition.

$(fdisk -l) to check your boot loader partition (usually \/dev\/vda1).

$(mount \/dev\/vda1 ${dir_path})

write single in grub.conf

reboot system.

  • Check init script error -

Put init script file under \/conf\/rc.d , and rcS will not execute \/etc\/rc.d

API debug

Check syntax error

Check apache log error

Use curl or REST client

Backdoor of WHG console - (Dead code in \/conf\/tar\/1000\/nconfig)

type first password: ezon12047

type second password: yamadreport

W6000 NEW password (qS%Chu#4)

console serial port

\/dev\/console : VGA port

\/dev\/ttyS0 : exec \/ramfs\/bin\/ser ${tty} 30 \/home\/admin\/nconfig \/ramfs\/bin\/printpass (Show User interface of menuconfig)

\/dev\/tty : login shell

Netfilter

iptables -m cipnam --help // match by /proc/net/xt_cipnam, /proc/net/xt_cipnam/_acct_/users/_mac_
iptables -j LOG --log-prefix 'LOG_PREFIX'
conntrack -L -f ipv6

Explain iptables rule

ifgroup out 0x7 (Output interface group are 0x7, use $(ip -d li) to check)

$(nohup) can use in boot script for prevent daemon dying in init script

Check routing

ip ro get $dst

ip ro get $dst from $src iif $interface

Login usr's traffic will not enter "USER_CTL" chain in iptables, but enter "USER" chain and goto its group

Check SSH CONNECTION on GW

netstat -anp | grep $(echo $SSH_CONNECTION | awk '{print $2}')

Last updated

Was this helpful?