import sys import socket import string log log HOST censored PORT 6667

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import socket
import string
log = ("log","w")
HOST="censored"
PORT=6667
NICK="censored"
IDENT="censored"
REALNAME="noname"
readbuffer=""
s=socket.socket( )
s.connect((HOST, PORT))
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
s.send("JOIN #censored\n")
while 1:
readbuffer=readbuffer+s.recv(1024)
temp=string.split(readbuffer, "\n")
readbuffer=temp.pop( )
for line in temp:
line=string.rstrip(line)
line=string.split(line)
print line
log.write("\n".join(line))
if(line[0]=="PING"):
s.send("PONG %s\r\n" % line[1])
#if(line[])
log.close()