Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed support for tor #2200

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ PySocks = "^1.7.0"
requests = "^2.22.0"
requests-futures = "^1.0.0"
stem = "^1.8.0"
torrequest = "^0.1.0"
# pandas can likely be bumped up to ^2.0.0 after fc39 EOL
pandas = ">=1.0.0,<3.0.0"
openpyxl = "^3.0.10"
Expand Down
55 changes: 2 additions & 53 deletions sherlock/sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
)

from requests_futures.sessions import FuturesSession # noqa: E402
from torrequest import TorRequest # noqa: E402
from sherlock.result import QueryStatus # noqa: E402
from sherlock.result import QueryResult # noqa: E402
from sherlock.notify import QueryNotify # noqa: E402
Expand Down Expand Up @@ -166,8 +165,6 @@ def sherlock(
username,
site_data,
query_notify: QueryNotify,
tor: bool = False,
unique_tor: bool = False,
proxy=None,
timeout=60,
):
Expand All @@ -182,8 +179,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.
Expand All @@ -204,20 +199,9 @@ 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()

# Limit number of workers to 20.
# This is probably vastly overkill.
Expand Down Expand Up @@ -341,15 +325,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)
Expand Down Expand Up @@ -548,22 +527,6 @@ def main():
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",
Expand Down Expand Up @@ -687,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)
Expand Down Expand Up @@ -781,8 +732,6 @@ def main():
username,
site_data,
query_notify,
tor=args.tor,
unique_tor=args.unique_tor,
proxy=args.proxy,
timeout=args.timeout,
)
Expand Down
Loading