@@ -13,41 +13,40 @@ def __init__(self, scanner, arguments):
13
13
self .arguments = arguments
14
14
15
15
def write_normal (self , filename ):
16
-
17
16
file = file_helper (filename )
18
17
19
18
# todo: finish check_directory (needs regex to split out filename)
20
19
# file.check_directory(filename)
21
20
22
21
output = self .generate_header ()
23
22
output += self .output_normal_likely ()
24
-
23
+
25
24
if (self .arguments .fuzzy_logic ):
26
25
output += self .output_fuzzy ()
27
-
26
+
28
27
output += self .output_normal_detail ()
29
-
28
+
30
29
file .write_file (output )
31
30
32
31
def output_normal_likely (self ):
33
32
uniques = False
34
33
depth = str (self .scanner .unique_depth )
35
- output = "\n [+] Most likely matches with a unique count of {} or less:" .format (depth )
36
-
37
- for p in self .scanner .likely_matches ():
34
+ output = "\n [+] Most likely matches with a unique count " \
35
+ "of {} or less:" .format (depth )
36
+
37
+ for p in self .scanner .likely_matches ():
38
38
output += "\n \t [>] {}" .format (p )
39
39
uniques = True
40
-
40
+
41
41
if (uniques ):
42
42
return output
43
43
else :
44
- return "\n [!] No matches with a unique count of {} or less." . format ( depth )
45
-
44
+ return "\n [!] No matches with an" \
45
+ " unique count of {} or less." . format ( depth )
46
46
47
47
def output_json (self , filename ):
48
48
file = file_helper (filename )
49
49
output = dict ()
50
- output ['Start Time' ] = '{} {}' .format (time .strftime ("%d/%m/%Y" ), time .strftime ("%H:%M:%S" ))
51
50
output ['Target' ] = self .scanner .target
52
51
output ['Base Host' ] = self .scanner .base_host
53
52
output ['Port' ] = self .scanner .port
@@ -57,46 +56,82 @@ def output_json(self, filename):
57
56
output ['Wordlist' ] = self .scanner .wordlist
58
57
output ['Unique Depth' ] = self .scanner .unique_depth
59
58
output ['SSL' ] = self .scanner .ssl
59
+ output ['Start Time' ] = '{} {}' .format (
60
+ time .strftime ("%d/%m/%Y" ),
61
+ time .strftime ("%H:%M:%S" )
62
+ )
63
+
60
64
result = dict ()
61
65
for host in self .scanner .hosts :
62
66
headers = dict ()
63
67
for header in host .keys :
64
68
headers [header .split (':' )[0 ]] = header .split (':' )[1 ].strip ()
65
69
66
- result [host .hostname ] = {'Code' : host .response_code ,
67
- 'Hash' : host .hash ,
68
- 'Headers' : headers }
70
+ result [host .hostname ] = {
71
+ 'Code' : host .response_code ,
72
+ 'Hash' : host .hash ,
73
+ 'Headers' : headers
74
+ }
75
+
69
76
output ['Result' ] = result
70
77
file .write_file (json .dumps (output , indent = 2 ))
71
78
72
-
73
79
def output_fuzzy (self ):
74
80
output = "\n \n [+] Match similarity using fuzzy logic:"
75
81
request_hashes = {}
76
-
82
+
77
83
for host in self .scanner .hosts :
78
84
request_hashes [host .hash ] = host .content
79
-
85
+
80
86
for a , b in itertools .combinations (request_hashes .keys (), 2 ):
81
- output += "\n \t [>] {} is {}% similar to {}" .format (a , fuzz .ratio (request_hashes [a ], request_hashes [b ]), b )
82
-
83
- return output
87
+ output += "\n \t [>] {} is {}% similar to {}" .format (
88
+ a ,
89
+ fuzz .ratio (request_hashes [a ], request_hashes [b ]),
90
+ b
91
+ )
84
92
93
+ return output
85
94
86
95
def output_normal_detail (self ):
87
96
output = "\n \n [+] Full scan results"
88
97
89
- for host in self .scanner .hosts :
90
- output += "\n \n {} (Code: {}) hash: {}" .format (str (host .hostname ), str (host .response_code ), str (host .hash ))
91
- for key in host .keys : output += "\n \t {}" .format (key )
92
-
93
- return output
98
+ for host in self .scanner .hosts :
99
+ output += "\n \n {} (Code: {}) hash: {}" .format (
100
+ str (host .hostname ),
101
+ str (host .response_code ),
102
+ str (host .hash )
103
+ )
104
+
105
+ for key in host .keys :
106
+ output += "\n \t {}" .format (key )
94
107
108
+ return output
95
109
96
110
def generate_header (self ):
97
- output = "VHostScanner Log: {} {}\n " .format (time .strftime ("%d/%m/%Y" ), time .strftime ("%H:%M:%S" ))
98
- output += "\t Target: {}\n \t Base Host: {}\n \t Port: {}" .format (self .scanner .target , self .scanner .base_host , self .scanner .port )
99
- output += "\n \t Real Port {}\n \t Ignore HTTP Codes: {}" .format (self .scanner .real_port ,self .scanner .ignore_http_codes )
100
- output += "\n \t Ignore Content Length: {}\n \t Wordlist: {}" .format (self .scanner .ignore_content_length , self .scanner .wordlist )
101
- output += "\n \t Unique Depth: {}\n \t SSL: {}\n \t " .format (self .scanner .unique_depth , self .scanner .ssl )
111
+ output = "VHostScanner Log: {} {}\n " .format (
112
+ time .strftime ("%d/%m/%Y" ),
113
+ time .strftime ("%H:%M:%S" )
114
+ )
115
+
116
+ output += "\t Target: {}\n \t Base Host: {}\n \t Port: {}" .format (
117
+ self .scanner .target ,
118
+ self .scanner .base_host ,
119
+ self .scanner .port
120
+ )
121
+
122
+ output += "\n \t Real Port {}\n \t Ignore HTTP Codes: {}" .format (
123
+ self .scanner .real_port ,
124
+ self .scanner .ignore_http_codes
125
+ )
126
+
127
+ output += "\n \t Ignore Content Length: {}\n \t Wordlist: {}" .format (
128
+ self .scanner .ignore_content_length ,
129
+ self .scanner .wordlist
130
+ )
131
+
132
+ output += "\n \t Unique Depth: {}\n \t SSL: {}\n \t " .format (
133
+ self .scanner .unique_depth ,
134
+ self .scanner .ssl
135
+ )
136
+
102
137
return output
0 commit comments