From 35674286cfa5073edcd70e293b83dd89e1a18380 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 28 Jul 2019 13:41:14 +0300 Subject: [PATCH] Manual fixes after 2to3 --- monkey/common/utils/mongo_utils.py | 2 +- monkey/infection_monkey/network/info.py | 5 ----- monkey/monkey_island/cc/main.py | 2 -- monkey/monkey_island/cc/services/wmi_handler.py | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/monkey/common/utils/mongo_utils.py b/monkey/common/utils/mongo_utils.py index cc5bea7d1..48d632bcd 100644 --- a/monkey/common/utils/mongo_utils.py +++ b/monkey/common/utils/mongo_utils.py @@ -21,7 +21,7 @@ class MongoUtils: elif type(o) in (int, float, bool): return o - elif type(o) in (str, str): + elif isinstance(o, str): # mongo dosn't like unprintable chars, so we use repr :/ return repr(o) diff --git a/monkey/infection_monkey/network/info.py b/monkey/infection_monkey/network/info.py index c1e50586f..fec69ff1f 100644 --- a/monkey/infection_monkey/network/info.py +++ b/monkey/infection_monkey/network/info.py @@ -14,11 +14,6 @@ from requests import ConnectionError from common.network.network_range import CidrRange -try: - int # Python 2 -except NameError: - long = int # Python 3 - # Timeout for monkey connections TIMEOUT = 15 diff --git a/monkey/monkey_island/cc/main.py b/monkey/monkey_island/cc/main.py index e51975d24..d23d57411 100644 --- a/monkey/monkey_island/cc/main.py +++ b/monkey/monkey_island/cc/main.py @@ -1,5 +1,3 @@ - # In python 2.7 - import os import os.path import sys diff --git a/monkey/monkey_island/cc/services/wmi_handler.py b/monkey/monkey_island/cc/services/wmi_handler.py index 82209701f..2522b42dd 100644 --- a/monkey/monkey_island/cc/services/wmi_handler.py +++ b/monkey/monkey_island/cc/services/wmi_handler.py @@ -95,7 +95,7 @@ class WMIHandler(object): groups_entities_list = self.info_for_mongo[group_sid]['entities_list'] child_sid = '' - if type(child_part) in (str, str): + if isinstance(child_part, str): child_part = str(child_part) name = None domain_name = None