-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathScavenger.py
208 lines (129 loc) · 5.36 KB
/
Scavenger.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
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
import os
import sys
import argparse
import subprocess
import configparser
from time import sleep
from threading import Thread
from requests import post
config = configparser.ConfigParser()
config.read('config.ini')
slack = config['default']['SLACKBB']
parser = argparse.ArgumentParser(description='Recon Testing')
parser.add_argument("--domain", "-D", dest='domain', help='Domain Name for the Recon!', required=True)
args = parser.parse_args()
dom = args.domain
os.mkdir(dom)
os.chdir(dom)
# Passive Amass Scanning
def amass_scan():
subprocess.check_output(["amass", "enum", "--passive", "-d", dom, "-o", "amass.txt"], stderr=subprocess.DEVNULL)
send = "Amass found " + str(sum(1 for line in open('amass.txt'))) + " Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
# Findomain Scanning
def findomain_scan():
subprocess.check_output(["findomain", "--target", dom, "--threads", "50", "-u", "findomain.txt"], stderr=subprocess.STDOUT)
send = "Findomain found " + str(sum(1 for line in open('findomain.txt'))) + " Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
# Assetfinder Scanning
def assetfinder_scan():
with open("assetfinder.txt", "w") as fp:
subprocess.run(["assetfinder", "--subs-only", dom], text=True, stdout=fp)
send = "Assetfinder found " + str(sum(1 for line in open('assetfinder.txt'))) + " Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
def subfinder_scan():
subprocess.check_output(["subfinder", "-silent", "-t", "100", "-d", dom, "-o", "subfinder.txt"], stderr=subprocess.STDOUT)
send = "Subfinder found " + str(sum(1 for line in open('subfinder.txt'))) + " Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
#Commomspeak2 Brute Forcing
def cspeak_brute():
wordlist = open('/root/Wordlists/subdomains.txt').read().split('\n')
for word in wordlist:
if not word.strip():
continue
f = open("CommonSpeak_Bruted.txt", "a+" )
f.write('{}.{}\n'.format(word.strip(), args.domain))
f.close()
send = 'CommomSpeak Generated ' + str(sum(1 for line in open('CommonSpeak_Bruted.txt'))) + ' Domains'
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
def Combine():
p1 = subprocess.run(['cat', 'CommonSpeak_Bruted.txt', 'amass.txt', 'findomain.txt', 'assetfinder.txt', 'subfinder.txt'], text=True, capture_output=True)
with open("Potential-Domains.txt", "w") as fp:
subprocess.run(['sort', '-u'], text=True, input=p1.stdout, stdout=fp)
subprocess.run(['rm', 'CommonSpeak_Bruted.txt', 'amass.txt', 'findomain.txt', 'assetfinder.txt', 'subfinder.txt'])
send = "Total found " + str(sum(1 for line in open('Potential-Domains.txt'))) + " Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
def Resolve():
subprocess.check_output(["shuffledns", "-silent", "-d", dom, "-list", "Potential-Domains.txt", "-r", "/root/tools/findomain/massdns/lists/resolvers.txt", "-t", "15000", "-o", "Domains-Online.txt"], stderr=subprocess.STDOUT)
subprocess.run(['rm', 'Potential-Domains.txt'])
send = "Total " + str(sum(1 for line in open('Domains-Online.txt'))) + " Live Passive Domains"
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
def Brute():
import BrutedSubs
BrutedSubs.main(dom,slack)
def PortScans():
import PortsAndServices
pscan = "\nRunning PortScans..."
print(pscan)
post(slack, data="{'text': '" + pscan + "'}", headers={'Content-Type': 'application/json'})
PortsAndServices.main(slack)
def DirBrute():
import Dbrute
bfuff = "\nDirectory BruteForcing..."
print(bfuff)
post(slack, data="{'text': '" + bfuff + "'}", headers={'Content-Type': 'application/json'})
Dbrute.main(slack)
def main():
letsgo = "\n\n[+] Script Execution Started...\n\n"
print(letsgo)
post(slack, data="{'text': '" + letsgo + "'}", headers={'Content-Type': 'application/json'})
t1 = Thread(target=amass_scan)
t2 = Thread(target=findomain_scan)
t3 = Thread(target=assetfinder_scan)
t4 = Thread(target=subfinder_scan)
t5 = Thread(target=cspeak_brute)
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()
# Combining the Subdomain Lists
send = "\nCombining files from all Tools..."
print(send)
post(slack, data="{'text': '" + send + "'}", headers={'Content-Type': 'application/json'})
Combine()
# Resolving with Shuffledns
shufl = "\nResolving Passive Domains...."
print(shufl)
post(slack, data="{'text': '" + shufl + "'}", headers={'Content-Type': 'application/json'})
Resolve()
# Calling the BruteForcer
bruf = "\nBruteForcing and Resolving to find more Domains..."
print(bruf)
post(slack, data="{'text': '" + bruf + "'}", headers={'Content-Type': 'application/json'})
Brute()
# t6 = Thread(target=PortScans)
# t7 = Thread(target=DirBrute)
# t6.start()
# t7.start()
# t6.join()
# t7.join()
PortScans()
DirBrute()
fin = "\n\n[$$$] ALL THE BORING STUFF DONE, GO HACK NOW...! [$$$]"
print(fin)
post(slack, data="{'text': '" + fin + "'}", headers={'Content-Type': 'application/json'})
if __name__ == '__main__':
main()