From 68e547b5dad50d0d33786cf680bd1ed211ff5562 Mon Sep 17 00:00:00 2001 From: MoMMde Date: Sat, 26 Mar 2022 13:03:12 +0100 Subject: [PATCH] more refactoring done --- sherlock/__main__.py | 2 +- sherlock/notify.py | 5 ++--- sherlock/sherlock.py | 2 +- sherlock/sites.py | 6 ++---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sherlock/__main__.py b/sherlock/__main__.py index 91140be5..5b98dd26 100644 --- a/sherlock/__main__.py +++ b/sherlock/__main__.py @@ -20,7 +20,7 @@ if __name__ == "__main__": major = sys.version_info[0] minor = sys.version_info[1] - python_version = str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2]) + python_version = major + "." + minor + "." + str(sys.version_info[2]) if major != 3 or major == 3 and minor < 6: print("Sherlock requires Python 3.6+\nYou are using Python %s, which is not supported by Sherlock" % (python_version)) diff --git a/sherlock/notify.py b/sherlock/notify.py index 90ed6811..45c0ed48 100644 --- a/sherlock/notify.py +++ b/sherlock/notify.py @@ -173,9 +173,8 @@ class QueryNotifyPrint(QueryNotify): """ self.result = result - if self.verbose == False or self.result.query_time is None: - response_time_text = "" - else: + response_time_text = "" + if self.verbose == True or self.result.query_time is not None: response_time_text = f" [{round(self.result.query_time * 1000)} ms]" # Output to the terminal is desired. diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 647f0222..7fc9d39c 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -244,7 +244,7 @@ def sherlock(username, site_data, query_notify, request_method = net_info.get("request_method") request_payload = net_info.get("request_payload") request = None - + if request_method is not None: if request_method == "GET": request = session.get diff --git a/sherlock/sites.py b/sherlock/sites.py index de8eeece..76eb3e56 100644 --- a/sherlock/sites.py +++ b/sherlock/sites.py @@ -3,11 +3,8 @@ This module supports storing information about web sites. This is the raw data that will be used to search for usernames. """ -import os import json -import operator import requests -import sys class SiteInformation(): @@ -117,7 +114,8 @@ class SitesInformation(): if not data_file_path.lower().endswith(".json"): raise FileNotFoundError(f"Incorrect JSON file extension for data file '{data_file_path}'.") - if "http://" == data_file_path[:7].lower() or "https://" == data_file_path[:8].lower(): + if data_file_path.lower().startswith("http"): + #if "http://" == data_file_path[:7].lower() or "https://" == data_file_path[:8].lower(): # Reference is to a URL. try: response = requests.get(url=data_file_path)