diff --git a/src/sniffer.py b/src/sniffer.py index 7afb153..1b244f1 100644 --- a/src/sniffer.py +++ b/src/sniffer.py @@ -50,7 +50,33 @@ class Sniffer: def parse_sniff(self, full_filepath): 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): stdout, stderr, code = run_cmd( f"rm -rf {self.base_dir}" )