summaryrefslogtreecommitdiffstats
path: root/ship/lib/network
diff options
context:
space:
mode:
authorroot <root@flap>2014-05-06 10:00:33 -0400
committerroot <root@flap>2014-05-06 10:00:33 -0400
commit4d8016064edd5e5dc1d194ea5ec0fce4f07b8f2a (patch)
treed8ecba8651604e51d6f887449641ac627844ae63 /ship/lib/network
parentf44c8529e6d04b557d93cc862599b956ed21f0de (diff)
parentd0367082a5c1296cefed641b4eda736b29a3ad69 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'ship/lib/network')
-rw-r--r--ship/lib/network13
1 files changed, 12 insertions, 1 deletions
diff --git a/ship/lib/network b/ship/lib/network
index 974fb282..6c8970a0 100644
--- a/ship/lib/network
+++ b/ship/lib/network
@@ -76,6 +76,17 @@ run_telnet(){
port="$2"
$(which_telnet) "$host" "$port"
}
+port_open(){
+ # $1 - host
+ # $2 - port
+ # nc -zw 2 $1 $2
+ echo | run_telnet "$1" "$2" & pid=$!
+ { sleep 5; kill $pid;} & wid=$!
+ wait $pid
+ RET=$?
+ kill $wid >/dev/null 2>&1
+ return $RET
+}
send_irc(){
## reads from stdin, writes to IRC
@@ -95,5 +106,5 @@ send_irc(){
echo "JOIN $IRCCHANNEL";
sleep 23;
while read line; do echo "PRIVMSG $IRCCHANNEL :$line";sleep 1;done
- sleep 5; ) | run_telnet $IRCSERVER $IRCPORT 2>/dev/null | line_to_dot
+ sleep 5; ) | run_telnet $IRCSERVER $IRCPORT 2>/dev/null
}