diff --git a/knockpy/knockpy.py b/knockpy/knockpy.py index e4670df..ee43bd5 100644 --- a/knockpy/knockpy.py +++ b/knockpy/knockpy.py @@ -63,9 +63,9 @@ def statistics(): core.header_stats_summary() core.report() -def savescan(domain): +def savescan(domain, output_file): # Save result - core.save_in_csv(domain) + core.save_in_csv(domain, output_file) def getzone(domain): core.getzone(domain) @@ -101,10 +101,13 @@ def main(): parser.add_argument('-z', '--zone', help='check for zone transfer', action='store_true', required=False) + parser.add_argument('-o', '--output', help='output file name') + args = parser.parse_args() # args strings domain = args.domain + output_file = args.output wlist = args.wordlist if wlist: wlist = wlist[0] @@ -135,7 +138,7 @@ def main(): start(domain) statistics() - savescan(domain) + savescan(domain, output_file) else: exit('error arguments: use knockpy -h to help') diff --git a/knockpy/modules/core.py b/knockpy/modules/core.py index 0aa9cd4..8592191 100644 --- a/knockpy/modules/core.py +++ b/knockpy/modules/core.py @@ -227,8 +227,8 @@ def report(): print target.get_report(targetlist) # Save result in csv -def save_in_csv(domain): - print target.save_csv(domain) +def save_in_csv(domain, output_file): + print target.save_csv(domain, output_file) # Zone transfer def getzone(domain): diff --git a/knockpy/modules/target.py b/knockpy/modules/target.py index 5be57fa..121799a 100644 --- a/knockpy/modules/target.py +++ b/knockpy/modules/target.py @@ -55,10 +55,14 @@ def get(target, verbose, test): return text.rstrip() -def save_csv(domain): +def save_csv(domain, output_file): if not found: exit() timestamp = utilipy.timestamp() - filename = domain.replace('.', '_')+'_'+str(timestamp)+'.csv' + if output_file: + filename = output_file + else: + filename = domain.replace('.', '_')+'_'+str(timestamp)+'.csv' + try: utilipy.touch(filename) with open(filename, 'a') as f: