prep
apt -y install tor deb.torproject.org-keyring
apt -y install torsocks
apt -y install socat
apt -y install expect
configuration
/etc/tor/torrc #may not need to modify it.
service up
service tor start
torsocks :test
torsocks ssh bbsu@ptt.cc -p 22
socat :test
socat TCP-LISTEN:4141 SOCKS4A:localhost:ptt.cc:22,socksport=9050 &
netstat -antup|grep socat #上一行使用9050的tor在4141建立起socket導向到ptt.cc:22
ssh bbsu@localhost -p 4141
netstat -antup|grep socat #port4141用後即毀
expectPtt.sh
1 | #!/usr/bin/expect |
cron and log
socatPttDaily.sh1
2
3
4
5
6#!/bin/sh
socat TCP-LISTEN:4141 SOCKS4A:localhost:ptt.cc:22,socksport=9050 &
netstat -antup|grep socat
#ssh bbsu@localhost -p 4141
#netstat -antup|grep socat
/home/tabenyaki/expectPtt.sh
crontab -e1
* */3 * * * /home/tabenyaki/socatPttDaily.sh
crontab -l
cat /var/spool/cron/crontabs/tabenyaki
cat /var/log/cron.log
grep CRON /var/log/syslog