Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

scapy get packet source ip address python

from scapy.all import *
from scapy.layers.inet import IP

pkts = rdpcap("path/to/pcap_file")
pkt1 = pkts[0]			# Get first packet
ip_hdr = pkt1[IP]

src_ip = ip_hdr.src		# Get source ip
dst_p = ip_hdr.dst		# Get destination ip
 
PREVIOUS NEXT
Tagged: #scapy #packet #source #ip #address #python
ADD COMMENT
Topic
Name
9+1 =