|
| 1 | +# Uncomment them and run according to the tutorial |
| 2 | +#from scapy.all import IP, TCP, send, UDP |
| 3 | + |
| 4 | +# # Step 1: Creating a simple IP packet |
| 5 | +# packet = IP(dst="192.168.1.1") # Setting the destination IP |
| 6 | +# packet = IP(dst="192.168.1.1") / TCP(dport=80, sport=12345, flags="S") |
| 7 | +# print(packet.show()) # Display packet details |
| 8 | +# send(packet) |
| 9 | + |
| 10 | + |
| 11 | +############ |
| 12 | +# from scapy.all import ICMP |
| 13 | + |
| 14 | +# # Creating an ICMP Echo request packet |
| 15 | +# icmp_packet = IP(dst="192.168.1.1") / ICMP() |
| 16 | +# send(icmp_packet) |
| 17 | + |
| 18 | + |
| 19 | +############ |
| 20 | +# from scapy.all import UDP |
| 21 | + |
| 22 | +# # Creating a UDP packet |
| 23 | +# udp_packet = IP(dst="192.168.1.1") / UDP(dport=53, sport=12345) |
| 24 | +# send(udp_packet) |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +########### |
| 29 | +# blocked_packet = IP(dst="192.168.1.1") / TCP(dport=80, flags="S") |
| 30 | +# send(blocked_packet) |
| 31 | + |
| 32 | +# allowed_packet = IP(dst="192.168.1.1") / UDP(dport=53) |
| 33 | +# send(allowed_packet) |
| 34 | + |
0 commit comments