Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. from pwn import *
  2.  
  3. sh = remote('challenges.metactfjo.com', 666)
  4.  
  5. #Header lines
  6. print sh.recvline()
  7. print sh.recvline()
  8. print sh.recvline()
  9. #End header lines
  10.  
  11. import base64
  12. def get_answer():
  13. r = sh.recvline()
  14. print r
  15. r = ' '.join(r.split(' ')[3:]).strip()
  16.  
  17. isbinary=True
  18. for c in r:
  19. if c not in '01':
  20. isbinary=False
  21. break
  22. isdecimal=True
  23. for c in r:
  24. if c not in '1234567890 ':
  25. isdecimal=False
  26. ishexa=True
  27. for c in r:
  28. if c not in '1234567890abcdef':
  29. ishexa=False
  30.  
  31. rez = ''
  32. if isbinary==True:
  33. rez = ('%x'%int(r,2)).decode('hex')
  34. elif isdecimal==True:
  35. for c in r.split(' '):
  36. if c=='':
  37. continue
  38. rez += chr(int(c))
  39. elif ishexa==True:
  40. rez = r.decode('hex')
  41. else:
  42. rez = base64.b64decode(r)
  43.  
  44. return rez
  45.  
  46. for i in range(49):
  47. sh.sendline(get_answer())
  48. sh.recvline()
  49. sh.sendline(get_answer())
  50. sh.interactive()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement