Skip to content

Commit e5420d4

Browse files
authored
Fixed missing imports for Kerberos authentification
1 parent d44cf3c commit e5420d4

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

FindUncommonShares.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@
1414
# Remi GASCOU (@podalirius_)
1515
#
1616

17-
import argparse
18-
import sys
19-
import traceback
20-
import logging
21-
import threading
22-
from enum import Enum
2317
from concurrent.futures import ThreadPoolExecutor
24-
from impacket import version
18+
from enum import Enum
2519
from impacket.examples import logger, utils
20+
from impacket import version
2621
from impacket.smbconnection import SMBConnection, SMB2_DIALECT_002, SMB2_DIALECT_21, SMB_DIALECT, SessionError
22+
from impacket.spnego import SPNEGO_NegTokenInit, TypesMech
23+
import argparse
24+
import binascii
25+
import json
2726
import ldap3
27+
import logging
2828
import nslookup
29-
import json
29+
import os
30+
import ssl
31+
import sys
32+
import threading
3033
import time
34+
import traceback
35+
3136

3237
COMMON_SHARES = [
3338
"C$", "D$",
@@ -204,8 +209,8 @@ def ldap3_kerberos_login(connection, target, user, password, domain='', lmhash='
204209
if len(nthash) % 2:
205210
nthash = '0' + nthash
206211
try: # just in case they were converted already
207-
lmhash = unhexlify(lmhash)
208-
nthash = unhexlify(nthash)
212+
lmhash = binascii.unhexlify(lmhash)
213+
nthash = binascii.unhexlify(nthash)
209214
except TypeError:
210215
pass
211216

@@ -405,12 +410,12 @@ def worker(args, target_name, domain, username, password, address, lmhash, nthas
405410
"computer": target_name,
406411
"comment": sharecomment,
407412
"type": {
408-
"stype_value":sharetype,
409-
"stype_flags":STYPE_MASK(sharetype)
413+
"stype_value": sharetype,
414+
"stype_flags": STYPE_MASK(sharetype)
410415
}
411416
}
412417
f = open(args.output_file, "a")
413-
f.write(json.dumps(d)+"\n")
418+
f.write(json.dumps(d) + "\n")
414419
f.close()
415420
lock.release()
416421
elif args.debug:

0 commit comments

Comments
 (0)