Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

describe the main employment rights as stated in the law

Answered: 1 week ago