aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xirssi-tor.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/irssi-tor.sh b/irssi-tor.sh
index 742d577..b9d2a5b 100755
--- a/irssi-tor.sh
+++ b/irssi-tor.sh
@@ -8,7 +8,7 @@ while `netstat -l4n | grep -qoE "^tcp(.*):${SOC_PORT}"`; do
SOC_PORT=${NEXT_PORT}
done
-if [ $# -ne 3 ]; then
+if [ $# -ne 3 ] && [ $# -ne 0 ]; then
echo "$0: [IRC_HOST] [IRC_PORT] [IRC_NICK]"
exit 1
fi
@@ -17,10 +17,14 @@ IRC_PORT="$2"
IRC_NICK="$3"
sudo iptables -A INPUT -p tcp '!' -s 127.0.0.1 --dport ${SOC_PORT} -j REJECT
-socat TCP4-LISTEN:${SOC_PORT},reuseaddr,range=127.0.0.1/32 SOCKS4A:localhost:${IRC_HOST}:${IRC_PORT},socksport=9050 &
+socat -d -d -lmlocal2 TCP4-LISTEN:${SOC_PORT},reuseaddr,fork,range=127.0.0.1/32 SOCKS4A:localhost:${IRC_HOST}:${IRC_PORT},socksport=9050 &
SOC_PID=$!
echo "socat pid ${SOC_PID}"
-irssi -c localhost -p ${SOC_PORT} -n ${IRC_NICK}
+if [ $# -eq 0 ]; then
+ irssi --noconnect
+else
+ irssi -c localhost -p ${SOC_PORT} -n ${IRC_NICK}
+fi
echo "kill ${SOC_PID}"
kill -SIGTERM ${SOC_PID} 2>/dev/null
wait ${SOC_PID}