Пример #1
0
    def runTest(self):
        pkt = Ether() / IP(src="192.168.1.1") / TCP() / "Ala ma kota"
        exp_pkt = Ether() / IP(src="192.168.1.1",
                               proto=55) / TCP() / "Ala ma kota"

        mask = Mask(exp_pkt)
        mask.set_do_not_care_scapy(IP, 'chksum')

        send_packet(self, (0, 1), pkt)
        verify_packets(self, mask, device_number=0, ports=[2])
Пример #2
0
    def runTest(self):
        client_packet = Ether() / IP(src="192.168.1.10", dst="192.168.1.1")
        server_packet = Ether() / IP(src="192.168.1.1", dst="192.168.1.10")

        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet(packet=pkt)
        self.verify_connection_state(conn_state=1)
        # TCP syn ack
        pkt = server_packet / TCP(sport=55, dport=80, flags="SA", chksum=0)
        self.send_server_packet(packet=pkt)
        self.verify_connection_state(conn_state=2)
        # TCP ack
        pkt = client_packet / TCP(sport=55, dport=80, flags="A", chksum=0)
        self.send_client_packet(packet=pkt)
        self.verify_connection_state(conn_state=3)
        # TCP data client
        pkt = client_packet / TCP(sport=55, dport=80, flags="A", chksum=0) / "Data data data"
        self.send_client_packet(packet=pkt)
        # TCP data server
        pkt = server_packet / TCP(sport=55, dport=80, flags="A", chksum=0) / "Data data data"
        self.send_server_packet(packet=pkt)
        # TCP fin ack
        pkt = client_packet / TCP(sport=55, dport=80, flags="FA", chksum=0)
        self.send_client_packet(packet=pkt)
        self.verify_connection_state(conn_state=0, conn_srv="0 0 0 0")
        # TCP ack
        pkt = server_packet / TCP(sport=55, dport=80, flags="A", chksum=0)
        self.send_server_packet(packet=pkt)
        # TCP fin ack
        pkt = server_packet / TCP(sport=55, dport=80, flags="FA", chksum=0)
        self.send_server_packet(packet=pkt)
        # TCP ack
        pkt = client_packet / TCP(sport=55, dport=80, flags="A", chksum=0)
        self.send_client_packet(packet=pkt)
Пример #3
0
    def runTest(self):
        pkt = Ether() / IP(src="192.168.1.1",
                           flags=0) / TCP() / "Ala a un chat"
        exp_pkt = Ether() / IP(src="192.168.1.1",
                               flags=7) / TCP() / "Ala a un chat"

        mask = Mask(exp_pkt)
        mask.set_do_not_care_scapy(IP, 'chksum')

        send_packet(self, (0, 1), pkt)
        verify_packets(self, mask, device_number=0, ports=[2])
Пример #4
0
    def runTest(self):
        client_packet = Ether() / IP(src="192.168.1.10", dst="192.168.1.1")
        server_packet = Ether() / IP(src="192.168.1.1", dst="192.168.1.10")

        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet(packet=pkt)
        # TCP syn ack
        pkt = server_packet / TCP(sport=55, dport=80, flags="SA", chksum=0)
        self.send_server_packet(packet=pkt)

        self.verify_connection_state(conn_state=2)
Пример #5
0
    def runTest(self):
        client_packet = Ether() / IP(src="192.168.1.10", dst="192.168.1.1")

        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet(packet=pkt)
        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet_no_receive(packet=pkt)
        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet_no_receive(packet=pkt)
        # TCP syn
        pkt = client_packet / TCP(sport=55, dport=80, flags="S", chksum=0)
        self.send_client_packet_no_receive(packet=pkt)
Пример #6
0
    def runTest(self):
        pkt = Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a')
        pkt /= IPv6(src='2001::1', dst='2001::2', fl=0, tc=0, hlim=64)
        pkt /= TCP(sport=1234, dport=80, flags='S')
        pkt /= "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"

        exp_pkt = Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a')
        exp_pkt /= IPv6(src='2001::1', dst='2001::2', fl=0, tc=0, hlim=7)
        exp_pkt /= TCP(sport=1234, dport=80, flags='S')
        exp_pkt /= "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"

        mask = Mask(exp_pkt)
        mask.set_do_not_care_scapy(TCP, 'chksum')

        send_packet(self, (0, 1), pkt)
        verify_packets(self, mask, device_number=0, ports=[2])