test_SMBLoris.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import unittest
  2. import unittest.mock as mock
  3. from Test.GenericTest import GenericTest
  4. from Test.Lib import test_pcap_ips
  5. # FIXME: create new hashes if new test.pcap is used
  6. sha_default = 'e6201c4a6b42fb86304b935ee522d4c1f655bc19a4646c4df45a64bb504a0b5c'
  7. sha_one_attacker = '538f584a7a12488269cb22a2986cd0e6f32f0c243c7cce72c5deb5230167897c'
  8. sha_sixteen_attackers = 'ca3cb549a213832e238a25eaadfc8e6c55c0b37b595ca1fc16cfca7c0990d675'
  9. sha_ips_in_pcap = 'bb54c042f870467021958d5f6947d21876b1fa5cda5f27da41adebac8cd44b74'
  10. """
  11. CURRENT COVERAGE
  12. Name Stmts Miss Cover Missing (lines)
  13. ---------------------------------------------------------------------------
  14. Attack/SMBLorisAttack.py 128 5 96% 60, 73, 78, 155, 188
  15. """
  16. # TODO: get 100% coverage
  17. class UnitTestSMBLoris(GenericTest):
  18. def test_default(self):
  19. # FIXME: maybe use another seed
  20. self.generic_test([['SMBLorisAttack']], sha_default)
  21. def test_one_attacker(self):
  22. self.generic_test([['SMBLorisAttack', 'ip.src=192.168.1.240', 'ip.dst=192.168.1.210']], sha_one_attacker)
  23. def test_ips_in_pcap(self):
  24. ip_src = 'ip.src='+test_pcap_ips[0]
  25. ip_dst = 'ip.dst='+test_pcap_ips[1]
  26. self.generic_test([['SMBLorisAttack', ip_src, ip_dst]], sha_ips_in_pcap)
  27. def test_sixteen_attackers(self):
  28. self.generic_test([['SMBLorisAttack', 'ip.dst=192.168.1.210', 'attackers.count=16']], sha_sixteen_attackers)
  29. if __name__ == '__main__':
  30. unittest.main()