|
@@ -1,17 +1,18 @@
|
|
import logging
|
|
import logging
|
|
-from random import randint, uniform
|
|
|
|
|
|
|
|
|
|
+from random import randint, uniform
|
|
from lea import Lea
|
|
from lea import Lea
|
|
|
|
+from scapy.utils import RawPcapReader
|
|
|
|
+from scapy.layers.inet import Ether
|
|
|
|
|
|
from Attack import BaseAttack
|
|
from Attack import BaseAttack
|
|
from Attack.AttackParameters import Parameter as Param
|
|
from Attack.AttackParameters import Parameter as Param
|
|
from Attack.AttackParameters import ParameterTypes
|
|
from Attack.AttackParameters import ParameterTypes
|
|
|
|
+from ID2TLib.Utility import update_timestamp, get_interval_pps
|
|
|
|
|
|
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
|
|
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
|
|
# noinspection PyPep8
|
|
# noinspection PyPep8
|
|
-from scapy.utils import RawPcapReader
|
|
|
|
-from scapy.layers.inet import IP, Ether, TCP, RandShort
|
|
|
|
-from ID2TLib.Utility import *
|
|
|
|
|
|
+
|
|
|
|
|
|
class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
template_scan_pcap_path = "resources/Win7_eternalblue_scan.pcap"
|
|
template_scan_pcap_path = "resources/Win7_eternalblue_scan.pcap"
|
|
@@ -183,7 +184,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt.time = timestamp_next_pkt
|
|
new_pkt.time = timestamp_next_pkt
|
|
|
|
|
|
- pps = max(getIntervalPPS(complement_interval_pps, timestamp_next_pkt), 10)
|
|
|
|
|
|
+ pps = max(get_interval_pps(complement_interval_pps, timestamp_next_pkt), 10)
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]#float(timeSteps.random())
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]#float(timeSteps.random())
|
|
# Reply
|
|
# Reply
|
|
else:
|
|
else:
|
|
@@ -275,7 +276,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt.time = timestamp_next_pkt
|
|
new_pkt.time = timestamp_next_pkt
|
|
|
|
|
|
- pps = max(getIntervalPPS(complement_interval_pps, timestamp_next_pkt), 10)
|
|
|
|
|
|
+ pps = max(get_interval_pps(complement_interval_pps, timestamp_next_pkt), 10)
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num] #float(timeSteps.random())
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num] #float(timeSteps.random())
|
|
|
|
|
|
# Reply
|
|
# Reply
|
|
@@ -305,7 +306,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
|
|
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
|
|
|
|
- pps = max(getIntervalPPS(complement_interval_pps, timestamp_next_pkt), 10)
|
|
|
|
|
|
+ pps = max(get_interval_pps(complement_interval_pps, timestamp_next_pkt), 10)
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]#float(timeSteps.random())
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]#float(timeSteps.random())
|
|
|
|
|
|
new_pkt.time = timestamp_next_pkt
|
|
new_pkt.time = timestamp_next_pkt
|
|
@@ -348,7 +349,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt.time = timestamp_next_pkt
|
|
new_pkt.time = timestamp_next_pkt
|
|
|
|
|
|
- pps = max(getIntervalPPS(complement_interval_pps, timestamp_next_pkt), 10)
|
|
|
|
|
|
+ pps = max(get_interval_pps(complement_interval_pps, timestamp_next_pkt), 10)
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]# float(timeSteps.random())
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]# float(timeSteps.random())
|
|
|
|
|
|
# Reply
|
|
# Reply
|
|
@@ -378,7 +379,7 @@ class EternalBlueExploit(BaseAttack.BaseAttack):
|
|
|
|
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
new_pkt = (eth_frame / ip_pkt / tcp_pkt)
|
|
|
|
|
|
- pps = max(getIntervalPPS(complement_interval_pps, timestamp_next_pkt), 10)
|
|
|
|
|
|
+ pps = max(get_interval_pps(complement_interval_pps, timestamp_next_pkt), 10)
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]# float(timeSteps.random())
|
|
timestamp_next_pkt = update_timestamp(timestamp_next_pkt, pps) + inter_arrival_times[pkt_num]# float(timeSteps.random())
|
|
|
|
|
|
new_pkt.time = timestamp_next_pkt
|
|
new_pkt.time = timestamp_next_pkt
|