nerusskyhigh

Untitled

Oct 11th, 2021 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. import hashlib
  3. import sys
  4. from pwn import *
  5.  
  6. memory = dict()
  7.  
  8. global i
  9. i= 0
  10.  
  11. def decode(target) -> int:
  12. global i
  13. print("Decoding:\t", target)
  14. output = memory.get(target, -1)
  15.  
  16.  
  17. while output < 0:
  18. h = hashlib.sha1(str(i).encode('ascii')).hexdigest()
  19.  
  20. memory[ h[-6:] ] = i
  21. if h.endswith(target):
  22. output = i
  23. #print(i, "\t", h, "\t", h[-6:], "\tTarget:", target)
  24. i += 1
  25. output = str(str(output)+"\n")
  26. print("Decoded: ", output)
  27.  
  28. return bytes(output, encoding='utf8')
  29.  
  30.  
  31. while True:
  32. p = remote("rabbit.challs.olicyber.it", 10501)
  33. print(p.recvline())
  34. print(p.recvline())
  35. print(p.recvline())
  36.  
  37. #Execute: python3 proof.py 9b2d6c
  38. output = p.recvline()
  39.  
  40. print(output)
  41. hash = str(output)[-9:-3]
  42. print("\t Hash:", hash)
  43.  
  44. key = decode(hash)
  45. print("\t Key:", key)
  46. p.sendline(key)
  47.  
  48. p.interactive()
  49.  
Add Comment
Please, Sign In to add comment