You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Reads a pcap file into python using scapy and produces a csv file as output in the following format: Timestamp, source MAC address, source IP address, Destination MAC address, Destination IP address
#modular design, which makes it easy to include this source into another program, or to extend this one
fromscapy.allimport*
defmain():
pcap_path=raw_input('Path of pcap file: ') # enter the path where you stored the pcap file
file_path=raw_input('Enter target file name') #enter the path where you want to create a csv file
process(pcap_path, file_path)
defprocess(pcap_path, file_path):
try:
file=open(file_path+'.csv','w') #tries to opens the file in read mode
pkts=rdpcap(pcap_path) #inbuilt function of scapy to read pcap files
foriinrange(len(pkts)):
ifARPinpkts[i]: #checks if the packet is an ARP packet or not