Skip to content

Instantly share code, notes, and snippets.

@ahmed-bhs
Last active February 4, 2018 20:57
Show Gist options
  • Save ahmed-bhs/7d15236d16efcd234d43a68b0e207d13 to your computer and use it in GitHub Desktop.
Save ahmed-bhs/7d15236d16efcd234d43a68b0e207d13 to your computer and use it in GitHub Desktop.
import requests
import qrtools
import re,os
from shell_command import shell_call
shell_call("rm -f *.png")
def decode_qr(r):
img="http://35.184.20.243:8002/qrweb/img/"+r
os.system("curl "+img+" >> "+r)
qr = qrtools.QR()
qr.decode(r)
return qr.data
def qr(im_reg):
qrqr=''
for im in im_reg:
q=decode_qr(im)
qrqr = qrqr + q
return qrqr
url = 'http://35.184.20.243:8002/qrweb/index.php'
print "Sending answers... (this challenge takes some time...)"
s = requests.Session()
r=s.get(url)
while True:
q = qr(re.findall(r"\d+.png",r.text))
r=s.post('http://35.184.20.243:8002/qrweb/validate.php', data={"qr": q ,'submit':'Submit+query'})
if 'CTF' in r.text :
print(r.text)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment