Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from base64 import *
  2. import requests
  3.  
  4. def payload(b64string):
  5. r = requests.post('http://chall04-crypto02.wargame.whitehat.vn/',data = {"crypto":b64string})
  6. return r.text.split('<p>')[1].split('</p>')[0].split('\n')[0].split(' ')[1]
  7. #AES_ECB
  8. #s = "something!" + "a"*21 + flag
  9. #s = "something!aaaaaa" + a*15 + flag
  10. #-> can brute 1 characters of flag
  11. flag = ''
  12. for i in range(0,16):
  13. n = 21 - i
  14. encoded = b64decode(payload(b64encode(n*'a')))[16:32]
  15. for c in range(32,127):
  16. brute = n*'a' + flag + chr(c)
  17. if b64decode(payload(b64encode(brute)))[16:32] == encoded:
  18. flag+= chr(c)
  19. break
  20.  
  21. print flag
  22. #Easy_point_c13
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement