def setUp(self): """ This is a rather complex setUp since I need to move the exception_raise.py plugin to the plugin directory in order to be able to run it afterwards. In the tearDown method, I'll remove the file. """ self.w3afcore = w3afCore() target_opts = create_target_option_list(URL(get_moth_http())) self.w3afcore.target.set_options(target_opts) plugin_inst = factory(self.PLUGIN) plugin_inst.set_url_opener(self.w3afcore.uri_opener) plugin_inst.set_worker_pool(self.w3afcore.worker_pool) self.w3afcore.plugins.plugins['crawl'] = [ plugin_inst, ] self.w3afcore.plugins._plugins_names_dict['crawl'] = [ 'exception_raise', ] self.exception_plugin = plugin_inst # Verify env and start the scan self.w3afcore.plugins.initialized = True self.w3afcore.verify_environment()
def test_stop_by_keyboardinterrupt(self): """ Verify that the Ctrl+C stops the scan. """ # pylint: disable=E0202 w3afcore = w3afCore() mock_call = MagicMock(side_effect=KeyboardInterrupt()) w3afcore.status.set_current_fuzzable_request = mock_call target_opts = create_target_option_list(URL(get_moth_http())) w3afcore.target.set_options(target_opts) w3afcore.plugins.set_plugins(['web_spider',], 'crawl') # Verify env and start the scan w3afcore.plugins.init_plugins() w3afcore.verify_environment() w3afcore.start()
def test_stop_by_keyboardinterrupt(self): """ Verify that the Ctrl+C stops the scan. """ # pylint: disable=E0202 w3afcore = w3afCore() mock_call = MagicMock(side_effect=KeyboardInterrupt()) w3afcore.status.set_current_fuzzable_request = mock_call target_opts = create_target_option_list(URL(get_moth_http())) w3afcore.target.set_options(target_opts) w3afcore.plugins.set_plugins(['web_spider'], 'crawl') #w3afcore.plugins.set_plugins(['console'], 'output') # Verify env and start the scan w3afcore.plugins.init_plugins() w3afcore.verify_environment() w3afcore.start()
def test_send_mangled(self): self.w3afcore.plugins.set_plugins(['self_reference'], 'evasion') self.w3afcore.plugins.set_plugins(['sqli'], 'audit') target_opts = create_target_option_list(URL(get_moth_http())) self.w3afcore.target.set_options(target_opts) # Verify env and start the scan self.w3afcore.plugins.init_plugins() self.w3afcore.verify_environment() sref = self.w3afcore.plugins.plugins['evasion'][0] def return_arg(request): return request sref.modify_request = MagicMock(side_effect=return_arg) self.w3afcore.start() self.assertGreater(sref.modify_request.call_count, 15)
def setUp(self): """ This is a rather complex setUp since I need to create an instance of the count.py plugin in memory, without copying it to any plugins directory since that would generate issues with other tests. """ self.w3afcore = w3afCore() target_opts = create_target_option_list(URL(get_moth_http())) self.w3afcore.target.set_options(target_opts) plugin_inst = factory(self.PLUGIN) plugin_inst.set_url_opener(self.w3afcore.uri_opener) plugin_inst.set_worker_pool(self.w3afcore.worker_pool) self.w3afcore.plugins.plugins['crawl'] = [plugin_inst] self.w3afcore.plugins._plugins_names_dict['crawl'] = ['count'] self.count_plugin = plugin_inst # Verify env and start the scan self.w3afcore.plugins.initialized = True self.w3afcore.verify_environment()
def setUp(self): """ This is a rather complex setUp since I need to move the exception_raise.py plugin to the plugin directory in order to be able to run it afterwards. In the tearDown method, I'll remove the file. """ self.w3afcore = w3afCore() target_opts = create_target_option_list(URL(get_moth_http())) self.w3afcore.target.set_options(target_opts) plugin_inst = factory(self.PLUGIN) plugin_inst.set_url_opener(self.w3afcore.uri_opener) plugin_inst.set_worker_pool(self.w3afcore.worker_pool) self.w3afcore.plugins.plugins['crawl'] = [plugin_inst,] self.w3afcore.plugins._plugins_names_dict['crawl'] = ['exception_raise',] self.exception_plugin = plugin_inst # Verify env and start the scan self.w3afcore.plugins.initialized = True self.w3afcore.verify_environment()