daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. from itertools import product
  3. import time
  4. from urllib import urlencode
  5.  
  6. cookies={"PHPSESSID":"79ttdtubrua06uec35m0bsip67"}
  7. url="https://ctf.zsis.hr/challenges/4_programming_mugatu.php"
  8.  
  9. start=time.time()
  10. r=requests.get(url,cookies=cookies)
  11. target=int(r.text.split("resulting number ")[1].split("?")[0])
  12. print r.text,target
  13.  
  14. arr=range(1,10)
  15. for i in product(["-","+",""],repeat=len(arr)-1):
  16.     s=""
  17.     for j in zip(arr,i):
  18.         s+=str(j[0])+j[1]
  19.     s+="9"
  20.     if int(eval(s))==target:
  21.         print target==eval(s),time.time()-start
  22.         print s
  23.         time.sleep(0.5)
  24.         r=requests.get(url+"?"+urlencode({'answer':s}),cookies=cookies)
  25.         print r.text
  26.         break
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top