Remove reg_utils, unused file.

Moved WMI imports to be gated behind win32 check.
Set wmi package to be installed only on win32 platform.

The mongo_utils and wmi_utils modules are only imported by the windows_info_collector which is only imported if we're on windows.
This commit is contained in:
Ace Pace 2020-05-11 14:34:04 +03:00
parent 735aac9c0d
commit 1f11173545
3 changed files with 5 additions and 28 deletions

View File

@ -1,5 +1,7 @@
import wmi
import sys
if sys.platform == 'win32':
import win32com
import wmi
__author__ = 'maor.rayzin'

View File

@ -1,25 +0,0 @@
import winreg
from common.utils.mongo_utils import MongoUtils
__author__ = 'maor.rayzin'
class RegUtils:
def __init__(self):
# Static class
pass
@staticmethod
def get_reg_key(subkey_path, store=winreg.HKEY_LOCAL_MACHINE):
key = winreg.ConnectRegistry(None, store)
subkey = winreg.OpenKey(key, subkey_path)
d = dict([winreg.EnumValue(subkey, i)[:2] for i in range(winreg.QueryInfoKey(subkey)[0])])
d = MongoUtils.fix_obj_for_mongo(d)
subkey.Close()
key.Close()
return d

View File

@ -13,7 +13,7 @@ ipaddress
# See breaking change here: https://github.com/tjguk/wmi/commit/dcf8e3eca79bb8c0101ffb83e25c066b0ba9e16d
# Causes pip to error with:
# Could not find a version that satisfies the requirement pywin32 (from wmi->-r /src/infection_monkey/requirements.txt (line 12)) (from versions: none)
wmi==1.4.9
wmi==1.4.9 ; sys_platform == 'win32'
pymssql<3.0
pyftpdlib
WinSys-3.x