Skip to content

Commit

Permalink
metrics updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lordlabakdas committed Mar 12, 2023
1 parent c43d496 commit 746dbcb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/
.ruff_cache
.pytest_cache
tmp/
*.csv
4 changes: 4 additions & 0 deletions pcapprocessor/metrics_calculator/metrics.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
from dataclasses import dataclass


@dataclass
class Metrics(object):
throughput = None
11 changes: 8 additions & 3 deletions pcapprocessor/pcapprocessor.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 746dbcb

Please sign in to comment.