Skip to content

Commit

Permalink
Copy all ZAP logs in export_session.py scan hook (#414)
Browse files Browse the repository at this point in the history
Zap rotates log files which results in multiple log files.
Updated code to copy all of the log files.

Signed-off-by: midwestKC-coder <[email protected]>
  • Loading branch information
midwestKC-coder authored Nov 28, 2023
1 parent 2d60230 commit cfa1896
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion other/scan-hooks/export_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from shutil import copy2, copytree
import os.path
import glob

# This assumes that you are running as zap - if you run as root change to use /root/.ZAP(_D)
dev_path = '/home/zap/.ZAP_D'
Expand All @@ -14,4 +15,5 @@ def pre_exit(fail_count, warn_count, pass_count):
if os.path.exists(dev_path + '/session'):
dir = dev_path
copytree(dir + '/session', '/zap/wrk/session')
copy2(dir + '/zap.log', '/zap/wrk')
for zap_file in glob.iglob(dir + '/zap.log*'):
copy2(zap_file, '/zap/wrk')

0 comments on commit cfa1896

Please sign in to comment.