From 5d972a31387ac88635346af53277eb1c9f56f6d0 Mon Sep 17 00:00:00 2001 From: ptalmeida Date: Fri, 25 Jan 2019 15:05:38 +0000 Subject: [PATCH] add --rank -r option to sherlock --- sherlock.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sherlock.py b/sherlock.py index a05294fc..d72abaa5 100644 --- a/sherlock.py +++ b/sherlock.py @@ -346,6 +346,9 @@ def main(): action="store_true", dest="verbose", default=False, help="Display extra debugging information and metrics." ) + parser.add_argument("--rank", "-r", + action="store_true", dest="rank", default=False, + help="Present websites ordered by their Alexa.com rank in popularity.") parser.add_argument("--folderoutput", "-fo", dest="folderoutput", help="If using multiple usernames, the output of the results will be saved at this folder." ) @@ -464,6 +467,14 @@ def main(): f"Error: Desired sites not found: {', '.join(site_missing)}.") sys.exit(1) + if args.rank: + # Sort data by rank + site_dataCpy = dict(site_data) + ranked_site_data = sorted(site_data, key=lambda k: site_data[k]['rank']) + site_data = {} + for site in ranked_site_data: + site_data[site] = site_dataCpy.get(site) + # Run report on all specified users. for username in args.username: print()