Skip to content

Commit 109e6c1

Browse files
authored
Merge pull request #101 from KMadhuSudhan/patch-8
Update dynamic_scan_worker.rb
2 parents 1dd4856 + 9290131 commit 109e6c1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

web/app/app/workers/dynamic_scan_worker.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ def perform(scan_id,scaner_instance)
2020
:run_tasks => [],
2121
:logfile => @logfile
2222
}
23-
if scan.target.present?
24-
pipeline_options[:target] = scan.target
25-
else
26-
@dir = Dir.mktmpdir
27-
system("cp" ,"-r", "#{scan.project_target.path}","#{@dir}")
28-
pipeline_options[:target] = "#{@dir}"
29-
end
23+
pipeline_options[:target] = scan.target
24+
3025
scan_type = ScanType.where("name like ?", "%#{scan.scan_type}%")
3126
tools = scan_type.first.tasks.map(&:name)
3227
pipeline_tools = Setting.find_by(var: 'pipeline')
@@ -57,7 +52,7 @@ def perform(scan_id,scaner_instance)
5752
scan.update_scan_status("failed","Some error occured")
5853
scan.end_time = Time.now.asctime
5954
scan.save
60-
FileUtils.remove_entry_secure(@dir) if Dir.exist?(@dir)
55+
#FileUtils.remove_entry_secure(@dir) if Dir.exist?(@dir)
6156
AlertNotification.create(user_id: scan.user_id,identifier: 'task',alert_type: 'danger',message: "#{scan.scan_type} Scanning failed",scaner_id: scan.id,task_name: @project_title)
6257
@logfile.puts "Error occurred while running dynamicscan ...#{e.backtrace}"
6358
@logfile.close
@@ -68,7 +63,7 @@ def perform(scan_id,scaner_instance)
6863
scan.update_scan_status("Completed","completed")
6964
scan.end_time = Time.now.asctime
7065
scan.save
71-
FileUtils.remove_entry_secure(@dir) if Dir.exist?(@dir)
66+
#FileUtils.remove_entry_secure(@dir) if Dir.exist?(@dir)
7267
AlertNotification.create(user_id: scan.user_id,identifier: 'task',alert_type: 'success',message: "#{scan.scan_type} Scanning completed",scaner_id: scan.id,task_name: @project_title)
7368
@logfile.puts "sending notification mail..for scan id.#{scan_id}"
7469
#scan.send_notifications

0 commit comments

Comments
 (0)