From dbc395819fd252290ee946554a1b6faeeb9cc920 Mon Sep 17 00:00:00 2001 From: Siddharth Dushantha Date: Sat, 1 Oct 2022 15:32:34 +0200 Subject: [PATCH 1/2] added function to exit gracefully This prevents Sherlock from throwing a lot of errors onto the terminal --- sherlock/sherlock.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index acc59dc..79da57f 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -8,6 +8,7 @@ networks. """ import csv +import signal import pandas as pd import os import platform @@ -195,7 +196,6 @@ def sherlock(username, site_data, query_notify, # Notify caller that we are starting the query. query_notify.start(username) - print() # Create session based on request methodology if tor or unique_tor: # Requests using Tor obfuscation @@ -475,6 +475,14 @@ def timeout_check(value): return timeout +def handler(signal_received, frame): + """Exit gracefully without throwing errors + + Source: https://www.devdungeon.com/content/python-catch-sigint-ctrl-c + """ + sys.exit(0) + + def main(): version_string = f"%(prog)s {__version__}\n" + \ f"{requests.__description__}: {requests.__version__}\n" + \ @@ -557,7 +565,10 @@ def main(): help="Force the use of the local data.json file.") args = parser.parse_args() - + + # If the user presses CTRL-C, exit gracefully without throwing errors + signal.signal(signal.SIGINT, handler) + # Check for newer version of Sherlock. If it exists, let the user know about it try: r = requests.get( From 1ffcaa53a3ee42ea49a751a0059593659cebac9b Mon Sep 17 00:00:00 2001 From: Siddharth Dushantha Date: Sat, 1 Oct 2022 15:34:09 +0200 Subject: [PATCH 2/2] version bump 0.14.0 --> 0.14.1 --- sherlock/sherlock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 79da57f..e0d8546 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -28,7 +28,7 @@ from sites import SitesInformation from colorama import init module_name = "Sherlock: Find Usernames Across Social Networks" -__version__ = "0.14.0" +__version__ = "0.14.1" class SherlockFuturesSession(FuturesSession):