From f90b76fed202ee4a6e17a030151c8de4430717a8 Mon Sep 17 00:00:00 2001 From: lgandx Date: Thu, 2 Dec 2021 22:01:18 -0300 Subject: [PATCH] Added DB for RunFinger results & Report --- Report.py | 18 +++++++++-- tools/RunFinger.py | 75 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 78 insertions(+), 15 deletions(-) diff --git a/Report.py b/Report.py index b3ab450..413ef7b 100755 --- a/Report.py +++ b/Report.py @@ -31,6 +31,10 @@ def DbConnect(): cursor = sqlite3.connect("./Responder.db") return cursor +def FingerDbConnect(): + cursor = sqlite3.connect("./tools/RunFinger.db") + return cursor + def GetResponderData(cursor): res = cursor.execute("SELECT * FROM Responder") for row in res.fetchall(): @@ -66,7 +70,12 @@ def GetUniqueDHCP(cursor): res = cursor.execute("SELECT * FROM DHCP WHERE MAC in (SELECT DISTINCT UPPER(MAC) FROM DHCP)") for row in res.fetchall(): print('MAC: {0}, IP: {1}, RequestedIP: {2}'.format(row[1], row[2], row[3])) - + +def GetRunFinger(cursor): + res = cursor.execute("SELECT * FROM RunFinger WHERE Host in (SELECT DISTINCT Host FROM RunFinger)") + for row in res.fetchall(): + print(("{},['{}', Os:'{}', Build:'{}', Domain:'{}', Bootime:'{}', Signing:'{}', Null Session: '{}', RDP:'{}']".format(row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9]))) + def GetStatisticUniqueLookups(cursor): res = cursor.execute("SELECT COUNT(*) FROM Poisoned WHERE ForName in (SELECT DISTINCT UPPER(ForName) FROM Poisoned)") for row in res.fetchall(): @@ -98,5 +107,8 @@ GetResponderUsernames(cursor) print(color("\n[+] Username details:", code = 2, modifier = 1)) GetResponderUsernamesWithDetails(cursor) GetResponderUsernamesStatistic(cursor) -#print color("\n[+] Captured hashes:", code = 2, modifier = 1) -#GetResponderCompleteHash(cursor) +print color("\n[+] RunFinger Scanned Hosts:", code = 2, modifier = 1) +cursor.close() +cursor = FingerDbConnect() +GetRunFinger(cursor) +print('\n') diff --git a/tools/RunFinger.py b/tools/RunFinger.py index 1d11d95..3c0efc8 100755 --- a/tools/RunFinger.py +++ b/tools/RunFinger.py @@ -17,11 +17,15 @@ import re,sys,struct import datetime import multiprocessing -from socket import * -from odict import OrderedDict +import os import errno import optparse +import sqlite3 from RunFingerPackets import * +from odict import OrderedDict +from socket import * +from odict import OrderedDict + __version__ = "1.7" parser = optparse.OptionParser(usage='python %prog -i 10.10.10.224\nor:\npython %prog -i 10.10.10.0/24', version=__version__, prog=sys.argv[0]) @@ -42,6 +46,7 @@ Host = options.TARGET Filename = options.Filename SMB1 = "Enabled" SMB2signing = "False" +DB = os.path.abspath(os.path.join(os.path.dirname(__file__)))+"/RunFinger.db" class Packet(): fields = OrderedDict([ @@ -62,6 +67,13 @@ if (sys.version_info > (3, 0)): else: PY2OR3 = "PY2" + +if not os.path.exists(DB): + cursor = sqlite3.connect(DB) + cursor.execute('CREATE TABLE RunFinger (timestamp TEXT, Protocol TEXT, Host TEXT, WindowsVersion TEXT, OsVer TEXT, DomainJoined TEXT, Bootime TEXT, Signing TEXT, NullSess TEXT, IsRDPOn TEXT)') + cursor.commit() + cursor.close() + def StructWithLenPython2or3(endian,data): #Python2... if PY2OR3 == "PY2": @@ -117,7 +129,23 @@ def WorkstationFingerPrint(data): def GetOsBuildNumber(data): ProductBuild = struct.unpack("