Created
September 16, 2017 23:34
-
-
Save YasserGersy/14cbadd0e6cf5318e5673fd57d7f32cb to your computer and use it in GitHub Desktop.
Scan domains against x-amz-meta-s3cmd-attrs information disclosure
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,sys | |
requests.packages.urllib3.disable_warnings() | |
if len(sys.argv)<2: | |
path='final.txt' | |
else: | |
path=sys.argv[1] | |
vulnerable=[] | |
data=open(path,'r').readlines() | |
print '\n------------------------------------------------------------\n' | |
print len(data) | |
print '\n------------------------------------------------------------\n' | |
def check(d): | |
d=d.strip() | |
if d.startswith('http') is False: | |
d='http://'+d | |
r=requests.get(url=d,allow_redirects=True,verify=False) | |
try: | |
amz_h=r.headers['x-amz-meta-s3cmd-attrs'] | |
except Exception: | |
amz_h='' | |
if len(amz_h)>3: | |
vulnerable.append(amz_h) | |
open('vulnerable.txt','w').writelines(vulnerable) | |
print '---------------------------------------\n'+d+':'+amz_h+'\n----------------------------------\n' | |
#exit(0) | |
for d in data: | |
print d, | |
if ' ' in d: | |
continue | |
try: | |
check(d) | |
except Exception: | |
#print 'Failed ' | |
print '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment