memory_testing.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import unittest.mock as mock
  2. import ID2TLib.TestLibrary as Lib
  3. import Test.ID2TAttackTest as Test
  4. class MemoryTests(Test.ID2TAttackTest):
  5. def test_SMBLoris(self):
  6. self.memory_test([['SMBLorisAttack', 'attackers.count=30', 'packets.per-second=8.0']])
  7. def test_SMBScan(self):
  8. self.memory_test([['SMBScanAttack', 'ip.src=192.168.178.1', 'ip.dst=192.168.178.10-192.168.197.145']])
  9. @mock.patch('ID2TLib.Utility.get_rnd_bytes', side_effect=Lib.get_bytes)
  10. @mock.patch('ID2TLib.Utility.get_rnd_x86_nop', side_effect=Lib.get_x86_nop)
  11. def test_FTPExploit(self, mock_get_rnd_x86_nop, mock_get_rnd_bytes):
  12. self.memory_test([['FTPWinaXeExploit', 'ip.src=192.168.178.1', 'ip.dst=192.168.178.10']])
  13. def test_PortscanAttack(self):
  14. self.memory_test([['PortscanAttack', 'ip.src=192.168.178.1']])
  15. def test_SQLi(self):
  16. self.memory_test([['SQLiAttack', 'ip.dst=192.168.0.1']])
  17. def test_Joomla(self):
  18. self.memory_test([['JoomlaRegPrivExploit', 'ip.src=192.168.178.1']])
  19. def test_SalityBotnet(self):
  20. self.memory_test([['SalityBotnet']])
  21. @mock.patch('Attack.BaseAttack.BaseAttack.write_attack_pcap', side_effect=Lib.write_attack_pcap)
  22. def test_DDoS(self, mock_write_attack_pcap):
  23. self.memory_test([['DDoSAttack', 'attackers.count=100', 'packets.per-second=95', 'attack.duration=150']])
  24. def test_EternalBlue(self):
  25. self.memory_test([['EternalBlueExploit']])
  26. def test_MS17Scan(self):
  27. self.memory_test([['MS17ScanAttack']])