Skip to content

Instantly share code, notes, and snippets.

@ducnhse130201
Created June 19, 2018 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducnhse130201/869256e96589abf60450f19cf78985eb to your computer and use it in GitHub Desktop.
Save ducnhse130201/869256e96589abf60450f19cf78985eb to your computer and use it in GitHub Desktop.
solve(du ddu).py
from telnetlib import *
import string
from base64 import *
alpha = string.ascii_letters + string.digits
host,port = 'ec2-13-251-81-16.ap-southeast-1.compute.amazonaws.com',3333
c = 'OEEBNFHAIECBPEFBLCBHPFFAIBCENLHOLFBANOHLIKCPLIBNOPEKKHACNOHLOHECILCOMDGGJGDDMCGHPGFDLBBEPFFALIBNPFFALEBBMAGFJBDEMAGFIJCMNOHLKEABONEIJMDJKPAKJIDNOOELILCOOIENINCINIHN'
text = ''
for i in range(0,len(c),4):
r = Telnet(host,port)
r.read_until('Your choice: ')
r.write('1\n')
for char in alpha:
r.read_until('Your message: ')
r.write(text+char+'\n')
r.read_until('The cipher text: ')
cipher = b64decode(r.read_until('\n'))
if cipher == c[:i+4]:
text += char
print text
# nc ec2-13-251-81-16.ap-southeast-1.compute.amazonaws.com 3333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment