import ID2TLib.TestLibrary as Lib
import Test.ID2TAttackTest as Test

sha_default = '5a997aa3e1be1a34b46ea3308fece71336fae5f47e45d7ef4b26a8e4982f21e3'
sha_ips_not_in_pcap = '32919a785133574c536ea383dce70874b76d60a5c41679b94822177acd6263b1'
sha_multiple_params = '07eb84bd0cb695012d2d4aa5b3ba7943e4eadbc86dd538bbc64f6768a3516d8d'

# TODO: improve coverage


class UnitTestEternalBlue(Test.ID2TAttackTest):
    def test_eternalblue_default(self):
        self.checksum_test([['EternalBlueExploit']], sha_default)

    def test_eternalblue_ips_not_in_pcap(self):
        self.checksum_test([['EternalBlueExploit', 'ip.src=1.1.1.1', 'ip.dst=2.2.2.2']], sha_ips_not_in_pcap)

    def test_eternalblue_multiple_params(self):
        ip_src = 'ip.src=' + Lib.test_pcap_ips[0]
        ip_dst = 'ip.dst=' + Lib.test_pcap_ips[1]
        self.checksum_test([['EternalBlueExploit', ip_src, ip_dst, 'mac.src=00:0C:21:1C:60:61',
                             'mac.dst=04:0C:32:2C:63:62', 'port.src=1337', 'port.dst=42']], sha_multiple_params)

    def test_eternalblue_order(self):
        self.order_test([['EternalBlueExploit']])
