Skip to content

Instantly share code, notes, and snippets.

@An4ndita
Created November 11, 2020 07:25
Show Gist options
  • Save An4ndita/952decd46ea0b9742c65c7922a0dad8b to your computer and use it in GitHub Desktop.
Save An4ndita/952decd46ea0b9742c65c7922a0dad8b to your computer and use it in GitHub Desktop.
# to check whether a packet contains the HTTP layer or not
if pkt_scapy.haslayer(scapy.Raw):
# checking if the destination port is 80, it means that the packet is leaving from our computer and going towards the http port
if pkt_scapy[scapy.TCP].dport == 80:
print("[*] This is an HTTP REQUEST ")
# checking if the source port is 80, it means this packet is leaving from the http port
elif pkt_scapy(scapy.TCP).sport == 80:
print("[*] This is an HTTP Response ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment