test_PortscanAttack.py 1.5 KB

123456789101112131415161718192021222324252627282930
  1. import Test.ID2TAttackTest as Test
  2. sha_portscan_default = 'b70c543c8d9bb4bf7ef8cfe09c23254a968c66a9f4174aea0ec2aa65bc1f090f'
  3. sha_portscan_reverse_ports = '0ea771c6ded24cb667c00d490653ee620f5c29975e966d14dd5bba5008048eac'
  4. sha_portscan_shuffle_dst_ports = 'dea87a34d21d7efa8128fa2d7471e2b4265ad4e150b00b24da8e182149e6fe81'
  5. sha_portscan_shuffle_src_ports = 'cf0fe4c8f9d0d1f016aaebe6ce0a3d66af72d1c6cbc4c671391374506d7f5a9e'
  6. sha_portscan_ip_src_random = 'c3939f30a40fa6e2164cc91dc4a7e823ca409492d44508e3edfc9d24748af0e5'
  7. sha_portscan_ips_not_in_pcap = 'd4703defeaaf8d421f79eb15eb019eed6d4644448054cebcb0caba300d3e0012'
  8. # TODO: improve coverage
  9. class UnitTestPortscanAttack(Test.ID2TAttackTest):
  10. def test_portscan_default(self):
  11. self.checksum_test([['PortscanAttack']], sha_portscan_default)
  12. def test_portscan_reverse_ports(self):
  13. self.checksum_test([['PortscanAttack', 'port.dst.order-desc=1']], sha_portscan_reverse_ports)
  14. def test_portscan_shuffle_dst_ports(self):
  15. self.checksum_test([['PortscanAttack', 'port.dst.shuffle=1']], sha_portscan_shuffle_dst_ports)
  16. def test_portscan_shuffle_src_ports(self):
  17. self.checksum_test([['PortscanAttack', 'port.src.shuffle=1']], sha_portscan_shuffle_src_ports)
  18. def test_portscan_ips_not_in_pcap(self):
  19. self.checksum_test([['PortscanAttack', 'ip.src=1.1.1.1', 'ip.dst=2.2.2.2']], sha_portscan_ips_not_in_pcap)
  20. def test_portscan_order(self):
  21. self.order_test([['PortscanAttack']])