Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions knockpy/knockpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -135,7 +138,7 @@ def main():

start(domain)
statistics()
savescan(domain)
savescan(domain, output_file)

else:
exit('error arguments: use knockpy -h to help')
Expand Down
4 changes: 2 additions & 2 deletions knockpy/modules/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 6 additions & 2 deletions knockpy/modules/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down