From d2e5642d58a70a182fa319f9245a3c32442b1f72 Mon Sep 17 00:00:00 2001 From: lgandx Date: Thu, 31 Dec 2020 01:13:27 -0300 Subject: [PATCH] Added SMB2 support for RunFinger and various other checks. --- tools/RunFinger.py | 221 ++++++++++++++++++++++++++++---------- tools/RunFingerPackets.py | 206 +++++++++++++++++++++++++++++++++++ 2 files changed, 371 insertions(+), 56 deletions(-) diff --git a/tools/RunFinger.py b/tools/RunFinger.py index 33669f9..d13dabb 100755 --- a/tools/RunFinger.py +++ b/tools/RunFinger.py @@ -19,14 +19,16 @@ import datetime import multiprocessing from socket import * from odict import OrderedDict +import errno import optparse from RunFingerPackets import * -__version__ = "1.0" +__version__ = "1.2" 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]) parser.add_option('-i','--ip', action="store", help="Target IP address or class C", dest="TARGET", metavar="10.10.10.224", default=None) -parser.add_option('-g','--grep', action="store_true", dest="grep_output", default=False, help="Output in grepable format") +#Way better to have grepable output by default... +#parser.add_option('-g','--grep', action="store_true", dest="grep_output", default=False, help="Output in grepable format") options, args = parser.parse_args() if options.TARGET is None: @@ -36,6 +38,7 @@ if options.TARGET is None: Timeout = 2 Host = options.TARGET +SMB1 = "Enabled" class Packet(): fields = OrderedDict([ @@ -80,14 +83,67 @@ def longueur(payload): length = StructWithLenPython2or3(">i", len(''.join(payload))) return length +def ParseNegotiateSMB2Ans(data): + if data[4:8] == b"\xfeSMB": + return True + else: + return False + +def WorkstationFingerPrint(data): + return { + b"\x04\x00" :"Windows 95", + b"\x04\x0A" :"Windows 98", + b"\x04\x5A" :"Windows ME", + b"\x05\x00" :"Windows 2000", + b"\x05\x01" :"Windows XP", + b"\x05\x02" :"Windows XP(64-Bit)/Windows 2003", + b"\x06\x00" :"Windows Vista/Server 2008", + b"\x06\x01" :"Windows 7/Server 2008R2", + b"\x06\x02" :"Windows 8/Server 2012", + b"\x06\x03" :"Windows 8.1/Server 2012R2", + b"\x0A\x00" :"Windows 10/Server 2016/2019 (check build)", + }.get(data, 'Other than Microsoft') + +def GetOsBuildNumber(data): + ProductBuild = struct.unpack("