# -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 10:08:09 2019
@author: Lmindy
about extract udp attributes
"""
import csv
from scapy.all import *
import pandas as pd
import re
import os
import numpy as np
pkts = rdpcap("udp.pcap")
i=0
j=0
b=[]
e=[]
for pkt in pkts:
if 'Ethernet' in pkt:
a1=pkt['Ethernet'].dst
a2=pkt['Ethernet'].src
a3=pkt['Ethernet'].type
if 'UDP' in pkt:
c1=pkt['UDP'].sport
c2=pkt['UDP'].dport
c3=pkt['UDP'].len
c4=pkt['UDP'].chksum
if 'IPv6' in pkt:
b1=pkt['IPv6'].version
b2=pkt['IPv6'].tc
b3=pkt['IPv6'].fl
b4
python 提取 UDP.pcap 存成CSV
最新推荐文章于 2023-03-14 15:38:52 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)