traffic-taffy 0.9.3__tar.gz → 0.9.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/PKG-INFO +1 -1
- traffic_taffy-0.9.4/traffic_taffy/__init__.py +1 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/statistical.py +3 -3
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissector_engine/dpkt.py +29 -9
- traffic_taffy-0.9.4/traffic_taffy/report.py +12 -0
- traffic_taffy-0.9.4/traffic_taffy/tests/test_dpkt_engine.py +15 -0
- traffic_taffy-0.9.3/traffic_taffy/__init__.py +0 -1
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/.gitignore +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/LICENSE.txt +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/README.md +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/pyproject.toml +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/comparecorrelation.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/comparecorrelationchanges.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/compareseries.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/compareslices.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/compare.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/comparison.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/config.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissection.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissectmany.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissector.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissector_engine/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissector_engine/dnstap.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/dissector_engine/scapy.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/graph.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/graphdata.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/hooks/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/hooks/ip2asn.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/hooks/labels.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/hooks/psl.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/iana/tables.msgpak +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/output/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/output/console.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/output/fsdb.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/output/memory.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/reports/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/reports/compareslicesreport.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/reports/correlationchangereport.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/reports/correlationreport.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/taffy_config.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_compare_results.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_config.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_dict_merge.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_global_config.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_hooks.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_normalize.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_pcap_dissector.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_pcap_splitter.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_splitter.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tests/test_value_printing.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/__init__.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/cache_info.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/compare.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/config.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/dissect.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/explore.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/export.py +0 -0
- {traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/tools/graph.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "0.9.4"
|
@@ -65,7 +65,7 @@ class ComparisonStatistical(ComparisonSlicesAlgorithm):
|
|
65
65
|
right_count = right_side[key][subkey]
|
66
66
|
left_percentage = 0.0
|
67
67
|
if right_side_total == 0:
|
68
|
-
right_percentage =
|
68
|
+
right_percentage = 1.0
|
69
69
|
else:
|
70
70
|
right_percentage = right_side[key][subkey] / right_side_total
|
71
71
|
new_right_count += 1 # this value wasn't in the left
|
@@ -81,12 +81,12 @@ class ComparisonStatistical(ComparisonSlicesAlgorithm):
|
|
81
81
|
)
|
82
82
|
|
83
83
|
if right_side_total == 0:
|
84
|
-
right_percent =
|
84
|
+
right_percent = 1.0
|
85
85
|
else:
|
86
86
|
right_percent = new_right_count / right_side_total
|
87
87
|
|
88
88
|
if left_side_total == 0:
|
89
|
-
left_percent =
|
89
|
+
left_percent = 1.0
|
90
90
|
else:
|
91
91
|
left_percent = new_left_count / left_side_total
|
92
92
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
-
from logging import debug
|
5
|
+
from logging import debug, error
|
6
6
|
from traffic_taffy.dissector_engine import DissectionEngine
|
7
7
|
from traffic_taffy.dissection import Dissection, PCAPDissectorLevel
|
8
8
|
from pcap_parallel import PCAPParallel
|
@@ -20,6 +20,7 @@ class DissectionEngineDpkt(DissectionEngine):
|
|
20
20
|
def __init__(self, *args: list, **kwargs: dict):
|
21
21
|
"""Create a dissection engine for quickly parsing and counting packets."""
|
22
22
|
super().__init__(*args, **kwargs)
|
23
|
+
self.data_link_type = None
|
23
24
|
|
24
25
|
def load_data(self) -> None:
|
25
26
|
"""Load the specified PCAP into memory."""
|
@@ -29,6 +30,9 @@ class DissectionEngineDpkt(DissectionEngine):
|
|
29
30
|
else:
|
30
31
|
# it's an open handle already
|
31
32
|
pcap = dpkt.pcap.Reader(self.pcap_file)
|
33
|
+
|
34
|
+
self.data_link_type = pcap.datalink()
|
35
|
+
|
32
36
|
if self.pcap_filter:
|
33
37
|
pcap.setfilter(self.pcap_filter)
|
34
38
|
pcap.dispatch(self.maximum_count, self.callback)
|
@@ -144,14 +148,30 @@ class DissectionEngineDpkt(DissectionEngine):
|
|
144
148
|
level = level.value
|
145
149
|
|
146
150
|
if level >= PCAPDissectorLevel.THROUGH_IP.value:
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
151
|
+
if self.data_link_type == 1:
|
152
|
+
# Ethernet based encapsulation
|
153
|
+
eth = dpkt.ethernet.Ethernet(packet)
|
154
|
+
# these names are designed to match scapy names
|
155
|
+
self.incr("Ethernet_dst", eth.dst)
|
156
|
+
self.incr("Ethernet_src", eth.src)
|
157
|
+
self.incr("Ethernet_type", eth.type)
|
158
|
+
data = eth.data
|
159
|
+
elif self.data_link_type == 101:
|
160
|
+
# Raw IP encapsulation
|
161
|
+
if packet[0] == 0x45:
|
162
|
+
data = dpkt.ip.IP(packet)
|
163
|
+
elif packet[0] == 0x60:
|
164
|
+
data = dpkt.ip6.IP6(packet)
|
165
|
+
else:
|
166
|
+
error("Unknown IP version in data")
|
167
|
+
raise ValueError("unknown IP version")
|
168
|
+
else:
|
169
|
+
error(f"unknown link type: {self.data_link_type}")
|
170
|
+
raise ValueError("unknown link type")
|
171
|
+
|
172
|
+
# TODO(hardaker): add ip6.IP6 support
|
173
|
+
if isinstance(data, dpkt.ip.IP):
|
174
|
+
ip = data
|
155
175
|
udp = None
|
156
176
|
tcp = None
|
157
177
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import os
|
2
|
+
from traffic_taffy.dissection import PCAPDissectorLevel
|
3
|
+
from traffic_taffy.dissector_engine.dpkt import DissectionEngineDpkt
|
4
|
+
|
5
|
+
def test_dpkt_engine():
|
6
|
+
test_pcap = "dns.pcap"
|
7
|
+
test_pcap = "port53-2023-30-31_20.pcap"
|
8
|
+
test_pcap = "airplane-wireless.pcap"
|
9
|
+
if not os.path.exists(test_pcap):
|
10
|
+
return
|
11
|
+
|
12
|
+
engine = DissectionEngineDpkt(test_pcap,
|
13
|
+
dissector_level = PCAPDissectorLevel.COMMON_LAYERS)
|
14
|
+
dissection = engine.load()
|
15
|
+
|
@@ -1 +0,0 @@
|
|
1
|
-
__VERSION__ = "0.9.3"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/algorithms/comparecorrelationchanges.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{traffic_taffy-0.9.3 → traffic_taffy-0.9.4}/traffic_taffy/reports/correlationchangereport.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|