-
Notifications
You must be signed in to change notification settings - Fork 70
/
nuclei.py
67 lines (59 loc) · 2.91 KB
/
nuclei.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
import platform
class Scan:
def __init__(self):
self.system = platform.system()
self.machine = platform.machine()
if "Darwin" in self.system and "arm64" in self.machine:
self.path = "./nuclei/macos/nuclei_arm"
elif "Darwin" in self.system and "amd64" in self.machine:
self.path = "./nuclei/macos/nuclei_amd"
elif "Linux" in self.system and "armv6" in self.machine:
self.path = "./nuclei/linux/nuclei_armv6"
elif "Linux" in self.system and "arm" in self.machine:
self.path = "./nuclei/linux/nuclei_arm"
elif "Linux" in self.system and "386" in self.machine:
self.path = "./nuclei/linux/nuclei_386"
elif "Linux" in self.system and "x86_64" in self.machine:
self.path = "./nuclei/linux/nuclei_amd"
elif "Windows" in self.system and "x86_64" in self.machine:
self.path = "nuclei\\windows\\nuclei_386.exe"
elif "Windows" in self.system and "AMD64" in self.machine:
self.path = "nuclei\\windows\\nuclei_amd.exe"
else:
self.path = None
def single_target(self, target, filename="scan_result.txt"):
if "windows" in self.path:
self.cmd = "{} -u {} -o {} -nc".format(self.path, target, filename)
else:
self.cmd = "{} -u {} -o {}".format(self.path, target, filename)
return self.cmd
def multi_target(self, target, filename="scan_result.txt"):
if "windows" in self.path:
self.cmd = "{} -l {} -o {} -nc".format(self.path, target, filename)
else:
self.cmd = "{} -l {} -o {}".format(self.path, target, filename)
return self.cmd
def single_multi_target(self, target, key, value, filename="scan_result.txt"):
if "windows" in self.path:
self.cmd = "{} -{} {} -u {} -o {} -nc".format(self.path, key, value, target, filename)
else:
self.cmd = "{} -{} {} -u {} -o {}".format(self.path, key, value, target, filename)
return self.cmd
def keyword_multi_target(self, target, key, value, filename="scan_result.txt"):
if "windows" in self.path:
self.cmd = "{} -{} {} -l {} -o {} -nc".format(self.path, key, value, target, filename)
else:
self.cmd = "{} -{} {} -l {} -o {}".format(self.path, key, value, target, filename)
return self.cmd
def customize_cmd(self, target, customize_cmd, filename="scan_result.txt"):
if "windows" in self.path:
self.cmd = "{} {} -l {} -o {} -nc".format(self.path, customize_cmd, target, filename)
else:
self.cmd = "{} {} -l {} -o {}".format(self.path, customize_cmd, target, filename)
return self.cmd
def update(self):
if "windows" in self.path:
self.cmd = "{} -update -nc".format(self.path)
else:
self.cmd = "{} -update".format(self.path)
return self.cmd