not complete but ok
This commit is contained in:
parent
155cef90bc
commit
8b046b6979
34
bot.py
34
bot.py
|
@ -1,16 +1,28 @@
|
|||
import socket
|
||||
import time
|
||||
|
||||
class Bot:
|
||||
def __init__(self, server, port, channel, user):
|
||||
def __init__(self, server, port, user):
|
||||
global s
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((self.server, int(self.port)))
|
||||
s.send("USER %s * 3 :hello\n" % self.user)
|
||||
s.send("NICK %s\n" % self.user)
|
||||
s.send("JOIN #%s" % self.channel)
|
||||
while 1:
|
||||
b = s.recv(4096)
|
||||
s.send("PONG :"+b.split(" ")[1])
|
||||
print b
|
||||
if b.find("PRIVMSG") != -1:
|
||||
print "[*] there was a message"
|
||||
s.connect((server, int(port)))
|
||||
b = s.recv(4096)
|
||||
s.send("PONG :"+b.split(" ")[1])
|
||||
s.send("USER %s * 3 :hello\n" % user)
|
||||
s.send("NICK %s\n" % user)
|
||||
|
||||
def read(self):
|
||||
while 1:
|
||||
x = s.recv(4096)
|
||||
print x
|
||||
def NickServAuth(self, email, password):
|
||||
s.send("PRIVMSG NickServ REGISTER %s %s" % password, email)
|
||||
time.sleep(1)
|
||||
print "[*] registering user"
|
||||
def send(self, command):
|
||||
s.send(command)
|
||||
def joinchannel(self, channel):
|
||||
s.send("JOIN %s\n" % channel)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue