Agent: Do not run pypykatz if the OS is not Windows

This commit is contained in:
Mike Salvatore 2022-02-16 14:22:44 -05:00
parent 419aa6fd84
commit bf27a8c8ea
1 changed files with 9 additions and 0 deletions

View File

@ -1,10 +1,15 @@
import binascii
import logging
from typing import Any, Dict, List, NewType
from pypykatz.pypykatz import pypykatz
from infection_monkey.utils.environment import is_windows_os
from .windows_credentials import WindowsCredentials
logger = logging.getLogger(__name__)
CREDENTIAL_TYPES = [
"msv_creds",
"wdigest_creds",
@ -19,6 +24,10 @@ PypykatzCredential = NewType("PypykatzCredential", Dict)
def get_windows_creds() -> List[WindowsCredentials]:
if not is_windows_os():
logger.debug("Skipping pypykatz because the operating system is not Windows")
return []
pypy_handle = pypykatz.go_live()
logon_data = pypy_handle.to_dict()
windows_creds = _parse_pypykatz_results(logon_data)