Skip to content

Commit

Permalink
Output filename with timestamp when feeding from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
vzamanillo committed May 5, 2020
1 parent e71524c commit c1be47c
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions paramspider.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,40 +78,16 @@ def main():
if not final_uris:
print("\u001b[31;1mNo URLS with parameters found\u001b[0m")
return
if args.subs == True:
url = f"http://web.archive.org/cdx/search/cdx?url=*.{args.domain}/*&output=txt&fl=original&collapse=urlkey&page=/"
else:
url = f"http://web.archive.org/cdx/search/cdx?url={args.domain}/*&output=txt&fl=original&collapse=urlkey&page=/"

response = requester.connector(url)
if response == False:
return
response = unquote(response)

# for extensions to be excluded
black_list = []
if args.exclude:
if "," in args.exclude:
black_list = args.exclude.split(",")
for i in range(len(black_list)):
black_list[i] = "." + black_list[i]
else:
black_list.append("." + args.exclude)

else:
black_list = []
if args.exclude:
print(f"\u001b[31m[!] URLS containing these extensions will be excluded from the results : {black_list}\u001b[0m\n")

final_uris = extractor.param_extract(response , args.level , black_list, args.placeholder)
save_it.save_func(final_uris , args.output , args.domain)
filename = args.domain or datetime.timestamp(datetime.now())
save_it.save_func(final_uris , args.output , filename)

if not args.quiet:
print("\u001b[32;1m")
print('\n'.join(final_uris))
print("\u001b[0m")


print(f"\n\u001b[32m[+] Total unique urls found : {len(final_uris)}\u001b[31m")
if args.output:
if "/" in args.output:
Expand All @@ -120,7 +96,7 @@ def main():
else:
print(f"\u001b[32m[+] Output is saved here :\u001b[31m \u001b[36moutput/{args.output}\u001b[31m" )
else:
print(f"\u001b[32m[+] Output is saved here :\u001b[31m \u001b[36moutput/{args.domain}.txt\u001b[31m")
print(f"\u001b[32m[+] Output is saved here :\u001b[31m \u001b[36moutput/{filename}.txt\u001b[31m")
print("\n\u001b[31m[!] Total execution time : %ss\u001b[0m" % str((time.time() - start_time))[:-12])


Expand Down

0 comments on commit c1be47c

Please sign in to comment.