-
Notifications
You must be signed in to change notification settings - Fork 3
/
ssb
272 lines (207 loc) · 9.46 KB
/
ssb
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#!/usr/bin/python3
#@R00tendo
from screens import load_screen
from screens import count_screen
from network import host_up
from files import reader
from network import brute
import threading
import os
import termcolor
import time
import sys
import socket
import paramiko
import json
import argparse
import subprocess
def set_default(parameters):
json_data = open("json_data/default.json").read().strip()
json_settings = json.loads(json_data)
for value_name in json_settings:
value = json_settings[value_name]
if hasattr(parameters, value_name):
setattr(parameters, value_name, value)
return parameters
def get_parameters():
params = argparse.ArgumentParser()
json_data = open("json_data/parameters.json").read()
json_settings = json.loads(json_data)
for param in json_settings['params']:
if json_settings['fullname'][param]:
fullname = json_settings['fullname'][param]
else:
fullname = param
if json_settings['params'][param] == "necessary":
params.add_argument(param, fullname, help=f"({termcolor.colored(json_settings['params'][param], 'red')}) {json_settings['description'][param]}", required=True)
else:
params.add_argument(param, fullname, help=f"({json_settings['params'][param]}) {json_settings['description'][param]}", nargs='?')
args = params.parse_args()
return args
#Removes duplicates
def rem_dup(domains):
doms = []
for domain in domains:
if domain not in doms and len(domain) != 0:
doms.append(domain)
return doms
def error(text):
return termcolor.colored(text, 'red')
def success(text):
return termcolor.colored(text, 'green')
def main():
#It overwrites the paramiko transport.py file with the same one but with the errors removed so that the script works better
dest = paramiko.__file__.replace("__init__.py", "") + "transport.py"
src = "modules/paramiko/transport.py"
if os.path.exists(src):
if os.path.exists(dest):
if open(src).read() != open(dest).read():
print(f"{dest} Was overwritten with a custom one that doesn't spam your screen with errors!")
src_read = open(src, 'rb').read()
dest_write = open(dest, 'wb').write(src_read)
# os.system("cp modules/paramiko/transport.py " + dest)
#Cool logo
banner = termcolor.colored("""
^???7.
:YYYY^
?YJY~
!YJY?.
~YJYJ:
:!7777777777^ .~7777777777! :JYJY7^!!!777:
^YYYYYYYJYYYY~ .JYYYYYYJYYYY? .7YJJYYYYYYYYY~
:YJJJ:...7YYY7 ?YJY~ ..^YYYJ. ~YJYJ~^::?YJY!
JYJYJ!: :^^^. !YJJJ7^. .^^^: :YJJY: !YJY?.
~?JYYYY?!: ^7JYYYYJ7~. .JYJY~ ^YYJJ:
.~7JJYYYJ. .^!JJJYYY~ 7YJY7 :JYJY~
:7777. .7YJY?. ~777^ ~JJYJ^ ~YJYJ. 7YJY?
.?YYY?^^^^JJYJ: ~YYYY~^^:7YJY! :JJJY!:^^7YJYJ.
!YYYYYYYYYYYJ^ .YYYYYYYYYYYY7 .JYYYYYYYYYYYJ:
:~!!!!!!!!!^. ~!!!!!!!!!~^ ^!!!!!!!!!~~:.
@R00tendo at github
""", 'green')
print(banner.strip())
if len(sys.argv) < 2:
sys.argv.append('--help')
#Parameter section
parameters = get_parameters()
parameters = set_default(parameters)
try:
dns_threads = parameters.dns_threads
except:
print(error("Invalid dns_threads! Please look at the help page (--help) to see how to use this tool."))
sys.exit(1)
try:
int(parameters.scan_method)
except:
print(error("Invalid Subdomain finding method! Please look at the help page (--help) to see how to use this tool."))
sys.exit(1)
try:
int(parameters.web_threads)
except:
print(error("Invalid Web_Threads! Please look at the help page (--help) to see how to use this tool."))
sys.exit(1)
web_threads=parameters.web_threads
scan_type = parameters.scan_type.lower()
if scan_type != "validate" and scan_type != "scan" and scan_type != "light_scan":
print(error("Invalid scan_type! Please look at the help page (--help) to see how to use this tool."))
sys.exit(1)
wordlist = parameters.wordlist
word_or_sub = parameters.scan_method
try:
if word_or_sub == "4":
parameters.target = "0.0.0.0"
wordlist = parameters.target_list
else:
pass
except:
print(error("target list (-tl) not specified when using -s 4."))
sys.exit(1)
#Host dead?
host = parameters.target
try:
socket.gethostbyname(host)
except:
print(error(f"Cannot resolve {host} to an ip..."))
sys.exit(1)
print("Host is up or ip supplied!\n")
try:
if word_or_sub == "4":
str(parameters.target_list)
else:
pass
except:
print(error("Invalid scan_type! Please look at the help page (--help) to see how to use this tool."))
sys.exit(1)
if scan_type == "scan":
if len(os.popen("which sigurlfind3r").read()) == 0:
print(error("[-] Sigurlfind3r is missing!"))
sys.exit(1)
#Automated method
if word_or_sub == "1":
if len(os.popen("which sublist3r").read()) != 0 and len(os.popen("which assetfinder").read()) != 0 and len(os.popen("which findomain").read()) != 0:
load_screen.loader()
cmd = f"echo $(findomain -qt {host}) $(sublist3r -d {host} --no-color) $(assetfinder {host}) |sed \"s/ /\\n/g\" |grep {host}"
parse_out = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
parse_out = parse_out.communicate()[0].decode('latin-1').split('\n')
parse_out = rem_dup(parse_out)
load_screen.stop_loading()
time.sleep(1)
subs = parse_out
host = False
print(success(f"Done! {' '*10}"))
print(success(f"Automated scan found {len(parse_out)} subdomains!"))
else:
print(error('ERROR one or more tool are missing!'))
for command in ['sublist3r', 'assetfinder', 'findomain']:
if len(os.popen(f'which {command}').read()) == 0:
print(error(f"[-] {command}"))
else:
print(success(f"[+] {command}"))
sys.exit(1)
elif word_or_sub == "2":
pass
elif word_or_sub == "3":
pass
elif word_or_sub == "4":
host = False
try:
subs = reader.read(wordlist)
except:
print(error(f"[ERROR] Can't find wordlist {wordlist}"))
sys.exit(1)
else:
print("Invalid option, options are 1,2,3,4")
sys.exit(1)
#Determines what to ask
if word_or_sub == "2":
pass
no_wordlist = ['1', '3', '4']
if word_or_sub not in no_wordlist:
if not os.path.exists(wordlist):
print(error(f"Cant find {wordlist} or wordlist not specified, if so please do so by using -w"))
sys.exit(1)
if word_or_sub != "3":
allowed = str(dns_threads)
else:
allowed = "1"
if word_or_sub == "2":
print(success("\nLoading wordlist into memory..."))
elif word_or_sub == "1":
print(success("Going trough the subdomains..."))
#Loading screen
load_screen.loader()
time.sleep(0.4)
if word_or_sub == "2":
subs = reader.read(f"{wordlist}")
elif word_or_sub not in ['4', '1']:
subs = False
load_screen.stop_loading()
time.sleep(0.5)
if word_or_sub != "3":
print(success(f"Done, {len(subs)} words loaded! {' ' * 10}"))
time.sleep(1)
#Our journey begins!
print(success("\nStarting DNS Bruteforce..."))
brute.dns(subs, host, allowed, scan_type, web_threads)
if __name__ == "__main__":
main()