Skip to content

Commit

Permalink
new image, did some PEP8, and organized the code
Browse files Browse the repository at this point in the history
  • Loading branch information
sdushantha committed Dec 28, 2018
1 parent dff6e87 commit 6fcc62f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
> Find usernames across over 75 social networks
<p align="center">
<img src="sherlock_preview.png">
<img src="preview.png">
</a>
</p>

Expand Down
Binary file added preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 17 additions & 8 deletions sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import os
import sys
import re
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import platform


module_name = "Sherlock: Find Usernames Across Social Networks"
__version__ = "0.1.0"
Expand All @@ -19,11 +22,13 @@ def write_to_file(url, fname):
with open(fname, "a") as f:
f.write(url+"\n")


def print_error(err, errstr, var, debug = False):
if debug:
print (f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {err}")
print(f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {err}")
else:
print (f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {var}")
print(f"\033[37;1m[\033[91;1m-\033[37;1m]\033[91;1m {errstr}\033[93;1m {var}")


def make_request(url, headers, error_type, social_network, verbose=False):
try:
Expand All @@ -40,6 +45,7 @@ def make_request(url, headers, error_type, social_network, verbose=False):
print_error(err, "Unknown error:", social_network, verbose)
return None, ""


def sherlock(username, verbose=False):
fname = username+".txt"

Expand All @@ -65,7 +71,7 @@ def sherlock(username, verbose=False):

if regex_check and re.search(regex_check, username) is None:
#No need to do the check at the site: this user name is not allowed.
print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Illegal User Name Format For This Site!".format(social_network))
print("\033[37;1m[\033[91;1m-\033[37;1m]\033[92;1m {}:\033[93;1m Illegal Username Format For This Site!".format(social_network))
continue

r, error_type = make_request(url=url, headers=headers, error_type=error_type, social_network=social_network, verbose=verbose)
Expand Down Expand Up @@ -105,10 +111,8 @@ def sherlock(username, verbose=False):

return

if __name__ == "__main__":
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import platform

def main():
version_string = f"%(prog)s {__version__}\n" + \
f"{requests.__description__}: {requests.__version__}\n" + \
f"Python: {platform.python_version()}"
Expand Down Expand Up @@ -136,7 +140,7 @@ def sherlock(username, verbose=False):

args = parser.parse_args()

#Banner
# Banner
print(
"""\033[37;1m .\"\"\"-.
\033[37;1m / \\
Expand All @@ -148,7 +152,12 @@ def sherlock(username, verbose=False):
\033[37;1m .'`-._ `.\ | J /
\033[37;1m / `--.| \__/\033[0m""")

#Run report on all specified users.
# Run report on all specified users.
for username in args.username:
print()
sherlock(username, verbose=args.verbose)



if __name__ == "__main__":
main()
Binary file removed sherlock_preview.png
Binary file not shown.

0 comments on commit 6fcc62f

Please sign in to comment.