Skip to content

Commit 7379ba7

Browse files
committed
Merge branch 'remove-tor'
2 parents 3aeb6d6 + 2016892 commit 7379ba7

File tree

2 files changed

+2
-68
lines changed

2 files changed

+2
-68
lines changed

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@ PySocks = "^1.7.0"
4646
requests = "^2.22.0"
4747
requests-futures = "^1.0.0"
4848
stem = "^1.8.0"
49-
torrequest = "^0.1.0"
5049
pandas = "^2.2.1"
5150
openpyxl = "^3.0.10"
5251
tomli = "^2.2.1"
5352

54-
[tool.poetry.extras]
55-
tor = ["torrequest"]
56-
5753
[tool.poetry.group.dev.dependencies]
5854
jsonschema = "^4.0.0"
5955
rstr = "^3.2.2"

sherlock_project/sherlock.py

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ def sherlock(
171171
username: str,
172172
site_data: dict[str, dict[str, str]],
173173
query_notify: QueryNotify,
174-
tor: bool = False,
175-
unique_tor: bool = False,
176174
dump_response: bool = False,
177175
proxy: Optional[str] = None,
178176
timeout: int = 60,
@@ -188,8 +186,6 @@ def sherlock(
188186
query_notify -- Object with base type of QueryNotify().
189187
This will be used to notify the caller about
190188
query results.
191-
tor -- Boolean indicating whether to use a tor circuit for the requests.
192-
unique_tor -- Boolean indicating whether to use a new tor circuit for each request.
193189
proxy -- String indicating the proxy URL
194190
timeout -- Time in seconds to wait before timing out request.
195191
Default is 60 seconds.
@@ -210,32 +206,9 @@ def sherlock(
210206

211207
# Notify caller that we are starting the query.
212208
query_notify.start(username)
213-
# Create session based on request methodology
214-
if tor or unique_tor:
215-
try:
216-
from torrequest import TorRequest # noqa: E402
217-
except ImportError:
218-
print("Important!")
219-
print("> --tor and --unique-tor are now DEPRECATED, and may be removed in a future release of Sherlock.")
220-
print("> If you've installed Sherlock via pip, you can include the optional dependency via `pip install 'sherlock-project[tor]'`.")
221-
print("> Other packages should refer to their documentation, or install it separately with `pip install torrequest`.\n")
222-
sys.exit(query_notify.finish())
223-
224-
print("Important!")
225-
print("> --tor and --unique-tor are now DEPRECATED, and may be removed in a future release of Sherlock.")
226-
227-
# Requests using Tor obfuscation
228-
try:
229-
underlying_request = TorRequest()
230-
except OSError:
231-
print("Tor not found in system path. Unable to continue.\n")
232-
sys.exit(query_notify.finish())
233209

234-
underlying_session = underlying_request.session
235-
else:
236-
# Normal requests
237-
underlying_session = requests.session()
238-
underlying_request = requests.Request()
210+
# Normal requests
211+
underlying_session = requests.session()
239212

240213
# Limit number of workers to 20.
241214
# This is probably vastly overkill.
@@ -359,15 +332,10 @@ def sherlock(
359332
# Store future in data for access later
360333
net_info["request_future"] = future
361334

362-
# Reset identify for tor (if needed)
363-
if unique_tor:
364-
underlying_request.reset_identity()
365-
366335
# Add this site's results into final dictionary with all the other results.
367336
results_total[social_network] = results_site
368337

369338
# Open the file containing account links
370-
# Core logic: If tor requests, make them here. If multi-threaded requests, wait for responses
371339
for social_network, net_info in site_data.items():
372340
# Retrieve results again
373341
results_site = results_total.get(social_network)
@@ -600,22 +568,6 @@ def main():
600568
dest="output",
601569
help="If using single username, the output of the result will be saved to this file.",
602570
)
603-
parser.add_argument(
604-
"--tor",
605-
"-t",
606-
action="store_true",
607-
dest="tor",
608-
default=False,
609-
help="Make requests over Tor; increases runtime; requires Tor to be installed and in system path.",
610-
)
611-
parser.add_argument(
612-
"--unique-tor",
613-
"-u",
614-
action="store_true",
615-
dest="unique_tor",
616-
default=False,
617-
help="Make requests over Tor with new Tor circuit after each request; increases runtime; requires Tor to be installed and in system path.",
618-
)
619571
parser.add_argument(
620572
"--csv",
621573
action="store_true",
@@ -769,22 +721,10 @@ def main():
769721
except Exception as error:
770722
print(f"A problem occurred while checking for an update: {error}")
771723

772-
# Argument check
773-
# TODO regex check on args.proxy
774-
if args.tor and (args.proxy is not None):
775-
raise Exception("Tor and Proxy cannot be set at the same time.")
776-
777724
# Make prompts
778725
if args.proxy is not None:
779726
print("Using the proxy: " + args.proxy)
780727

781-
if args.tor or args.unique_tor:
782-
print("Using Tor to make requests")
783-
784-
print(
785-
"Warning: some websites might refuse connecting over Tor, so note that using this option might increase connection errors."
786-
)
787-
788728
if args.no_color:
789729
# Disable color output.
790730
init(strip=True, convert=False)
@@ -885,8 +825,6 @@ def main():
885825
username,
886826
site_data,
887827
query_notify,
888-
tor=args.tor,
889-
unique_tor=args.unique_tor,
890828
dump_response=args.dump_response,
891829
proxy=args.proxy,
892830
timeout=args.timeout,

0 commit comments

Comments
 (0)