-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy paths3.py
executable file
·55 lines (44 loc) · 1.33 KB
/
s3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
import requests
import sys
url = 'https://s3.amazonaws.com/'
name = sys.argv[1].strip()
common = ['test','dev','bucket','s3','aws','prd','prod','pub','public','production','development','testing','archive','backup','web','devops','sec','secure','hidden','secret','staging','download']
connectors = ['-','_','']
url = url + name
def check_code(r, name):
if r.status_code == 404: print "None",
elif r.status_code == 403: print "Secure",
elif r.status_code == 301: print "Redirect",
elif r.status_code == 200: print "BINGO!",
elif r.status_code == 400: print "BadName",
else: print r.status_code,
print name
return
'''
def get_code(url, name):
r = requests.get(url)
check_code(r, name)
if r.status_code == 403 or r.status_code == 200:
for ext in common:
r = requests.get(url + ext)
check_code(r, name + ext)
'''
def get_code(url, name):
r = requests.get(url)
check_code(r, name)
for ext in common:
for i in connectors:
r = requests.get(url + i + ext)
check_code(r, name + i + ext)
get_code(url, name)
if '.' in name:
n2 = 'www.' + name
url = 'https://s3.amazonaws.com/' + n2
get_code(url, n2)
n2 = 's3.' + name
url = 'https://s3.amazonaws.com/' + n2
get_code(url, n2)
n3 = name.split('.')[0]
url = 'https://s3.amazonaws.com/' + n3
get_code(url, n3)