diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..753dfef7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Jupyter Notebook +.ipynb_checkpoints +*.ipynb diff --git a/README.md b/README.md index 6158cd13..467aabb6 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ $ pip3 install -r requirements.txt ## Usage Just run ```python3 sherlock.py``` -All of the accounts found will be stored in a text file with their usename (e.g ```user123.txt```) +All of the accounts found will be stored in a text file with their username (e.g ```user123.txt```) ## License diff --git a/data.json b/data.json index c64ebd02..426f8c1f 100644 --- a/data.json +++ b/data.json @@ -11,8 +11,7 @@ }, "Facebook": { "url": "https://www.facebook.com/{}", - "errorType": "message", - "errorMsg": "not found" + "errorType": "status_code" }, "YouTube": { "url": "https://www.youtube.com/{}", @@ -21,7 +20,8 @@ }, "Blogger": { "url": "https://{}.blogspot.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "Google Plus": { "url": "https://plus.google.com/+{}", @@ -35,12 +35,12 @@ "Pinterest": { "url": "https://www.pinterest.com/{}", "errorType": "response_url", - "errorMsgInUrl": "?show_error" + "errorUrl": "https://www.pinterest.com/?show_error=true" }, "GitHub": { "url": "https://www.github.com/{}", - "errorType": "message", - "errorMsg": "404 Not Found" + "errorType": "status_code", + "noPeriod": "True" }, "Steam": { "url": "https://steamcommunity.com/id/{}", @@ -54,18 +54,11 @@ }, "SoundCloud": { "url": "https://soundcloud.com/{}", - "errorType": "message", - "errorMsg": "404 Not Found" - }, - "Tumblr": { - "url": "https://{}.tumblr.com", - "errorType": "message", - "errorMsg": " There's nothing here" + "errorType": "status_code" }, "Disqus": { "url": "https://disqus.com/{}", - "errorType": "message", - "errorMsg": "404 NOT FOUND" + "errorType": "status_code" }, "Medium": { "url": "https://medium.com/@{}", @@ -73,7 +66,8 @@ }, "DeviantART": { "url": "https://{}.deviantart.com", - "errorType": "status_code" + "errorType": "status_code", + "noPeriod": "True" }, "VK": { "url": "https://vk.com/{}", @@ -89,7 +83,8 @@ }, "Flipboard": { "url": "https://flipboard.com/@{}", - "errorType": "status_code" + "errorType": "message", + "errorMsg": "loading" }, "SlideShare": { "url": "https://slideshare.net/{}", @@ -128,13 +123,12 @@ }, "Gravatar": { "url": "http://en.gravatar.com/{}", - "errorType": "message", - "errorMsg": "We’re sorry, we couldn't find that profile" + "errorType": "status_code" }, "iMGSRC.RU": { "url": "https://imgsrc.ru/main/user.php?user={}", - "errorType": "message", - "errorMsg": "Rapidly growing community of over a million users, dedicated to sharing." + "errorType": "response_url", + "errorUrl": "https://imgsrc.ru/" }, "DailyMotion": { "url": "https://www.dailymotion.com/{}", @@ -147,8 +141,7 @@ }, "CashMe": { "url": "https://cash.me/{}", - "errorType": "message", - "errorMsg": "Oh no" + "errorType": "status_code" }, "Behance": { "url": "https://www.behance.net/{}", @@ -157,8 +150,7 @@ }, "GoodReads": { "url": "https://www.goodreads.com/{}", - "errorType": "message", - "errorMsg": "Sorry you lost your way." + "errorType": "status_code" }, "Instructables": { "url": "https://www.instructables.com/member/{}", @@ -167,23 +159,23 @@ }, "Keybase": { "url": "https://keybase.io/{}", - "errorType": "message", - "errorMsg": "Sorry, what you are looking for...it does not exist." + "errorType": "status_code" }, "Kongregate": { "url": "https://www.kongregate.com/accounts/{}", "errorType": "message", - "errorMsg": "Sorry, no account with that name was found." + "errorMsg": "Sorry, no account with that name was found.", + "noPeriod": "True" }, "LiveJournal": { "url": "https://{}.livejournal.com", "errorType": "message", - "errorMsg": "Unknown Journal" + "errorMsg": "Unknown Journal", + "noPeriod": "True" }, "VSCO": { "url": "https://vsco.co/{}", - "errorType": "message", - "errorMsg": "This page does not exist" + "errorType": "status_code" }, "AngelList": { "url": "https://angel.co/{}", @@ -198,7 +190,8 @@ "Dribbble": { "url": "https://dribbble.com/{}", "errorType": "message", - "errorMsg": "Whoops, that page is gone." + "errorMsg": "Whoops, that page is gone.", + "noPeriod": "True" }, "Codecademy": { "url": "https://www.codecademy.com/{}", @@ -208,12 +201,11 @@ "Pastebin": { "url": "https://pastebin.com/u/{}", "errorType": "response_url", - "errorMsgInUrl": "index" + "errorUrl": "https://pastebin.com/index" }, "Foursquare": { "url": "https://foursquare.com/{}", - "errorType": "message", - "errorMsg": "We couldn't find the page you're looking for." + "errorType": "status_code" }, "Gumroad": { "url": "https://www.gumroad.com/{}", @@ -222,8 +214,8 @@ }, "Newgrounds": { "url": "https://{}.newgrounds.com", - "errorType": "message", - "errorMsg": "ERROR — No user" + "errorType": "status_code", + "noPeriod": "True" }, "Wattpad": { "url": "https://www.wattpad.com/user/{}", @@ -258,12 +250,8 @@ "Contently": { "url": "https://{}.contently.com/", "errorType": "message", - "errorMsg": "We can't find that page!" - }, - "Houzz": { - "url": "https://houzz.com/user/{}", - "errorType": "message", - "errorMsg": "The page you requested was not found." + "errorMsg": "We can't find that page!", + "noPeriod": "True" }, "Houzz": { "url": "https://houzz.com/user/{}", @@ -273,7 +261,7 @@ "BLIP.fm": { "url": "https://blip.fm/{}", "errorType": "message", - "errorMsg": "404 Page Not Found" + "errorMsg": "Page Not Found" }, "HackerNews": { "url": "https://news.ycombinator.com/user?id={}", @@ -317,8 +305,8 @@ }, "Slack": { "url": "https://{}.slack.com", - "errorType": "message", - "errorMsg": "There’s been a glitch…" + "errorType": "status_code", + "noPeriod": "True" }, "Trip": { "url": "https://www.trip.skyscanner.com/user/{}", @@ -347,18 +335,17 @@ }, "Flickr": { "url": "https://www.flickr.com/people/{}", - "errorType": "message", - "errorMsg": "This is not the page you’re looking for" + "errorType": "status_code" }, "WordPress": { "url": "https://{}.wordpress.com", - "errorType": "message", - "errorMsg": "Do you want to register" + "errorType": "response_url", + "errorUrl": "wordpress.com/typo/?subdomain=", + "noPeriod": "True" }, "Unsplash": { "url": "https://unsplash.com/@{}", - "errorType": "message", - "errorMsg": "Hm, the page you were looking for doesn't seem to exist anymore" + "errorType": "status_code" }, "Pexels": { "url": "https://www.pexels.com/@{}", diff --git a/sherlock.py b/sherlock.py index 2dbe6415..15770213 100644 --- a/sherlock.py +++ b/sherlock.py @@ -6,6 +6,8 @@ import argparse DEBUG = False +# TODO: fix tumblr + def write_to_file(url, fname): with open(fname, "a") as f: f.write(url+"\n") @@ -39,8 +41,8 @@ def make_request(url, headers, error_type, social_network): def sherlock(username): # Not sure why, but the banner messes up if i put into one print function - print(" .\"\"\"-.") - print(" / \\") + print("\033[37;1m .\"\"\"-.") + print("\033[37;1m / \\") print("\033[37;1m ____ _ _ _ | _..--'-.") print("\033[37;1m/ ___|| |__ ___ _ __| | ___ ___| |__ >.`__.-\"\"\;\"`") print("\033[37;1m\___ \| '_ \ / _ \ '__| |/ _ \ / __| |/ / / /( ^\\") @@ -58,7 +60,7 @@ def sherlock(username): print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Removing previous file:\033[1;37m {}\033[0m".format(fname)) print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Checking username\033[0m\033[1;37m {}\033[0m\033[1;92m on: \033[0m".format(username)) - raw = open("data.json", "r") + raw = open("data.json", "r", encoding="utf-8") data = json.load(raw) # User agent is needed because some sites does not @@ -71,12 +73,17 @@ def sherlock(username): for social_network in data: url = data.get(social_network).get("url").format(username) error_type = data.get(social_network).get("errorType") + cant_have_period = data.get(social_network).get("noPeriod") + if cant_have_period == "True": + print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Not Found!".format(social_network)) + continue + r, error_type = make_request(url=url, headers=headers, error_type=error_type, social_network=social_network) if error_type == "message": error = data.get(social_network).get("errorMsg") - + # Checks if the error message is in the HTML if not error in r.text: print("\033[37;1m[\033[92;1m+\033[37;1m]\033[92;1m {}:\033[0m".format(social_network), url) write_to_file(url, fname) @@ -85,7 +92,7 @@ def sherlock(username): print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Not Found!".format(social_network)) elif error_type == "status_code": - + # Checks if the status code of the repsonse is 404 if not r.status_code == 404: print("\033[37;1m[\033[92;1m+\033[37;1m]\033[92;1m {}:\033[0m".format(social_network), url) write_to_file(url, fname) @@ -94,8 +101,8 @@ def sherlock(username): print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Not Found!".format(social_network)) elif error_type == "response_url": - error = data.get(social_network).get("errorMsgInUrl") - + error = data.get(social_network).get("errorUrl") + # Checks if the redirect url is the same as the one defined in data.json if not error in r.url: print("\033[37;1m[\033[92;1m+\033[37;1m]\033[92;1m {}:\033[0m".format(social_network), url) write_to_file(url, fname) @@ -107,7 +114,6 @@ def sherlock(username): print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Saved: \033[37;1m{}\033[0m".format(username+".txt")) - class ArgumentParserError(Exception): pass class ArgumentParser(argparse.ArgumentParser):