Validate that the packet is an IPv4/IPv6 and TCP packet. If the packet is valid, a copy is returned. If not, TypeError is raised.
(pkt)
| 602 | |
| 603 | |
| 604 | def validate_packet(pkt): |
| 605 | """ |
| 606 | Validate that the packet is an IPv4/IPv6 and TCP packet. |
| 607 | If the packet is valid, a copy is returned. If not, TypeError is raised. |
| 608 | """ |
| 609 | pkt = pkt.copy() |
| 610 | valid = pkt.haslayer(TCP) and (pkt.haslayer(IP) or pkt.haslayer(IPv6)) |
| 611 | if not valid: |
| 612 | raise TypeError("Not a TCP/IP packet") |
| 613 | return pkt |
| 614 | |
| 615 | |
| 616 | def detect_win_multi(ts): |
no test coverage detected