diff --git a/tools/nasparse.py b/tools/nasparse.py index 61713b1..c78ed3b 100755 --- a/tools/nasparse.py +++ b/tools/nasparse.py @@ -26,7 +26,7 @@ def parse_nas_message(buffer, uplink=None): parsed = NASLTE.parse_NASLTE_MT(bin) if parsed[0] is None: # Not a NAS Packet - raise parsed[1] + raise TypeError("Not a nas packet") return parsed[0] def heur_ue_imsi_sent(msg): diff --git a/tools/nasparse_test.py b/tools/nasparse_test.py index c877e0b..bba24be 100644 --- a/tools/nasparse_test.py +++ b/tools/nasparse_test.py @@ -6,7 +6,7 @@ import nasparse class TestNasparse(unittest.TestCase): imsi_sent_msg = '07412208391185184409309005f0700000100030023ed031d127298080211001000010810600000000830600000000000d00000300ff0003130184000a000005000010005c0a009011034f18a6f15d0103c1000000000000' sec_imsi_sent_msg = '1727db4b7c0207412208391185184409309005f0700000100030023ed031d127298080211001000010810600000000830600000000000d00000300ff0003130184000a000005000010005c0a009011034f18a6f15d0103c1' - non_nas_msg = '1312deadbeefcafe' + non_nas_msg = 'deadbeefcafe' other_nas_msg = '074413780004023fd121' other_nas_mt_msg = "023fd12100000000000000000000000000000000000000000000000000000000" ciphered_nas_msg = "27ed6146bd0162a5d62d62e1ce501720dc8bd84f1167fd" @@ -22,7 +22,8 @@ class TestNasparse(unittest.TestCase): self.assertEqual(self.run_heur(self.imsi_sent_msg), True, "sec_imsi_sent_msg should trigger heuristic") def test_non_nas_msg(self): - self.assertEqual(self.run_heur(self.non_nas_msg), False, "non_nas_msg should not trigger heuristic") + with self.assertRaises(TypeError): + self.run_heur(self.non_nas_msg) def test_other_nas(self): self.assertEqual(self.run_heur(self.other_nas_msg), False, "other_nas_msg should not trigger heuristic")