Parsi Coders
[Python]Simple IRC Bot - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Python (http://parsicoders.com/forumdisplay.php?fid=46)
+--- موضوع: [Python]Simple IRC Bot (/showthread.php?tid=1025)



[Python]Simple IRC Bot - Amin_Mansouri - 10-11-2011

این هم یه سورس بوت برای سرویس ای ار سی
کد:
#!/usr/bin/python
import socket, sys, string, time
port = 6667
nick = "iSploit_bot"
host = 'irc.darkscience.ws'
name =  "pwnz0r"
channel = '#iexploit'  
ident = 'chronicz'
woot = socket.socket()

woot.connect ( (host, port) )
woot.send ( 'NICK ' + nick + '\r\n' )
woot.send ( 'USER ' + ident + ' ' +  ident + ' ' + ident + ' :chroniczbot\r\n' )

while 1:

    data = woot.recv ( 1024 )
    print(data)

    if data.find ( '376' ) != -1:

        woot.send( 'JOIN ' + channel + '\r\n' )

    if data.find ( 'PING' ) != -1:

        woot.send( 'PONG ' + data.split() [1] + '\r\n')

    if data.find ( '!test' ) != -1:

        woot.send ("PRIVMSG #chroniccommand :Test message! \r\n")
    if data.fiind ( '!quit' ) != -1:

        woot.send ("QUIT\r\n")
        sys.exit()