@@ -116,9 +116,10 @@ def __init__(self, remoteName, username='', password='', domain='', options=None
116
116
self .__resumeFileName = options .resumefile
117
117
self .__canProcessSAMLSA = True
118
118
self .__kdcHost = options .dc_ip
119
- self .__remoteSSMethod = options .use_remoteSSMethod
120
- self .__remoteSSMethodRemoteVolume = options .remoteSS_remote_volume
121
- self .__remoteSSMethodDownloadPath = options .remoteSS_local_path
119
+ self .__remoteSSWMI = options .use_remoteSSWMI
120
+ self .__remoteSSWMINTDS = options .use_remoteSSWMI_NTDS
121
+ self .__remoteSSMethodWMIRemoteVolume = options .remoteSSWMI_remote_volume
122
+ self .__remoteSSMethodWMIDownloadPath = options .remoteSSWMI_local_path
122
123
self .__options = options
123
124
124
125
if options .hashes is not None :
@@ -174,9 +175,10 @@ def ldapConnect(self):
174
175
175
176
def dump (self ):
176
177
try :
177
- # Almost like LOCAL but create a Shadow Snapshot at target and download SAM, SYSTEM and SECURITY from the SS.
178
+ # Almost like LOCAL but create (and deletes it after finishing) a Shadow Snapshot at target and download SAM, SYSTEM and SECURITY from the SS. No Code Execution.
179
+ # If specified, NTDS will be also downloaded and parsed (no code execution needed, in contrast to vssadmin method). Use it when targeting a DC.
178
180
# Then, parse locally
179
- if self .__remoteSSMethod :
181
+ if self .__remoteSSWMI :
180
182
self .__isRemote = False
181
183
self .__useVSSMethod = True
182
184
try :
@@ -191,16 +193,15 @@ def dump(self):
191
193
else :
192
194
raise
193
195
194
- # TESTING C:\\
195
- # Should specify Volume with argument
196
196
self .__remoteOps = RemoteOperations (self .__smbConnection , self .__doKerberos , self .__kdcHost ,
197
197
self .__ldapConnection )
198
198
self .__remoteOps .setExecMethod (self .__options .exec_method )
199
- sam_path , system_path , security_path = self .__remoteOps .createSSandDownload (self .__remoteSSMethodRemoteVolume ,
200
- self .__remoteSSMethodDownloadPath )
199
+ sam_path , system_path , security_path , * ntds_path = self .__remoteOps .createSSandDownloadWMI (self .__remoteSSMethodWMIRemoteVolume ,
200
+ self .__remoteSSMethodWMIDownloadPath , self . __remoteSSWMINTDS )
201
201
self .__samHive = sam_path
202
202
self .__systemHive = system_path
203
203
self .__securityHive = security_path
204
+ self .__ntdsFile = ntds_path [0 ] if ntds_path else None
204
205
205
206
localOperations = LocalOperations (self .__systemHive )
206
207
bootKey = localOperations .getBootKey ()
@@ -316,7 +317,7 @@ def dump(self):
316
317
317
318
self .__NTDSHashes = NTDSHashes (NTDSFileName , bootKey , isRemote = self .__isRemote , history = self .__history ,
318
319
noLMHash = self .__noLMHash , remoteOps = self .__remoteOps ,
319
- useVSSMethod = self .__useVSSMethod , justNTLM = self .__justDCNTLM ,
320
+ useVSSMethod = self .__useVSSMethod , remoteSSMethodWMINTDS = self . __remoteSSWMINTDS , justNTLM = self .__justDCNTLM ,
320
321
pwdLastSet = self .__pwdLastSet , resumeSession = self .__resumeFileName ,
321
322
outputFileName = self .__outputFileName , justUser = self .__justUser ,
322
323
skipUser = self .__skipUser , ldapFilter = self .__ldapFilter ,
@@ -418,11 +419,13 @@ def cleanup(self):
418
419
help = 'Use the Kerb-Key-List method instead of default DRSUAPI' )
419
420
parser .add_argument ('-exec-method' , choices = ['smbexec' , 'wmiexec' , 'mmcexec' ], nargs = '?' , default = 'smbexec' , help = 'Remote exec '
420
421
'method to use at target (only when using -use-vss). Default: smbexec' )
421
- parser .add_argument ('-use-remoteSSMethod ' , action = 'store_true' ,
422
+ parser .add_argument ('-use-remoteSSWMI ' , action = 'store_true' ,
422
423
help = 'Remotely create Shadow Snapshot via WMI and download SAM, SYSTEM and SECURITY from it, the parse locally' )
423
- parser .add_argument ('-remoteSS-remote-volume' , action = 'store' , default = 'C:\\ ' ,
424
- help = 'Remote Volume to perform the Shadow Snapshot and download SAM, SYSTEM and SECURITY' )
425
- parser .add_argument ('-remoteSS-local-path' , action = 'store' , default = '.' ,
424
+ parser .add_argument ('-use-remoteSSWMI-NTDS' , action = 'store_true' ,
425
+ help = 'Dump NTDS.DIT also when using the Remote Shadow Snapshot Method via WMI. Use it with dumping from a DC. IMPORTANT: this flag only works when also using -use-remoteSSWMI' )
426
+ parser .add_argument ('-remoteSSWMI-remote-volume' , action = 'store' , default = 'C:\\ ' ,
427
+ help = 'Remote Volume to perform the Shadow Snapshot and download SAM, SYSTEM and SECURITY. It defaults to C:\\ ' )
428
+ parser .add_argument ('-remoteSSWMI-local-path' , action = 'store' , default = '.' ,
426
429
help = 'Path where download SAM, SYSTEM and SECURITY from Shadow Snapshot. It defaults to current path' )
427
430
428
431
group = parser .add_argument_group ('display options' )
@@ -473,8 +476,8 @@ def cleanup(self):
473
476
domain , username , password , remoteName = parse_target (options .target )
474
477
475
478
if options .just_dc_user is not None or options .ldapfilter is not None :
476
- if options .use_vss is True :
477
- logging .error ('-just-dc-user switch is not supported in VSS mode' )
479
+ if options .use_vss is True or options . use_remoteSSWMI_NTDS is True :
480
+ logging .error ('-just-dc-user switch is not supported in VSS mode nor WMI VSS mode ' )
478
481
sys .exit (1 )
479
482
elif options .resumefile is not None :
480
483
logging .error ('resuming a previous NTDS.DIT dump session not compatible with -just-dc-user switch' )
@@ -486,8 +489,12 @@ def cleanup(self):
486
489
# Having this switch on implies not asking for anything else.
487
490
options .just_dc = True
488
491
489
- if options .use_vss is True and options .resumefile is not None :
490
- logging .error ('resuming a previous NTDS.DIT dump session is not supported in VSS mode' )
492
+ if (options .use_vss is True or options .use_remoteSSWMI_NTDS is True ) and options .resumefile is not None :
493
+ logging .error ('resuming a previous NTDS.DIT dump session is not supported in VSS mode nor WMI VSS mode' )
494
+ sys .exit (1 )
495
+
496
+ if options .use_remoteSSWMI_NTDS is True and options .use_remoteSSWMI is not True :
497
+ logging .error ('-use-remoteSSWMI-NTDS requires -use-remoteSSWMI to be specified' )
491
498
sys .exit (1 )
492
499
493
500
if options .use_keylist is True and (options .rodcNo is None or options .rodcKey is None ):
0 commit comments