From d3e11e9bc1edd42c38b176979ae94c139ccfe13b Mon Sep 17 00:00:00 2001 From: Mathy Vanhoef Date: Wed, 5 Aug 2020 00:35:24 +0400 Subject: [PATCH] fragattack: test output improvements --- research/fraginternals.py | 2 +- research/tests_common.py | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/research/fraginternals.py b/research/fraginternals.py index 035bd25e3..893cd3ae1 100644 --- a/research/fraginternals.py +++ b/research/fraginternals.py @@ -249,7 +249,7 @@ class Test(metaclass=abc.ABCMeta): if self.check_fn != None: self.time_completed = time.time() else: - log(STATUS, "All frames sent. You must manually check if the test succeeded (see README).", color="green") + log(STATUS, ">>> All frames sent. You must manually check if the test succeeded (see README).", color="green") self.done = True def get_actions(self, action): diff --git a/research/tests_common.py b/research/tests_common.py index dcdb5b933..1b7c852a1 100644 --- a/research/tests_common.py +++ b/research/tests_common.py @@ -38,11 +38,14 @@ class PingTest(Test): def prepare(self, station): log(STATUS, "Generating ping test", color="green") - # TODO: We can only automatically check result if the last action happens while being connected...???? - # Generate the header and payload - header, request, self.check_fn = generate_request(station, self.ptype, icmp_size=self.icmp_size, \ - padding=self.padding, to_self=self.to_self, dport=self.dport) + header, request, check_fn = generate_request(station, self.ptype, icmp_size=self.icmp_size, \ + padding=self.padding, to_self=self.to_self, dport=self.dport) + + # We can automatically detect the result if the last fragment was sent after a connected event. + # Note we might get a reply during a rekey handshake, and this will be handled properly. + if any([act.trigger >= Action.AfterAuth for act in self.actions]): + self.check_fn = check_fn if self.as_msdu == 1: # Set the A-MSDU frame type flag in the QoS header @@ -220,9 +223,9 @@ class EapolAmsduTest(Test): # Set the A-MSDU frame type flag in the QoS header header.Reserved = 1 - # We can automatically detect result if the last fragment was - # sent after the authentication - if self.actions[-1].trigger >= Action.AfterAuth: + # We can automatically detect the result if the last fragment was sent after a connected event. + # Note we might get a reply during a rekey handshake, and this will be handled properly. + if any([act.trigger >= Action.AfterAuth for act in self.actions]): self.check_fn = check_fn mac_src = station.mac