Sunday 31 January 2016

Ecoded_string

Second Programming challenge from root-me. For me, also it requires basic programming skills.


Statement
To start this challenge, you must send a private message to bot Candy: !ep2

- The bot answer you by a private message.
- This is a series of encoded characters.
- You must send him the decoded message.
- You have 2 seconds.
- If the bot does not respond, then you have been banned. Just wait a few minutes.
- The answer must be sent as :
!ep2 -rep <answer>

Exploit
import socket
import base64

try:
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 s.connect(('irc.root-me.org',6667))
 s.send('NICK rootek\r\n')
 print s.recv(1024000)
 s.send('USER rootek 0 * :Real Name\r\n')
 print s.recv(1024000)
 s.send("JOIN #root-me_challenge\r\n")
 print s.recv(20140000)
 message = s.send("PRIVMSG Candy !ep2\r\n")
 answer = s.recv(128).split(' :')[1].replace(' ','')
 print answer
 s.send("PRIVMSG Candy !ep2 -rep " + str(base64.b64decode(answer) + "\r\n"))
 print s.recv(10240)
 s.send('QUIT')
 print "Connection closed"

except Exception,e:
 print e