new image, did some PEP8, and organized the code

This commit is contained in:
Siddharth Dushantha 2018-12-28 20:15:41 +01:00
parent dff6e879b1
commit 6fcc62f500
4 changed files with 18 additions and 9 deletions

View file

@ -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>

BIN
preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View file

@ -8,6 +8,9 @@ import json
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"
@ -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:
@ -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"
@ -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)
@ -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()}"
@ -136,7 +140,7 @@ if __name__ == "__main__":
args = parser.parse_args()
#Banner
# Banner
print(
"""\033[37;1m .\"\"\"-.
\033[37;1m / \\
@ -148,7 +152,12 @@ if __name__ == "__main__":
\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 not shown.

Before

Width:  |  Height:  |  Size: 40 KiB