-
Notifications
You must be signed in to change notification settings - Fork 10
/
massGoBuster_ver_0.3.py
70 lines (61 loc) · 2.63 KB
/
massGoBuster_ver_0.3.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
#!/usr/bin/python3
import os, sys, operator, subprocess, threading, toolkits, asyncio
# WARNING: Do not run mass-go-buster unless you have MORE than 16GB of RAM on your host operating system and allocated AT LEAST 8GB to your guest. Gobuster itself is VERY memory hungry.
# Run gobuster 5 at a time using threading and asyncio (Python3 only)
# Work on this later, get the scanners back up
# Reasons.
# Gobustering one IP at a time is too slow
# Half-assing multiple processes by appending & creates too many processes, potentially crashing your NIC.
# Each gobuster thread needs to be throttled, up to 5 at a time.
# Meanwhile each gobuster process can have their threads throttled or increased. By default its 10 threads.
def threadPacker(thread):
return threadList
# Create 5 threads into a list. And then have asyncio run those 5 threads. The threads are joined together, once they are completed, pack 5 more threads and gobuster them.
def asyncManager(threadList):
threadList = threadPacker(thread)
return
def bash_fg(cmd):
cmd = str(cmd).strip().rstrip()
print "Running command\r\n{}".format(str(cmd))
subprocess.call(cmd,shell=True,executable='/bin/bash')
return
def runGobuster(host,port):
wordlist = sys.argv[2]
if len(sys.argv) < 4:
threads = 10
else:
threads = sys.argv[3]
output = "gobuster-{}-{}.txt".format(
str(host),
str(port)
)
cmd = "gobuster dir -u http://{}:{} -w {} -t {} -o {}".format(
str(host),
str(port),
str(wordlist),
str(threads),
str(output)
)
bash_fg(cmd)
return cmd
def readInputFile(inputFile):
# reads a input file separated as HOST,PORT
r = open(inputFile,'r+')
lines = r.readlines()
for l in lines:
line = l.split(',')
host = str(line[0]).strip().rstrip()
port = str(line[1]).strip().rstrip()
runGobuster(host,port)
return
def main():
print "MassGoBuster. Automatically run gobuster against a wordlist of host,port.\r\nComing soon: Threading by running 5 gobuster processes at a time."
if len(sys.argv) < 2:
print toolkits.yellow("Usage:\r\npython massgobuster.py <wordlist of host,ports> <wordlist of paths> <OPTIONAL: threads, default=10>")
print toolkits.cyan("\r\nEXAMPLE: python massGoBuster.py targetHostPort.txt /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt 50\r\nEXAMPLE EFFECT: Runs GoBuster at a rate of 50 threads against each target,port combo found in the list of targets using the wordlist")
exit(0)
else:
inputFile = sys.argv[1]
readInputFile(inputFile)
return
main()