summaryrefslogtreecommitdiff
path: root/nocompile/bin
diff options
context:
space:
mode:
authorepochqwert <epoch@hacking.allowed.org>2017-12-02 11:28:30 +0000
committerepochqwert <epoch@hacking.allowed.org>2017-12-02 11:28:30 +0000
commit6aad5cbfbde778e52febdba6ea447c186f081cd6 (patch)
tree91d8ff37fbc36edd3ce5a3a8d1be7976f780493a /nocompile/bin
parentd573108c4c13ed4025473bcd2693b0e665fb5cbb (diff)
downloadmisc-6aad5cbfbde778e52febdba6ea447c186f081cd6.tar.gz
misc-6aad5cbfbde778e52febdba6ea447c186f081cd6.zip
added a bot for sending data through an IRC channel
Diffstat (limited to 'nocompile/bin')
-rwxr-xr-xnocompile/bin/pipboy.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/nocompile/bin/pipboy.py b/nocompile/bin/pipboy.py
new file mode 100755
index 0000000..cabd69e
--- /dev/null
+++ b/nocompile/bin/pipboy.py
@@ -0,0 +1,46 @@
+#!/usr/pkg/bin/python3.3
+import time
+import socket
+import os
+import fcntl
+import sys
+s=socket.create_connection(("127.0.0.1",6667))
+fcntl.fcntl(sys.stdin.fileno(),fcntl.F_SETFL,os.O_NONBLOCK)
+fcntl.fcntl(s.fileno(),fcntl.F_SETFL,os.O_NONBLOCK)
+s.send(b"NICK pipboy\r\nUSER a b c d\r\nJOIN #pipe\r\n")
+b=b""
+c=b""
+while 1:
+ try:
+ i=s.recv(16)
+ except:
+ pass
+ else:
+ b+=i
+ try:
+ j=sys.stdin.read(16)
+ except:
+ pass
+ else:
+ c+=j.encode()
+ if(b"\n" in c):
+ q=c.split(b'\n')
+ c=b'\n'.join(q[1:])
+ s.send(b'PRIVMSG #pipe :' + q[0] + b'\r\n')
+ if(b"\r\n" in b):
+ p=b.split(b'\r\n')
+ b=b"\r\n".join(p[1:])
+ a=p[0].split(b' ')
+ try:
+ who=a[0].split(b':')[1].split(b'!')[0]
+ except:
+ who=b"#cmd"
+ if(a[0] == b'ERROR'):
+ quit()
+ if(a[0] == b'PING'):
+ s.send(b'PONG ' + a[1] + b'\r\n')
+ if(a[1] == b'PRIVMSG'):
+ if(a[2] == b'#pipe'):
+ print((b" ".join(a[3:])[1:]).decode())
+ sys.stdout.flush()
+ time.sleep(.01)