guardicore / monkey

Infection Monkey - An open-source adversary emulation platform
https://www.guardicore.com/infectionmonkey/
GNU General Public License v3.0
6.62k stars 772 forks source link

Windows info collector fails #1030

Closed VakarisZ closed 3 years ago

VakarisZ commented 3 years ago

Describe the bug

On windows server 2019 this bug appears when running with the default configuration:

2021-03-09 15:57:08,717 [5436:4992:INFO] windows_info_collector.get_installed_packages.54: getting installed packages
2021-03-09 15:57:10,164 [5436:4992:ERROR] main.main.137: Exception thrown from monkey's start function. More info: 'charmap' codec can't decode byte 0x81 in position 28: character maps to <undefined>
Traceback (most recent call last):
  File "monkey\infection_monkey\main.py", line 128, in main
  File "monkey\infection_monkey\monkey.py", line 142, in start
  File "monkey\infection_monkey\monkey.py", line 247, in collect_system_info_if_configured
  File "monkey\infection_monkey\system_info\__init__.py", line 46, in get_info
  File "monkey\infection_monkey\system_info\windows_info_collector.py", line 46, in get_info
  File "monkey\infection_monkey\system_info\windows_info_collector.py", line 55, in get_installed_packages
  File "c:\monkey_env\infectionmonkey64\lib\encodings\cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 28: character maps to <undefined>
2021-03-09 15:57:10,165 [5436:4992:INFO] monkey.cleanup.263: Monkey cleanup started

To Reproduce

Steps to reproduce the behavior:

  1. Install island 1.9 in windows server 2019
  2. Run the monkey
  3. See an error

Expected behavior

  1. Info collector shouldn't fail because of installed packages error (this info is irrelevant either way)
  2. Error shouldn't happen

Machine version (please complete the following information):

VakarisZ commented 3 years ago

Duplicate of #798

h8h commented 3 years ago

I got the PingScanner

2021-05-20 16:39:52,198 [852:8704:DEBUG] mysqlfinger.get_host_fingerprint.70: Error getting mysql fingerprint: timed out
2021-05-20 16:39:52,202 [852:8704:INFO] monkey.start.168: Trying to get OS fingerprint from VictimHost('10.10.10.100') with module PingScanner
Exception in thread Thread-20:
Traceback (most recent call last):
  File "threading.py", line 926, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "subprocess.py", line 1267, in _readerthread
  File "c:\monkey_env\infectionmonkey64\lib\encodings\cp1252.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 18: character maps to <undefined>
2021-05-20 16:39:52,250 [852:8704:ERROR] main.main.137: Exception thrown from monkey's start function. More info: not enough arguments for format string

Traceback (most recent call last):
  File "infection_monkey\monkey.py", line 170, in start
    finger.get_host_fingerprint(machine)

  File "infection_monkey\network\ping_scanner.py", line 56, in get_host_fingerprint
    output = " ".join(sub_proc.communicate())
  File "subprocess.py", line 964, in communicate
  File "subprocess.py", line 1317, in _communicate

IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "infection_monkey\main.py", line 128, in main
    monkey.start()
  File "infection_monkey\monkey.py", line 172, in start
    LOG.error("Failed to run fingerprinter %s, exception %s" % finger.__class__.__name__,
TypeError: not enough arguments for format string

Infection Monkey Version: 1.10.0+3593 Microsoft Windows 10 Pro 10.0.18363

VakarisZ commented 3 years ago

@h8h this looks like #1175