Skip to content

Commit

Permalink
Add support for writing to Comma-Separated Values (CSV) File with all…
Browse files Browse the repository at this point in the history
… of the results. Unfortunately, the request text is so long that it is not visible in spreadsheet programs. So, I am leaving this off for now.
  • Loading branch information
hoadlck committed Dec 29, 2018
1 parent b17072b commit d9e600d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
# Output files, except requirements.txt
*.txt
!requirements.txt

# Comma-Separated Values (CSV) Reports
*.csv
28 changes: 27 additions & 1 deletion sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import sys
import re
import csv
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import platform

Expand Down Expand Up @@ -192,6 +193,10 @@ def main():
action="store_false", dest="verbose",
help="Disable debugging information (Default Option)."
)
parser.add_argument("--csv",
action="store_true", dest="csv", default=False,
help="Create Comma-Separated Values (CSV) File."
)
parser.add_argument("username",
nargs='+', metavar='USERNAMES',
action="store",
Expand All @@ -217,5 +222,26 @@ def main():
print()
results = sherlock(username, verbose=args.verbose)

if args.csv == True:
with open(username + ".csv", "w", newline='') as csv_report:
writer = csv.writer(csv_report)
writer.writerow(['username',
'name',
'url_main',
'url_user',
'exists',
'http_status'
]
)
for site in results:
writer.writerow([username,
site,
results[site]['url_main'],
results[site]['url_user'],
results[site]['exists'],
results[site]['http_status']
]
)

if __name__ == "__main__":
main()
main()

0 comments on commit d9e600d

Please sign in to comment.