3
0

test_SMBLoris.py 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import ID2TLib.TestLibrary as Lib
  2. import Test.ID2TAttackTest as Test
  3. sha_default = 'cbfb154a80546ebcf0a0d5128bcc42e4d69228c1d97ea4dda49ba156703b78c2'
  4. sha_one_attacker = 'a316ba1a667318ef4b8d1bf5ffee3f58dfcd0221b0cc3ab62dd967379217eb27'
  5. sha_sixteen_attackers = '08b17b360ee9be1657e7c437e5aef354dac374ceca3b4ee437c45c0d9d03a2ef'
  6. sha_ips_in_pcap = 'f299e4139780869d9f02c25ba00f1cad483a4f215d6aef4079b93f7f7e1de22a'
  7. # TODO: improve coverage
  8. class UnitTestSMBLoris(Test.ID2TAttackTest):
  9. def test_smbloris_default(self):
  10. self.checksum_test([['SMBLorisAttack']], sha_default)
  11. def test_smbloris_one_attacker(self):
  12. self.checksum_test([['SMBLorisAttack', 'ip.src=192.168.1.240', 'ip.dst=192.168.1.210']], sha_one_attacker)
  13. def test_smbloris_ips_in_pcap(self):
  14. ip_src = 'ip.src='+Lib.test_pcap_ips[0]
  15. ip_dst = 'ip.dst='+Lib.test_pcap_ips[1]
  16. self.checksum_test([['SMBLorisAttack', ip_src, ip_dst]], sha_ips_in_pcap)
  17. def test_smbloris_sixteen_attackers(self):
  18. self.checksum_test([['SMBLorisAttack', 'ip.dst=192.168.1.210', 'attackers.count=16']], sha_sixteen_attackers)
  19. def test_smbloris_same_ip_src_dst(self):
  20. with self.assertRaises(SystemExit):
  21. self.checksum_test([['SMBLorisAttack', 'ip.src=192.168.1.240', 'ip.dst=192.168.1.240']], sha_default)
  22. def test_smbloris_order(self):
  23. self.order_test([['SMBLorisAttack', 'attackers.count=1']])