Add test_port_scanner_results test case

This commit is contained in:
Brendan Coles
2015-06-25 12:54:52 +00:00
parent 423b66f424
commit a98ca1ff98

View File

@@ -57,7 +57,7 @@ class TC_NetworkRest < Test::Unit::TestCase
:accept => :json
result = JSON.parse(response.body)
success = result['success']
cmd_id = result['command_id']
@@cmd_id = result['command_id']
sleep 15.0
end
@@ -67,6 +67,14 @@ class TC_NetworkRest < Test::Unit::TestCase
end
# Ensure the Port Scanner module identified the BeEF host
def test_port_scanner_results
rest_response = RestClient.get "#{RESTAPI_MODULES}/#{@@hb_session}/#{@@mod_port_scanner}/#{@@cmd_id}?token=#{@@token}"
check_rest_response(rest_response)
result = JSON.parse(rest_response.body)
raise "Port Scanner module failed to identify any open ports" unless result.to_s =~ /Port 3000 is OPEN/
end
# Tests GET /api/network/hosts handler
def test_get_all_hosts
rest_response = RestClient.get("#{RESTAPI_NETWORK}/hosts?token=#{@@token}")