Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how do I get data from a pcap file to use in csv code for python. I have to output everything in csv. I have
how do I get data from a pcap file to use in csv code for python. I have to output everything in csv. I have this so far but I'm not seeing the pcap data in the csv file.
File Edit Format Run Options Window Help the desktop=os.path.join ('C: \\uers', getpass.getuser (), 'Desktop') os. chdir (the_desktop) \#generates the file path for the new file with open('alert_data.csv', ' w ') as f:#writes the new excel file and gives these | f.write('Dat/Time, Priority,Classification, Description, Source IP, Destinatic With open('fast_short.pcap', 'r') as f : for 1 in f: splitl=i.split('[*x]') \#takes the date and time out of the first part date time=splitl[0] \#splits up the date and time from other sections date=date_time [:5] \#date only time=date_time [6:11]# time only split2=splitl[1].split(']')\#strips down the date time priority=split2[1].strip()\#strips down the priority section split3=splitl [2] split ('] [') classification=split3[0] \#notes where the claffication category is classification=classification.strip('[') \#strips down the element classification=classification [16:] \#the classifcation is 16 through
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started