|
|
|
@ -112,7 +112,7 @@ def get_response(request_future, error_type, social_network, verbose=False):
|
|
|
|
|
return None, "", -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False):
|
|
|
|
|
def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False, proxy=None):
|
|
|
|
|
"""Run Sherlock Analysis.
|
|
|
|
|
|
|
|
|
|
Checks for existence of username on various social media sites.
|
|
|
|
@ -124,6 +124,7 @@ def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False):
|
|
|
|
|
verbose -- Boolean indicating whether to give verbose output.
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
|
Dictionary containing results from report. Key of dictionary is the name
|
|
|
|
@ -168,10 +169,11 @@ def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False):
|
|
|
|
|
underlying_request = requests.Request()
|
|
|
|
|
if tor or unique_tor:
|
|
|
|
|
underlying_request = TorRequest()
|
|
|
|
|
underlying_session = underlying_request.session()
|
|
|
|
|
underlying_session = underlying_request.session
|
|
|
|
|
|
|
|
|
|
# Create multi-threaded session for all requests. Use our custom FuturesSession that exposes response time
|
|
|
|
|
session = ElapsedFuturesSession(executor=executor, session=underlying_session)
|
|
|
|
|
session = ElapsedFuturesSession(
|
|
|
|
|
executor=executor, session=underlying_session)
|
|
|
|
|
|
|
|
|
|
# Results from analysis of all sites
|
|
|
|
|
results_total = {}
|
|
|
|
@ -207,6 +209,11 @@ def sherlock(username, site_data, verbose=False, tor=False, unique_tor=False):
|
|
|
|
|
request_method = session.head
|
|
|
|
|
|
|
|
|
|
# This future starts running the request in a new thread, doesn't block the main thread
|
|
|
|
|
if proxy != None:
|
|
|
|
|
proxies = {"http": proxy, "https": proxy}
|
|
|
|
|
future = request_method(
|
|
|
|
|
url=url, headers=headers, proxies=proxies)
|
|
|
|
|
else:
|
|
|
|
|
future = request_method(url=url, headers=headers)
|
|
|
|
|
|
|
|
|
|
# Store future in data for access later
|
|
|
|
@ -360,6 +367,10 @@ def main():
|
|
|
|
|
dest="site_list", default=None,
|
|
|
|
|
help="Limit analysis to just the listed sites. Add multiple options to specify more than one site."
|
|
|
|
|
)
|
|
|
|
|
parser.add_argument("--proxy", "-p", metavar='PROXY_URL',
|
|
|
|
|
action="store", dest="proxy", default=None,
|
|
|
|
|
help="Make requests over a proxy. e.g. socks5://127.0.0.1:1080"
|
|
|
|
|
)
|
|
|
|
|
parser.add_argument("username",
|
|
|
|
|
nargs='+', metavar='USERNAMES',
|
|
|
|
|
action="store",
|
|
|
|
@ -380,11 +391,21 @@ def main():
|
|
|
|
|
.'`-._ `.\ | J /
|
|
|
|
|
/ `--.| \__/""")
|
|
|
|
|
|
|
|
|
|
# Argument check
|
|
|
|
|
# TODO regex check on args.proxy
|
|
|
|
|
if args.tor and args.proxy != None:
|
|
|
|
|
raise Exception("TOR and Proxy cannot be set in the meantime.")
|
|
|
|
|
|
|
|
|
|
# Make prompts
|
|
|
|
|
if args.proxy != 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.")
|
|
|
|
|
|
|
|
|
|
# Load the data
|
|
|
|
|
data_file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data.json")
|
|
|
|
|
data_file_path = os.path.join(os.path.dirname(
|
|
|
|
|
os.path.realpath(__file__)), "data.json")
|
|
|
|
|
with open(data_file_path, "r", encoding="utf-8") as raw:
|
|
|
|
|
site_data_all = json.load(raw)
|
|
|
|
|
|
|
|
|
@ -406,13 +427,16 @@ def main():
|
|
|
|
|
site_missing.append(f"'{site}'")
|
|
|
|
|
|
|
|
|
|
if site_missing:
|
|
|
|
|
print(f"Error: Desired sites not found: {', '.join(site_missing)}.")
|
|
|
|
|
print(
|
|
|
|
|
f"Error: Desired sites not found: {', '.join(site_missing)}.")
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
# Run report on all specified users.
|
|
|
|
|
for username in args.username:
|
|
|
|
|
print()
|
|
|
|
|
results = sherlock(username, site_data, verbose=args.verbose, tor=args.tor, unique_tor=args.unique_tor)
|
|
|
|
|
results = {}
|
|
|
|
|
results = sherlock(username, site_data, verbose=args.verbose,
|
|
|
|
|
tor=args.tor, unique_tor=args.unique_tor, proxy=args.proxy)
|
|
|
|
|
|
|
|
|
|
if args.csv == True:
|
|
|
|
|
with open(username + ".csv", "w", newline='', encoding="utf-8") as csv_report:
|
|
|
|
|