Merge pull request #644 from acepace/bugfix/remove_wmi_requirement_from_non_windows

Bugfix/remove wmi requirement from non windows
This commit is contained in:
Shay Nehmad 2020-05-11 16:56:12 +03:00 committed by GitHub
commit c7004123c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 29 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,8 +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
pywin32 ; sys_platform == 'win32'
wmi==1.4.9 ; sys_platform == 'win32'
pymssql<3.0
pyftpdlib
WinSys-3.x