From 8f05a403eeb51978d0d1851de21ff7796bf044f1 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Sun, 15 Apr 2012 13:45:24 +0100 Subject: [PATCH] Added Test_return_ascii_chars Debug module test using the API. --- test/integration/tc_debug_modules.rb | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/test/integration/tc_debug_modules.rb b/test/integration/tc_debug_modules.rb index 6945d7a7f..183774e91 100644 --- a/test/integration/tc_debug_modules.rb +++ b/test/integration/tc_debug_modules.rb @@ -87,7 +87,34 @@ class TC_DebugModules < Test::Unit::TestCase result = JSON.parse(response.body) data = JSON.parse(result["data"]) assert_not_nil data - assert data["data"] == (repeat_string * repeat_count) + assert_equal data["data"],(repeat_string * repeat_count) + end + + # Test debug module "Test_return_ascii_chars" using the RESTful API + def test_return_ascii_chars + BeefTest.new_victim + sleep 2.0 + response = RestClient.post "#{RESTAPI_MODULES}/#{@@hb_session}/#{@@mod_debug_ascii_chars}?token=#{@@token}", + {}.to_json, + :content_type => :json, + :accept => :json + assert_equal 200, response.code + assert_not_nil response.body + result = JSON.parse(response.body) + success = result['success'] + assert success + + cmd_id = result['command_id'] + sleep 3.0 + response = RestClient.get "#{RESTAPI_MODULES}/#{@@hb_session}/#{@@mod_debug_ascii_chars}/#{cmd_id}", {:params => {:token => @@token}} + assert_equal 200, response.code + assert_not_nil response.body + result = JSON.parse(response.body) + data = JSON.parse(result["data"]) + assert_not_nil data + ascii_chars = "" + (32..127).each do |i| ascii_chars << i.chr end + assert_equal ascii_chars,data["data"] end end \ No newline at end of file