-
Notifications
You must be signed in to change notification settings - Fork 21
/
cloudhunter
executable file
·191 lines (153 loc) · 6.24 KB
/
cloudhunter
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/python
import requests, sys, optparse, os
OKBLUE='\033[94m'
OKRED='\033[91m'
OKGREEN='\033[92m'
OKORANGE='\033[93m'
COLOR1='\033[95m'
COLOR2='\033[96m'
RESET='\x1b[0m'
def logo():
version = "1.0"
print ('')
print (' _/ _/ _/ _/ ')
print (' _/_/_/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/_/_/ _/_/ _/ _/_/ ')
print (' _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/ ')
print ('_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ ')
print (' _/_/_/ _/ _/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/ _/_/ _/_/_/ _/ ')
print ('')
print (OKORANGE + " + -- --=[CloudHunter by 1N3 - https://crowdshield.com" + RESET)
print (RESET)
logo()
if len(sys.argv) < 2:
print ("You need to specify a domain to check. Use --help for all options.")
quit()
else:
parser = optparse.OptionParser()
parser.add_option('-d', '--domain',
action="store", dest="domain",
help="Domain name to test", default="")
parser.add_option('-w', '--wordlist',
action="store", dest="wordlist",
help="Wordlist of domains to test", default="")
parser.add_option('-v', '--verbose',
action="store", dest="verbose",
help="Turn on verbose logging", default="")
options, args = parser.parse_args()
target = str(options.domain)
wordlist = str(options.wordlist)
verbose = str(options.verbose)
cloudfronturl = 'http://coach.fitbit.com'
if (len(wordlist) > 4):
with open(wordlist) as f:
urls = f.read().splitlines()
for url in urls:
if verbose == 'y':
print(url)
# LOOKING FOR CNAME S3 BUCKETS ON TARGET URL ###########################################################
try:
if verbose == 'y':
print ("Looking for CloudFront CNAME's pointing to " + url)
headers = {'Host':'%s' % url}
params = ''
r = requests.get(cloudfronturl, params=params, headers=headers)
resp = r.text
if "ListBucketResult" in str(resp):
print(OKRED + '[+] 1 Host ' + url + ' has a CloudFront CNAME record pointing to a public S3 bucket!' + RESET)
if verbose == 'y':
print(resp)
except:
pass
# LOOKING FOR TOP LEVEL S3 BUCKETS ON TARGET URL ########################################################
try:
if verbose == 'y':
print ('Checking for public S3 bucket on https://' + url + '.s3.amazonaws.com')
r2 = requests.get('https://' + url + '.s3.amazonaws.com', timeout=2)
resp2 = r2.text
if "ListBucketResult" in str(resp2):
print(OKRED + '[+] 2 Host ' + url + ' has a public S3 bucket registered to the url https://' + url + '.s3.amazonaws.com!' + RESET)
if verbose == 'y':
print(resp2)
except:
pass
# LOOKING FOR TOP LEVEL S3 BUCKETS ON TARGET URL ########################################################
try:
keyword = url.split(".")[-2]
url3 = 'https://' + keyword + '.s3.amazonaws.com'
if verbose == 'y':
print ('Checking for public S3 bucket on ' + url3)
r3 = requests.get('https://' + keyword + '.s3.amazonaws.com', timeout=2)
resp3 = r3.text
if "ListBucketResult" in str(resp3):
print(OKRED + '[+] 3 Host ' + url + ' has a public S3 bucket registered to the url https://' + keyword + '.s3.amazonaws.com!' + RESET)
if verbose == 'y':
print(resp3)
except:
pass
# LOOKING FOR DIRECT S3 BUCKETS ON TARGET URL ############################################################
try:
r4 = requests.get('https://' + url, timeout=2)
resp4 = r3.text
if verbose == 'y':
print ('Checking for public S3 bucket on https://' + url)
if "ListBucketResult" in str(resp4):
print(OKRED + '[+] 4 Host ' + url + ' has a public S3 bucket registered to the url https://' + url + '.s3.amazonaws.com!' + RESET)
if verbose == 'y':
print(resp4)
except Exception as ex:
pass
else:
if verbose == 'y':
print(target)
# LOOKING FOR CNAME S3 BUCKETS ON TARGET URL ###########################################################
try:
if verbose == 'y':
print ("Looking for CloudFront CNAME's on " + target)
headers = {'Host':'%s' % target}
params = ''
r = requests.get(cloudfronturl, params=params, headers=headers)
resp = r.text
if "ListBucketResult" in str(resp):
print(OKRED + '[+] Host ' + target + ' has a CloudFront CNAME record pointing to a public S3 bucket!' + RESET)
if verbose == 'y':
print(resp)
except:
pass
# LOOKING FOR TOP LEVEL S3 BUCKETS ON TARGET URL ########################################################
try:
if verbose == 'y':
print ('Checking for public S3 bucket on https://' + target + '.s3.amazonaws.com')
r2 = requests.get('https://' + target + '.s3.amazonaws.com', timeout=2)
resp2 = r2.text
if "ListBucketResult" in str(resp2):
print(OKRED + '[+] Host ' + target + ' has a public S3 bucket registered to the target https://' + target + '.s3.amazonaws.com!' + RESET)
if verbose == 'y':
print(resp2)
except:
pass
# LOOKING FOR TOP LEVEL S3 BUCKETS ON TARGET URL ##########################################################
try:
keyword = target.split(".")[-2]
target3 = 'https://' + keyword + '.s3.amazonaws.com'
if verbose == 'y':
print ('Checking for public S3 bucket on ' + target3)
r3 = requests.get('https://' + keyword + '.s3.amazonaws.com', timeout=2)
resp3 = r3.text
if "ListBucketResult" in str(resp3):
print(OKRED + '[+] Host ' + target + ' has a public S3 bucket registered to the url https://' + keyword + '.s3.amazonaws.com!' + RESET)
if verbose == 'y':
print(resp3)
except:
pass
# LOOKING FOR DIRECT S3 BUCKETS ON TARGET URL ############################################################
try:
r4 = requests.get('https://' + target, timeout=2)
resp4 = r3.text
if verbose == 'y':
print ('Checking for public S3 bucket on https://' + target)
if "ListBucketResult" in str(resp4):
print(OKRED + '[+] Host ' + target + ' has a public S3 bucket registered to the url https://' + target + '!' + RESET)
if verbose == 'y':
print(resp4)
except Exception as ex:
pass