diff options
author | Joey Salazar <jgsal@protonmail.com> | 2021-02-11 19:05:14 -0600 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2021-08-30 06:34:52 +0000 |
commit | 28dbab369d5a6790b4657ddf012c9a73526a8789 (patch) | |
tree | b356cd38dbbeb7b8e1e10c36fcfd3e4567089e64 /test | |
parent | 853d55b871a95e12cd463df3773eb6f88663380d (diff) |
git: Add test cases
Add git dissection test cases to existing testing suite for: finding git
packets, finding the Git Protocol version, finding the right amount of
Flush and Delimiter packets, not finding Malformed packets.
Part of #17093
Diffstat (limited to 'test')
-rw-r--r-- | test/captures/gitOverTCP.pcap | bin | 0 -> 582 bytes | |||
-rw-r--r-- | test/suite_dissection.py | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/captures/gitOverTCP.pcap b/test/captures/gitOverTCP.pcap Binary files differnew file mode 100644 index 0000000000..e2c33f4664 --- /dev/null +++ b/test/captures/gitOverTCP.pcap diff --git a/test/suite_dissection.py b/test/suite_dissection.py index f0405943e1..ba02c68be9 100644 --- a/test/suite_dissection.py +++ b/test/suite_dissection.py @@ -366,6 +366,31 @@ class case_dissect_tcp(subprocesstest.SubprocessTestCase): @fixtures.mark_usefixtures('test_env') @fixtures.uses_fixtures +class case_dissect_git(subprocesstest.SubprocessTestCase): + def test_git_prot(self, cmd_tshark, capture_file, features): + ''' + Check for Git protocol version 2, flush and delimiter packets. + Ensure there are no malformed packets. + ''' + proc = self.assertRun((cmd_tshark, + '-r', capture_file('gitOverTCP.pcap'), + '-Ygit', '-Tfields', '-egit.version', '-egit.packet_type', + '-zexpert', '-e_ws.expert', + )) + # `epan/dissectors/packet-git.c` parses the Git Protocol version + # from ASCII '1' or '2' to integers 49 or 50 in grep output. + # 0x0000 are flush packets. + # 0x0001 are delimiter packets. + # Pre-existing git Malformed Packets in this pcap were addressed + # with the parsing of the delimiter packets. This test ensures + # pcap gitOverTCP's delim packets are parsed and that there are no + # malformed packets with "Expert Info/Errors" in the same pcap. + # Additional test cases for other scenarios, i.e actually malformed + # git packets, might be required. + self.assertEqual(proc.stdout_str, '50\t\t\n\t0\t\n\t\t\n\t1,0\t\n') + +@fixtures.mark_usefixtures('test_env') +@fixtures.uses_fixtures class case_dissect_tls(subprocesstest.SubprocessTestCase): def check_tls_handshake_reassembly(self, cmd_tshark, capture_file, extraArgs=[]): |