Moved the check to a top level function.

This commit is contained in:
Daniel Goldberg 2018-12-05 13:59:33 +02:00
parent f8f948439c
commit 61f040ef6f
1 changed files with 4 additions and 5 deletions

View File

@ -2,7 +2,7 @@ import os
import logging import logging
import sys import sys
sys.coinit_flags = 0 # needed for proper destruction of the wmi python module sys.coinit_flags = 0 # needed for proper destruction of the wmi python module
import infection_monkey.config import infection_monkey.config
from infection_monkey.system_info.mimikatz_collector import MimikatzCollector from infection_monkey.system_info.mimikatz_collector import MimikatzCollector
@ -38,7 +38,9 @@ class WindowsInfoCollector(InfoCollector):
super(WindowsInfoCollector, self).get_info() super(WindowsInfoCollector, self).get_info()
self.get_wmi_info() self.get_wmi_info()
self.get_installed_packages() self.get_installed_packages()
self.get_mimikatz_info() from infection_monkey.config import WormConfiguration
if WormConfiguration.should_use_mimikatz:
self.get_mimikatz_info()
return self.info return self.info
@ -55,9 +57,6 @@ class WindowsInfoCollector(InfoCollector):
LOG.debug('finished get_wmi_info') LOG.debug('finished get_wmi_info')
def get_mimikatz_info(self): def get_mimikatz_info(self):
from infection_monkey.config import WormConfiguration
if not WormConfiguration.should_use_mimikatz:
return
mimikatz_collector = MimikatzCollector() mimikatz_collector = MimikatzCollector()
mimikatz_info = mimikatz_collector.get_logon_info() mimikatz_info = mimikatz_collector.get_logon_info()
if mimikatz_info: if mimikatz_info: