Skip to content

Commit ffeb9e8

Browse files
author
Michael Skelton
committed
Wireframing for fuzzy-logic
1 parent 39c7e04 commit ffeb9e8

File tree

7 files changed

+27
-6
lines changed

7 files changed

+27
-6
lines changed

VHostScan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def main():
2727
parser.add_argument('--ignore-content-length', dest='ignore_content_length', type=int, help='Ignore content lengths of specificed amount (default 0).', default=0)
2828
parser.add_argument('--unique-depth', dest='unique_depth', type=int, help='Show likely matches of page content that is found x times (default 1).', default=1)
2929
parser.add_argument("--ssl", dest="ssl", action="store_true", help="If set then connections will be made over HTTPS instead of HTTP (default http).", default=False)
30-
parser.add_argument("--fuzzy_logic", dest="fuzzy_logic", action="store_true", help="If set then fuzzy match will be performed against unique hosts (default off).", default=False)
30+
parser.add_argument("--fuzzy-logic", dest="fuzzy_logic", action="store_true", help="If set then fuzzy match will be performed against unique hosts (default off).", default=False)
3131
parser.add_argument("--waf", dest="add_waf_bypass_headers", action="store_true", help="If set then simple WAF bypass headers will be sent.", default=False)
3232
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
3333
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)
@@ -85,6 +85,9 @@ def main():
8585

8686
print(output.output_normal_likely())
8787

88+
if(arguments.fuzzy_logic):
89+
print(output.output_fuzzy())
90+
8891
if(arguments.output_normal):
8992
output.write_normal(arguments.output_normal)
9093
print("\n[+] Writing normal ouptut to %s" % arguments.output_normal)

fuzzy_logic_concept.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import itertools
66
from fuzzywuzzy import fuzz
77

8-
headers = ('a.example.com', 'b.example.com', 'c.example.com')
8+
headers = ('lol', 'intranet.example.com', 'dev.example.com')
99

1010
request_data = {}
1111

1212
for host in headers:
1313
headers = { 'Host': host }
14-
req = requests.get('http://test.host.here/', headers=headers, verify=False)
14+
req = requests.get('http://home.kent.id.au', headers=headers, verify=False)
1515
hash = hashlib.sha256(req.text.encode('utf-8')).hexdigest()
1616
request_data[hash] = req.content
1717

lib/core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# |V|H|o|s|t|S|c|a|n| Developed by @codingo_ & @__timk
33
# +-+-+-+-+-+-+-+-+-+ https://github.com/codingo/VHostScan
44

5-
__version__ = '0.7'
5+
__version__ = '1.0'
66

lib/core/discovered_host.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ def __init__(self):
77
self.hostname = ''
88
self.response_code = 0
99
self.hash = ''
10-
self.keys = []
10+
self.keys = []
11+
self.content = b''

lib/core/virtual_host_scanner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hashlib
44
import pandas as pd
55
from lib.core.discovered_host import *
6+
from fuzzywuzzy import fuzz
67

78

89
class virtual_host_scanner(object):
@@ -88,6 +89,7 @@ def scan(self):
8889
host.hostname = hostname
8990
host.response_code = res.status_code
9091
host.hash = page_hash
92+
host.content = res.content
9193

9294
for key, val in res.headers.items():
9395
output += ' {}: {}\n'.format(key, val)
@@ -120,3 +122,7 @@ def likely_matches(self):
120122
matches = ((segmented_data["key_col"].values).tolist())
121123

122124
return matches
125+
126+
def fuzzy_logic(self):
127+
# for host in self.hosts:
128+
return

lib/helpers/output_helper.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def write_normal(self, filename):
1212

1313
# todo: finish check_directory (needs regex to split out filename)
1414
# file.check_directory(filename)
15-
file.write_file(self.generate_header() + self.output_normal_likely() + self.output_normal_detail())
15+
file.write_file(self.generate_header() + self.output_normal_likely() + self.output_fuzzy() + self.output_normal_detail())
1616

1717
def output_normal_likely(self):
1818
uniques = False
@@ -28,6 +28,13 @@ def output_normal_likely(self):
2828
else:
2929
return "\n[!] No matches with a unique count of {} or less.".format(depth)
3030

31+
32+
def output_fuzzy(self):
33+
output = "\n[+] Match similarity using fuzzy logic:".format(depth)
34+
35+
return output
36+
37+
3138
def output_normal_detail(self):
3239
output = "\n\n[+] Full scan results"
3340

@@ -37,6 +44,7 @@ def output_normal_detail(self):
3744

3845
return output
3946

47+
4048
def generate_header(self):
4149
output = "VHostScanner Log: {} {}\n".format(time.strftime("%d/%m/%Y"), time.strftime("%H:%M:%S"))
4250
output += "\tTarget: {}\n\tBase Host: {}\n\tPort: {}".format(self.scanner.target, self.scanner.base_host, self.scanner.port)

wordlists/testing.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lol
2+
intranet.example.com
3+
dev.example.com

0 commit comments

Comments
 (0)