当前位置:网站首页>Pyshark tutorial
Pyshark tutorial
2022-06-21 06:11:00 【Charming pie star】
install
pip install pyshark
Use
for example : Analyze existing pcap file :
import pyshark
pcap = pyshark.FileCapture("test1.pcap", tshark_path="/Applications/Wireshark.app/Contents/MacOS/tshark")
The two parameters specify the input file and tshark route
then , You can use loop traversal pcap file ( You can also use subscripts ):
for p in pcap:
print(p)
Output structure and wireshark What you see is consistent , give the result as follows :
If you want to see it alone IP Layer or TCP or UDP In the words of the first floor , It only needs :
print(pcap[0].ip)
Output :
With IP Layer as an example , If you want to extract one of these parameters separately :
print(pcap[0].ip.src)
print(pcap[0].ip.ttl)
print(pcap[0].ip.version)
print(pcap[0].ip.proto)
Output is as follows :
How to see pcap What fields are available for the object ? Yes pcap Object use dir() Function :
print(dir(pcap[0]))
give the result as follows :
Empathy , How to see what fields are available in a certain layer ? With IP Layer as an example :
print(dir(pcap[0].ip))
Output is as follows :
summary
It is OK for daily use , But the speed is average
边栏推荐
- UVC sterilization lamp with integrated sterilization, deodorization and odor removal
- 397 linked list (206. reverse linked list & 24. exchange nodes in the linked list in pairs & 19. delete the penultimate node of the linked list & interview question 02.07. link list intersection & 142
- LED lamp applied in LED plant lighting
- Quartz. Net getting started
- Leetcode question brushing - (4) the first unique character in the string
- R统计绘图-环境因子相关性+mantel检验组合图(linkET包介绍1)
- tf.compat.v1.global_variables_initializer
- pyshark使用教程
- Aurora8b10b IP usage-05-transceiver test application example
- tf. AUTO_ Reuse effect
猜你喜欢

Copy the code generated by the code generator to the idea. How to solve the error reported by the web address after running

sqli-labs-17

复制 代码生成器 生成的代码到idea中,运行后网址报错怎么解决

IP - 射频数据转换器 -04- API使用指南 - 系统设置相关函数

simple_ JS attack and defense world

Aurora8B10B IP使用 -01- 简介与端口描述
![[MySQL] SQL statement execution process of MySQL](/img/c8/76726de7ae3521f709e336a60ae3a2.png)
[MySQL] SQL statement execution process of MySQL

Aurora8b10b IP use-04-ip routine application example

用代码生成器 生成代码后复制完成,在网页上不显示模块

【数据挖掘】期末复习 第四章
随机推荐
上手自定义线程池
完善业务细节
Laravel
Leetcode刷题 ——— (4)字符串中的第一个唯一字符
Which of the children's critical illness insurance companies has the highest cost performance in 2022?
Get string byte size
Metasploit入侵win7
sqli-labs23
ReturnType
Basic operation of binary sort tree
Picture steganography: Method 1
LED lamp applied in LED plant lighting
Le premier caractère unique de la chaîne (4)
模块 14 - 15:网络应用通信考试
sqli-labs-17
复制 代码生成器 生成的代码到idea中,运行后网址报错怎么解决
数字信号处理-07-DDS IP应用实例
Broadcast mechanism of numpy
Aurora8b10b IP use-04-ip routine application example
平衡二叉树详解 通俗易懂