From a98ca1ff9861881eda5a0c5382d2c5f5b06b985d Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Thu, 25 Jun 2015 12:54:52 +0000 Subject: [PATCH] Add test_port_scanner_results test case --- test/integration/tc_network_rest.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/integration/tc_network_rest.rb b/test/integration/tc_network_rest.rb index f8b3ff787..f0facb368 100644 --- a/test/integration/tc_network_rest.rb +++ b/test/integration/tc_network_rest.rb @@ -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}")