test_SMBLoris.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import os
  2. import random
  3. import unittest
  4. import unittest.mock as mock
  5. from ID2TLib.Controller import *
  6. from Test.Lib import test_pcap, get_sha256
  7. # FIXME: create new hashes
  8. sha_one_attacker = '887226f047456608c5c8746c91d387ffa35777650f083564e0104e381155c58e'
  9. class UnitTestSMBLoris(unittest.TestCase):
  10. def clean_up(self, controller):
  11. os.remove(controller.pcap_dest_path)
  12. os.remove(controller.label_manager.label_file_path)
  13. def test_one_attacker(self):
  14. random.seed(5)
  15. controller = Controller(pcap_file_path=test_pcap, do_extra_tests=False)
  16. controller.load_pcap_statistics(False, False, False)
  17. controller.process_attacks([['SMBLorisAttack', 'ip.src=192.168.1.240', 'ip.dst=192.168.1.210']])
  18. self.assertEqual(get_sha256(controller.pcap_dest_path), sha_one_attacker)
  19. self.clean_up(controller)
  20. #def one_hundred_attacker(self):
  21. # TODO: implement test
  22. #def target_ip_not_in_pcap(self):
  23. # TODO: implement test
  24. #def five_minutes(self):
  25. # TODO: implement test
  26. if __name__ == '__main__':
  27. unittest.main()