Beispiel #1
0
    def testMarksEndpointsAsFuzzedOnlyIfCheckRequestReproducible(self):
        self.assertTrue(False)
        with self.mockUtilityCalls():
            cb, state, burpCallbacks = self._ctc()

            em = GenericMock()
            em.fuzzed = False
            em.setFuzzed = GenericMock()
            requestA = GenericMock()

            utility.counter = 0

            def wasReproducible():
                if utility.counter == 0:
                    utility.counter += 1
                    return True
                else:
                    return False

            requestA.wasReproducible = wasReproducible

            em.requests = [requestA]
            state.endpointTableModel.endpoints = {"GET|/lol": em}
            requestA.analyzedResponse.statusCode = 200
            requestA.repeatedAnalyzedResponse.statusCode = 200

            cb.fuzzButtonClicked(GenericMock())

            self.assertEquals(state.endpointTableModel.setFuzzed.call_count, 0)
Beispiel #2
0
    def testFuzzOnlyIfNotFuzzedAlready(self):
        with self.mockUtilityCalls():
            cb, state, burpCallbacks = self._ctc()

            em = GenericMock()
            em.fuzzed = True
            requestA = GenericMock()

            em.requests = [requestA]
            state.endpointTableModel.endpoints = {"GET|/lol": em}
            requestA.analyzedResponse.statusCode = 200
            requestA.repeatedAnalyzedResponse.statusCode = 200

            cb.fuzzButtonClicked(GenericMock())

            self.assertEquals(state.fuzzExecutorService.submit.call_count, 0)
Beispiel #3
0
    def testClickFuzzRepeats(self):
        with self.mockUtilityCalls():
            cb, state, burpCallbacks = self._ctc()

            em = GenericMock()
            em.fuzzed = False

            fuzz.resend_request_model = GenericMock()

            requestA = GenericMock()

            em.requests = [requestA]
            state.endpointTableModel.endpoints = {"GET|/lol": em}
            requestA.analyzedResponse.statusCode = 200
            requestA.repeatedAnalyzedResponse = None

            cb.resendRequestModel = GenericMock()
            try:
                cb.fuzzButtonClicked(GenericMock())
            except AttributeError:
                pass

            self.assertEquals(fuzz.resend_request_model.call_count, 6)
Beispiel #4
0
    def testClickFuzzOnlyIfSameStatusDifferent(self):
        with self.mockUtilityCalls():
            cb, state, burpCallbacks = self._ctc()

            state.executorService = GenericMock()

            em = GenericMock()
            em.fuzzed = False

            requestA = GenericMock()
            requestB = GenericMock()

            em.requests = [requestA, requestB]
            state.endpointTableModel.endpoints = {"GET|/lol": em}
            requestA.analyzedResponse.statusCode = 200
            requestA.repeatedAnalyzedResponse.statusCode = 403

            requestB.analyzedResponse.statusCode = 200
            requestB.repeatedAnalyzedResponse.statusCode = 403

            cb.fuzzButtonClicked(GenericMock())

            self.assertEquals(state.executorService.submit.call_count, 0)