test_SMBLorisAttack.py 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. import ID2TLib.TestLibrary as Lib
  2. import Test.ID2TAttackTest as Test
  3. sha_default = '0736521d9bb35362704f5ada6fc1d8e74b2623f9361e999c3c60da951f890036'
  4. sha_one_attacker = 'c56b1f6d15142f61df2ef75268f72c5af2d1d43d41157eed4d4cb96550b9384e'
  5. sha_sixteen_attackers = '7681eb409918b8baafaf58fba8e99bc602014bf776195c4e3b69997bd24a8054'
  6. sha_ips_in_pcap = '96786fc8952292414b74ebf23bcf6158890b74c7b3eb5dbc1229f91f50269ffd'
  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']])