-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
From 7db6b055eee9446ad629887884af958930e1e576 Mon Sep 17 00:00:00 2001 | ||
From: Paul Pfeister <[email protected]> | ||
Date: Thu, 16 May 2024 02:37:24 -0400 | ||
Subject: [PATCH] Remove tor | ||
|
||
--- | ||
sherlock/sherlock.py | 58 +++----------------------------------------- | ||
tests/base.py | 4 --- | ||
2 files changed, 4 insertions(+), 58 deletions(-) | ||
|
||
diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py | ||
index d487919..da54e02 100644 | ||
--- a/sherlock/sherlock.py | ||
+++ b/sherlock/sherlock.py | ||
@@ -20,7 +20,6 @@ from time import monotonic | ||
import requests | ||
|
||
from requests_futures.sessions import FuturesSession | ||
-from torrequest import TorRequest | ||
from sherlock.result import QueryStatus | ||
from sherlock.result import QueryResult | ||
from sherlock.notify import QueryNotifyPrint | ||
@@ -159,8 +158,6 @@ def sherlock( | ||
username, | ||
site_data, | ||
query_notify, | ||
- tor=False, | ||
- unique_tor=False, | ||
proxy=None, | ||
timeout=60, | ||
): | ||
@@ -175,8 +172,6 @@ def sherlock( | ||
query_notify -- Object with base type of QueryNotify(). | ||
This will be used to notify the caller about | ||
query results. | ||
- tor -- Boolean indicating whether to use a tor circuit for the requests. | ||
- unique_tor -- Boolean indicating whether to use a new tor circuit for each request. | ||
proxy -- String indicating the proxy URL | ||
timeout -- Time in seconds to wait before timing out request. | ||
Default is 60 seconds. | ||
@@ -197,20 +192,10 @@ def sherlock( | ||
|
||
# Notify caller that we are starting the query. | ||
query_notify.start(username) | ||
- # Create session based on request methodology | ||
- if tor or unique_tor: | ||
- # Requests using Tor obfuscation | ||
- try: | ||
- underlying_request = TorRequest() | ||
- except OSError: | ||
- print("Tor not found in system path. Unable to continue.\n") | ||
- sys.exit(query_notify.finish()) | ||
|
||
- underlying_session = underlying_request.session | ||
- else: | ||
- # Normal requests | ||
- underlying_session = requests.session() | ||
- underlying_request = requests.Request() | ||
+ # Normal requests | ||
+ underlying_session = requests.session() | ||
+ underlying_request = requests.Request() | ||
|
||
# Limit number of workers to 20. | ||
# This is probably vastly overkill. | ||
@@ -334,15 +319,10 @@ def sherlock( | ||
# Store future in data for access later | ||
net_info["request_future"] = future | ||
|
||
- # Reset identify for tor (if needed) | ||
- if unique_tor: | ||
- underlying_request.reset_identity() | ||
- | ||
# Add this site's results into final dictionary with all the other results. | ||
results_total[social_network] = results_site | ||
|
||
# Open the file containing account links | ||
- # Core logic: If tor requests, make them here. If multi-threaded requests, wait for responses | ||
for social_network, net_info in site_data.items(): | ||
# Retrieve results again | ||
results_site = results_total.get(social_network) | ||
@@ -546,23 +526,7 @@ def main(): | ||
"-o", | ||
dest="output", | ||
help="If using single username, the output of the result will be saved to this file.", | ||
- ) | ||
- parser.add_argument( | ||
- "--tor", | ||
- "-t", | ||
- action="store_true", | ||
- dest="tor", | ||
- default=False, | ||
- help="Make requests over Tor; increases runtime; requires Tor to be installed and in system path.", | ||
- ) | ||
- parser.add_argument( | ||
- "--unique-tor", | ||
- "-u", | ||
- action="store_true", | ||
- dest="unique_tor", | ||
- default=False, | ||
- help="Make requests over Tor with new Tor circuit after each request; increases runtime; requires Tor to be installed and in system path.", | ||
- ) | ||
+ ), | ||
parser.add_argument( | ||
"--csv", | ||
action="store_true", | ||
@@ -686,22 +650,10 @@ def main(): | ||
except Exception as error: | ||
print(f"A problem occurred while checking for an update: {error}") | ||
|
||
- # Argument check | ||
- # TODO regex check on args.proxy | ||
- if args.tor and (args.proxy is not None): | ||
- raise Exception("Tor and Proxy cannot be set at the same time.") | ||
- | ||
# Make prompts | ||
if args.proxy is not None: | ||
print("Using the proxy: " + args.proxy) | ||
|
||
- if args.tor or args.unique_tor: | ||
- print("Using Tor to make requests") | ||
- | ||
- print( | ||
- "Warning: some websites might refuse connecting over Tor, so note that using this option might increase connection errors." | ||
- ) | ||
- | ||
if args.no_color: | ||
# Disable color output. | ||
init(strip=True, convert=False) | ||
@@ -780,8 +732,6 @@ def main(): | ||
username, | ||
site_data, | ||
query_notify, | ||
- tor=args.tor, | ||
- unique_tor=args.unique_tor, | ||
proxy=args.proxy, | ||
timeout=args.timeout, | ||
) | ||
diff --git a/tests/base.py b/tests/base.py | ||
index 2146b88..bda8099 100644 | ||
--- a/tests/base.py | ||
+++ b/tests/base.py | ||
@@ -51,8 +51,6 @@ class SherlockBaseTest(unittest.TestCase): | ||
# Create notify object for query results. | ||
self.query_notify = QueryNotify() | ||
|
||
- self.tor = False | ||
- self.unique_tor = False | ||
self.timeout = None | ||
self.skip_error_sites = True | ||
|
||
@@ -115,8 +113,6 @@ class SherlockBaseTest(unittest.TestCase): | ||
results = sherlock.sherlock(username, | ||
site_data, | ||
self.query_notify, | ||
- tor=self.tor, | ||
- unique_tor=self.unique_tor, | ||
timeout=self.timeout | ||
) | ||
for site, result in results.items(): | ||
-- | ||
2.45.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Packager: Paul Pfeister <[email protected]> (GitHub @ppfeister) | ||
Name: sherlock-project | ||
Version: 0.14.4 | ||
Release: %autorelease | ||
Summary: Hunt down social media accounts by username across social networks | ||
|
||
#TODO Update URL and Source to upstream | ||
License: MIT | ||
URL: https://github.com/ppfeister/sherlock | ||
Source: %{url}/archive/feature/pyproj.tar.gz | ||
# Switch to new Source URL after adoption of tagged releases | ||
|
||
# Fedora compatibility (upstream dependency change planned) | ||
Patch0: https://raw.githubusercontent.com/ppfeister/pkg/master/sherlock/0001-Remove-tor.patch | ||
|
||
|
||
|
||
|
||
BuildArch: noarch | ||
BuildRequires: python3-devel | ||
BuildRequires: help2man | ||
|
||
%global _description %{expand: | ||
Hunt down social media accounts by username across 400+ social networks and | ||
websites. New targets are tested and implemented regularly. | ||
} | ||
|
||
%description %{_description} | ||
|
||
|
||
#TODO Update autosetup to upstream | ||
%prep | ||
%autosetup -p1 -n sherlock-feature-pyproj | ||
sed -i '/torrequest/d' 'pyproject.toml' # Pending upstream changes with Patch0 | ||
|
||
%generate_buildrequires | ||
%pyproject_buildrequires | ||
|
||
|
||
%build | ||
%pyproject_wheel | ||
|
||
|
||
%install | ||
%pyproject_install | ||
%pyproject_save_files -L sherlock | ||
|
||
sed -r -i '1{/^#!/d}' '%{buildroot}%{python3_sitelib}/sherlock/__main__.py' | ||
sed -r -i '1{/^#!/d}' '%{buildroot}%{python3_sitelib}/sherlock/sherlock.py' | ||
|
||
install -d '%{buildroot}%{_mandir}/man1' | ||
PYTHONPATH='%{buildroot}%{python3_sitelib}' help2man \ | ||
--no-info \ | ||
--version-string='%{version}' \ | ||
--name='%{summary}' \ | ||
--output='%{buildroot}%{_mandir}/man1/sherlock.1' \ | ||
'%{buildroot}%{_bindir}/sherlock' | ||
|
||
|
||
%check | ||
%{py3_test_envvars} %{python3} -m unittest tests.all --verbose | ||
|
||
|
||
%files -f %{pyproject_files} | ||
%license LICENSE | ||
%doc docs/README.md | ||
%{_bindir}/sherlock | ||
%{_mandir}/man1/sherlock.1* | ||
|
||
|
||
%changelog | ||
* Tue May 14 2024 Paul Pfeister <[email protected]> 0.14.4-1 | ||
- Initial package. |