Sunday, August 18, 2013

tcpdump for X-Forwarded-For header

How to take tcp dump for a service that is running on port 4002

#tcpdump -vvvs 1024 -l -A -w /tmp/web-1.pcap tcp port 4002
Take a dump to some specific network interface on some specific port.
tcpdump -i eth0.12 -s0 -w /tmp/web-1.pcap port 4002
How to read the tcpdump
tcpdump -X -vv -r web-1.pcap
use wireshark

Friday, August 16, 2013

Mysql dump and restore it on remote machine


#mysqldump --opt --skip-lock-tables -umyuser -pmy-secret-password teamcity --extended-insert --routines --add-drop-table | mysql -ubackup -pbackup teamcity
If you want to reset the root password
mysql --defaults-file=/etc/mysql/debian.cnf
update mysql.user set password=PASSWORD('password') where user='root';