adding a version of parse_sniffer, I want to go back and clean this up l8r
This commit is contained in:
parent
d001b5c825
commit
6e0f9388f4
@ -50,7 +50,33 @@ class Sniffer:
|
|||||||
|
|
||||||
def parse_sniff(self, full_filepath):
|
def parse_sniff(self, full_filepath):
|
||||||
with open(full_filepath,'r') as file:
|
with open(full_filepath,'r') as file:
|
||||||
return csv.DictReader(file)
|
file_data = []
|
||||||
|
for item in csv.reader(file):
|
||||||
|
file_data.append(item)
|
||||||
|
print(file_data)
|
||||||
|
|
||||||
|
template = []
|
||||||
|
sniff_data = []
|
||||||
|
|
||||||
|
for line_index in range(len(file_data)):
|
||||||
|
line = file_data[line_index]
|
||||||
|
if line_index == 0:
|
||||||
|
continue
|
||||||
|
if line_index == 1:
|
||||||
|
for item in line:
|
||||||
|
template.append(item)
|
||||||
|
continue
|
||||||
|
temp = {}
|
||||||
|
if line == []:
|
||||||
|
break
|
||||||
|
for item_index in range(len(line)):
|
||||||
|
temp[template[item_index]] = line[item_index]
|
||||||
|
sniff_data.append(temp)
|
||||||
|
|
||||||
|
for packet in sniff_data:
|
||||||
|
print(packet)
|
||||||
|
return sniff_data
|
||||||
|
|
||||||
|
|
||||||
def destroy_sniffs(self):
|
def destroy_sniffs(self):
|
||||||
stdout, stderr, code = run_cmd( f"rm -rf {self.base_dir}" )
|
stdout, stderr, code = run_cmd( f"rm -rf {self.base_dir}" )
|
||||||
|
Loading…
Reference in New Issue
Block a user