Skip to content

Commit

Permalink
more data on repeater failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bararchy committed Sep 13, 2021
1 parent 4079033 commit 7b6c3b2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module SecTester
@scan = Scan.new(token: @token, repeater: @repeater)
@repeater_process = start_repeater
sleep 10.seconds # Let repeatr start
raise SecTester::Error.new("Repeater process isn't running: #{@repeater_process.error?.to_s}") unless @repeater_process.exists?
raise SecTester::Error.new("Repeater process isn't running: #{repeater_output}") unless @repeater_process.exists?
end

def initialize
Expand All @@ -31,7 +31,7 @@ module SecTester
@scan = Scan.new(token: token, repeater: repeater)
@repeater_process = start_repeater
sleep 10.seconds # Let repeatr start
raise SecTester::Error.new("Repeater process isn't running: #{@repeater_process.error?.to_s}") unless @repeater_process.exists?
raise SecTester::Error.new("Repeater process isn't running: #{repeater_output}") unless @repeater_process.exists?
end

# method to start and spawn the repeater process
Expand Down Expand Up @@ -60,6 +60,9 @@ module SecTester
def run_check(scan_name : String, test_name : String, target : Target)
Log.info { "Running check #{test_name} on #{target}" }

# Verify Repeater process
raise SecTester::Error.new("Repeater process isn't running: #{repeater_output}") unless @repeater_process.exists?

# Start a new scan
scan_id = @scan.start(scan_name: scan_name, test_name: test_name, target: target)

Expand All @@ -71,5 +74,9 @@ module SecTester
on_issue: true,
)
end

private def repeater_output : String
(@repeater_process.error? || @repeater_process.output?).to_s
end
end
end

0 comments on commit 7b6c3b2

Please sign in to comment.