sábado, 17 de enero de 2015

ipfilter testing

add another port to sshd:
$ grep Port /etc/ssh/sshd_config
Port 22
Port 44444


test it works:
$ telnet 127.0.0.1 44444

block that port:
$ cat /etc/ipf/ipf.conf
set intercept_loopback true;
pass in all
pass out all
block in from any to any port = 44444
#pass in from 127.0.0.1 to any port = 44444


test it's blocked
$ telnet 127.0.0.1 44444

just in case we screw:
$ sudo crontab -l | tail -n1
* * * * * /usr/sbin/svcadm disable network/ipfilter

martes, 11 de noviembre de 2014

newline in sed or echo on Mac

$ echo hello | sed 's/hello/hello\'$'\nbye/'
hello
bye




$ echo hello | sed 's/hello/hello\'$'\n''bye1\'$'\nbye2/'
hello
bye1
bye2


$ sed -i '' 's/hello/hello\'$'\nbye/g' somefile.txt

martes, 10 de junio de 2014

Fast copy of directories using nc

receiving end (using port 10000):
nc -l 10000 | tar x

sending end:
cd parent_dir
tar cf - *hello* | nc receiving_hostname 10000

martes, 26 de noviembre de 2013

viernes, 9 de agosto de 2013

strace for parent and threads and output to files

sudo strace -tt -s 1024 -o strace.log -ffv -p {pid}

miércoles, 7 de agosto de 2013

tcpdump

sudo tcpdump -A -w tcpdump.log -i eth0 dst 10.1.0.1 and port 80