Skip to content

Instantly share code, notes, and snippets.

@YasserGersy
Created September 16, 2017 23:34
Show Gist options
  • Save YasserGersy/14cbadd0e6cf5318e5673fd57d7f32cb to your computer and use it in GitHub Desktop.
Save YasserGersy/14cbadd0e6cf5318e5673fd57d7f32cb to your computer and use it in GitHub Desktop.
Scan domains against x-amz-meta-s3cmd-attrs information disclosure
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