Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scapy get packet destination port python

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

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

src_port = tcp_hdr.sport		# Get source port
dst_port = tcp_hdr.dport		# Get destination port
Comment

PREVIOUS NEXT
Code Example
Python :: add tab to python output 
Python :: defining a class in python 
Python :: flask make_response render_template 
Python :: python match object 
Python :: raspberry pi pwm controlled leds 
Python :: pytghon 
Python :: how can you make a data fram 
Python :: Errors that you will get in the Time class in Python DateTime 
Python :: test python package without rebuilding 
Python :: remove special characters and numbers from string python 
Python :: python as integer ratio 
Python :: reloading a django view function withouit resetting context data 
Python :: forward fill in pyspark 
Python :: Horizontal stacked bar chart with annotations 
Python :: svm classification involving pipelines 
Python :: colab show all value 
Python :: specifying random columns in numpy 
Python :: fizzbuzz algorithm 
Python :: how to count the repeatance of every string in a list python 
Python :: python concurrent.futures.ProcessPoolExecutor multiple arguments 
Python :: How to combine two or more querysets in a Django view? 
Python :: Drop multiple consecutive columns 
Python :: python loop through specific angle 
Python :: python kdtree import 
Python :: como tornar uma string numa lista 
Python :: Subtract layers 
Python :: how to stop gambling 
Python :: how to check what version of pygame you have instaled 
Python :: dashbars detect first loop 
Python :: autoencoder for classification keras 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =