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 = 'cd02bcc6376f4701d13384cbec6e210ea99308dca5d08f58edd3ab190cd50bf2'
  7. sha_one_attacker = '887226f047456608c5c8746c91d387ffa35777650f083564e0104e381155c58e'
  8. sha_one_hundred_attackers = '3cab29e73bc048ea7cbffde51f5637fe00256d896a6788db27fbec3804f19cc9'
  9. sha_ips_in_pcap = '4a072c57bf97c8543305964c4df4de5f010df7da22fc8f414ccbbf88b962ae86'
  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_one_hundred_attackers(self):
  28. self.generic_test([['SMBLorisAttack', 'ip.dst=192.168.1.210', 'attackers.count=100']], sha_one_hundred_attackers)
  29. if __name__ == '__main__':
  30. unittest.main()