diff --git a/Python/MiktoList.py b/Python/MiktoList.py index 133824da..b901f5c2 100755 --- a/Python/MiktoList.py +++ b/Python/MiktoList.py @@ -5,10 +5,9 @@ import sys import webbrowser -from distutils.util import strtobool +from modules.helpers import strtobool from modules.db_manager import DB_Manager - def open_file_input(cli_parsed): files = glob.glob(os.path.join(cli_parsed.d, 'report.html')) if len(files) > 0: diff --git a/Python/Recategorize.py b/Python/Recategorize.py index 674771d1..94ec4cd5 100755 --- a/Python/Recategorize.py +++ b/Python/Recategorize.py @@ -5,7 +5,7 @@ import sys import webbrowser -from distutils.util import strtobool +from modules.helpers import strtobool from modules.db_manager import DB_Manager from modules.reporting import sort_data_and_write diff --git a/Python/Search.py b/Python/Search.py index 30f14cfc..0c836e2e 100755 --- a/Python/Search.py +++ b/Python/Search.py @@ -5,7 +5,7 @@ import sys import webbrowser -from distutils.util import strtobool +from modules.helpers import strtobool from modules.db_manager import DB_Manager from modules.reporting import search_report diff --git a/Python/modules/helpers.py b/Python/modules/helpers.py index c67cf35c..d681058c 100644 --- a/Python/modules/helpers.py +++ b/Python/modules/helpers.py @@ -7,7 +7,6 @@ import sys import time import xml.sax -from distutils.util import strtobool import glob import socket from netaddr import IPAddress @@ -836,6 +835,23 @@ def open_file_input(cli_parsed): print('[*] No report files found to open, perhaps no hosts were successful') return False + +def strtobool(value, raise_exc=False): + + str2b_true = {'yes', 'true', 't', 'y', '1'} + str2b_false = {'no', 'false', 'f', 'n', '0'} + + if isinstance(value, str) or sys.version_info[0] < 3 and isinstance(value, basestring): + value = value.lower() + if value in str2b_true: + return True + if value in str2b_false: + return False + + if raise_exc: + raise ValueError('Expected "%s"' % '", "'.join(str2b_true | str2b_false)) + return None + def class_info(): class_image = '''MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM M M