Skip to content

Commit 3fe885d

Browse files
author
Michael Skelton
committed
First implementation of new classes for hosts/outputs
1 parent 15c451d commit 3fe885d

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

VHostScan.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ def main():
5151
print("\n[+] Most likely matches with a unique count of %s or less:" % arguments.unique_depth)
5252
for p in scanner.likely_matches(): print(" [>] %s" % p)
5353

54+
for p in scanner.hosts: print ("[!!!!] %s (%s)" % (p.hostname, p.response_code))
55+
5456
if __name__ == "__main__":
5557
main()

lib/core/virtual_host_scanner.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import requests
33
import hashlib
44
import pandas as pd
5+
from lib.core.discovered_host import *
56

67
class virtual_host_scanner(object):
78
"""Virtual host scanning class
@@ -29,9 +30,14 @@ def __init__(self, target, base_host, port=80, real_port=80, ssl=False, unique_d
2930
self.unique_depth = unique_depth
3031
self.ssl = ssl
3132

33+
# this can be made redundant in future with better exceptions
3234
self.completed_scan=False
35+
36+
# this is maintained until likely-matches is refactored to use new class
3337
self.results = []
34-
38+
39+
# store associated data for discovered hosts in array for oN, oJ, etc'
40+
self.hosts = []
3541

3642
def scan(self):
3743
virtual_host_list = open(self.wordlist).read().splitlines()
@@ -65,15 +71,21 @@ def scan(self):
6571

6672
# hash the page results to aid in identifing unique content
6773
page_hash = hashlib.sha256(res.text.encode('utf-8')).hexdigest()
68-
output = '[#] Found: {} (code: {}, length: {}, hash: {})'.format(hostname, res.status_code,
74+
output = '[#] Found: {} (code: {}, length: {}, hash: {})\n'.format(hostname, res.status_code,
6975
res.headers.get('content-length'), page_hash)
7076

71-
# print current results
72-
print(output)
7377
for key, val in res.headers.items():
74-
output = ' {}: {}'.format(key, val)
75-
print(output)
76-
78+
output += ' {}: {}\n'.format(key, val)
79+
80+
# print current results so feedback remains in "realtime"
81+
print(output)
82+
83+
# temporary host class code
84+
host = discovered_host()
85+
host.hostname = hostname
86+
host.response_code = res.status_code
87+
self.hosts.append(host)
88+
7789
# add url and hash into array for likely matches
7890
self.results.append(hostname + ',' + page_hash)
7991

0 commit comments

Comments
 (0)