예제 #1
0
 def setUp(self):
     self.engine = FakeHammerTimeEngine()
     self.filter = RejectIgnoredQuery()
     self.filter.set_child_heuristics(None)
     self.filter.set_engine(self.engine)
     self.kb = KnowledgeBase()
     self.filter.set_kb(self.kb)
예제 #2
0
    async def test_fetch_session_cookies_on_scan_start_if_no_user_supplied_cookies(
            self, loop):
        engine = FakeHammerTimeEngine()
        hammertime = HammerTime(request_engine=engine, loop=loop)
        hammertime.collect_successful_requests()

        await tachyon.scan(hammertime,
                           cookies=None,
                           accumulator=self.accumulator)

        tachyon.get_session_cookies.assert_called_once_with(hammertime)
예제 #3
0
    async def test_scan_plugins_only(self, loop):
        engine = FakeHammerTimeEngine()
        hammertime = HammerTime(request_engine=engine, loop=loop)
        hammertime.collect_successful_requests()

        await tachyon.scan(hammertime,
                           plugins_only=True,
                           accumulator=self.accumulator)

        tachyon.load_execute_host_plugins.assert_called_once_with(hammertime)
        tachyon.test_file_exists.assert_not_called()
        tachyon.test_paths_exists.assert_not_called()
예제 #4
0
    async def test_use_user_supplied_cookies_if_available(self, loop):
        database.session_cookie = "my-cookies=123"
        cookies = "test-cookie=true"
        engine = FakeHammerTimeEngine()
        hammertime = HammerTime(request_engine=engine, loop=loop)
        hammertime.collect_successful_requests()

        with patch("tachyon.config.add_http_header") as add_http_header:
            await tachyon.scan(hammertime,
                               cookies=cookies,
                               accumulator=self.accumulator)

            add_http_header.assert_any_call(ANY, "Cookie", "test-cookie=true")
예제 #5
0
 def async_setup(self, loop):
     self.hammertime = HammerTime(loop=loop, request_engine=FakeHammerTimeEngine())
     self.hammertime.collect_successful_requests()
     self.hammertime.heuristics.add_multiple([SetFlagInResult("soft404", False),
                                              SetFlagInResult("error_behavior", False)])
     self.directory_fetcher = DirectoryFetcher(self.host, self.hammertime)
예제 #6
0
 def setUpFetcher(self, loop):
     self.hammertime = HammerTime(loop=loop, request_engine=FakeHammerTimeEngine(), kb=KnowledgeBase())
     self.hammertime.collect_successful_requests()
     conf.target_host = self.host
     self.file_fetcher = FileFetcher(self.host, self.hammertime)