I have visited this page, and unsuccessfully tried those solutions.
I'm running on Windows 10. I have this batch (cmd.exe) file for Arachni security scanner:
arachni ^
--audit-forms ^
--audit-jsons ^
--audit-links ^
--audit-ui-forms ^
--audit-ui-inputs ^
--audit-xmls ^
--browser-cluster-ignore-images ^
--browser-cluster-job-timeout=90 ^
--browser-cluster-pool-size=3 ^
--checks=trainer ^
--http-request-queue-size=100 ^
--http-request-redirect-limit=3 ^
--http-request-timeout=30000 ^
--http-response-max-size=500000 ^
--http-user-agent="PhantomJS / arachni v1.5.1-0.5.12-windows-x86_64" ^
--plugin=login_script:script=%~dp0\LoginScript.rb ^
https://www.example.com
The Login Script (penultimate line from the batch script above) helps me to login into the application and start the scan. Part of the Login Script (.rb extension) looks like below:
begin
browser.text_field(:id => 'myTextField').wait_until_present(60)
puts 'User successfully lands on MyWebSite home page with the URL ' + browser.url
rescue
puts 'Even after 60 seconds of waiting still unable to reach MyWebSite home page'
exit
end
As it can be seen from the rescue statement, I'm trying to terminate / close / finish / kill the entire batch job if certain element is not found (Watir WebDriver in the nutshell). I can clearly see that Even after 60 seconds of waiting still unable to reach MyWebSite home page message is displayed in the console, meaning rescue statement gets executed, but after that scan just continues further as nothing tries to stop it. Below are different variations what I tried to put instead of exit
statement:
- exit 1
- abort('Aborting the scan')
- raise RuntimeError, 'Aborting the scan'
- system('exit')
None of them worked in my situation...
Is this ever possible to stop the scan (literally the batch job) from Ruby script?