diff --git a/.gitignore b/.gitignore index f375495..354c085 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ dist/ .ruff_cache .pytest_cache tmp/ +*.csv diff --git a/pcapprocessor/metrics_calculator/metrics.py b/pcapprocessor/metrics_calculator/metrics.py index c5f8620..a5fe0fb 100644 --- a/pcapprocessor/metrics_calculator/metrics.py +++ b/pcapprocessor/metrics_calculator/metrics.py @@ -1,2 +1,6 @@ +from dataclasses import dataclass + + +@dataclass class Metrics(object): throughput = None \ No newline at end of file diff --git a/pcapprocessor/pcapprocessor.py b/pcapprocessor/pcapprocessor.py index c207d6d..ea61191 100644 --- a/pcapprocessor/pcapprocessor.py +++ b/pcapprocessor/pcapprocessor.py @@ -1,9 +1,11 @@ from pathlib import Path +from typing import Dict import pyshark -from pcapprocessor.packet_collator import PacketCollator +from pcapprocessor.packet_collator.packet_collator import PacketCollator from pcapprocessor.metrics_calculator.metrics_calculator import MetricsCalculator +from render.render import Render class PcapProcessor: @@ -13,8 +15,11 @@ def __init__(self, pcap_file_path: str, unit: str): def process(self) -> pyshark.FileCapture: packet_stream: pyshark.FileCapture = pyshark.FileCapture( - self.pcap_file_path, keep_packets=False + self.pcap_file_path.as_posix(), keep_packets=False ) packet_collator_obj = PacketCollator(packet_stream=packet_stream) packet_collator_obj: PacketCollator = packet_collator_obj.collate() - metrics_calculator_obj: MetricsCalculator = MetricsCalculator(packet_collator_obj.__dict__) + metrics_calculator_obj: MetricsCalculator = MetricsCalculator(**packet_collator_obj.__dict__) + metrics: Dict = metrics_calculator_obj.__dict__ + viz_obj: Render = Render(data=metrics) + viz_obj.viz() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0523b46..2eed295 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ seaborn==0.12.2 pyshark==0.5.3 setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability pydantic==1.10.6 - +dash==2.8.1