Skip to content

Instantly share code, notes, and snippets.

@Zapotek
Created May 17, 2023 17:25
Show Gist options
  • Save Zapotek/067ae0c08040c3b6ee3010ea181f5722 to your computer and use it in GitHub Desktop.
Save Zapotek/067ae0c08040c3b6ee3010ea181f5722 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'pp'
require_relative 'rest-http-helpers'
# Create a new scanner Instance (process) and run a scan with the following options.
request :post, 'instances', {
# Scan this URL.
url: 'http://testhtml5.vulnweb.com',
# Audit the following element types.
audit: {
elements: [:links, :forms, :cookies, :ui_inputs, :ui_forms]
},
# Load all active checks.
checks: '*'
}
# The ID is used to represent that instance and allow us to manage it from here on out.
instance_id = response_data['id']
while sleep( 1 )
# Continue looping while instance status is 'busy'.
request :get, "instances/#{instance_id}"
break if !response_data['busy']
end
puts '*' * 88
# Get the scan report.
request :get, "instances/#{instance_id}/scan/report.json"
# Print out the report.
pp response_data
# Shutdown the Instance.
request :delete, "instances/#{instance_id}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment