traffic-taffy 0.9.5__py3-none-any.whl → 0.9.7__py3-none-any.whl
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/__init__.py +1 -1
- traffic_taffy/dissection.py +0 -12
- traffic_taffy/dissector.py +3 -5
- traffic_taffy/dissector_engine/scapy.py +2 -0
- traffic_taffy/hooks/blag.py +51 -0
- traffic_taffy/hooks/ip2asn.py +2 -2
- traffic_taffy/tools/dissect.py +11 -2
- {traffic_taffy-0.9.5.dist-info → traffic_taffy-0.9.7.dist-info}/METADATA +4 -3
- {traffic_taffy-0.9.5.dist-info → traffic_taffy-0.9.7.dist-info}/RECORD +12 -11
- {traffic_taffy-0.9.5.dist-info → traffic_taffy-0.9.7.dist-info}/WHEEL +1 -1
- {traffic_taffy-0.9.5.dist-info → traffic_taffy-0.9.7.dist-info}/licenses/LICENSE.txt +1 -1
- {traffic_taffy-0.9.5.dist-info → traffic_taffy-0.9.7.dist-info}/entry_points.txt +0 -0
traffic_taffy/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__VERSION__ = "0.9.
|
1
|
+
__VERSION__ = "0.9.7"
|
traffic_taffy/dissection.py
CHANGED
@@ -134,8 +134,6 @@ class Dissection:
|
|
134
134
|
# note: there should be no recorded tcpdump files from 1970 Jan 01 :-)
|
135
135
|
self.data[0][key][value] += count
|
136
136
|
if self.timestamp:
|
137
|
-
if self.timestamp not in self.data:
|
138
|
-
self.data[self.timestamp] = defaultdict(Counter)
|
139
137
|
self.data[self.timestamp][key][value] += count
|
140
138
|
|
141
139
|
def calculate_metadata(self: Dissection) -> None:
|
@@ -159,16 +157,6 @@ class Dissection:
|
|
159
157
|
for timestamp in other_dissection.data:
|
160
158
|
for key in other_dissection.data[timestamp]:
|
161
159
|
for subkey in other_dissection.data[timestamp][key]:
|
162
|
-
# TODO(hardaker): this is horribly inefficient
|
163
|
-
if timestamp not in self.data:
|
164
|
-
self.data[timestamp] = defaultdict(Counter)
|
165
|
-
elif key not in self.data[timestamp]:
|
166
|
-
self.data[timestamp][key] = Counter()
|
167
|
-
elif (
|
168
|
-
isinstance(self.data[timestamp][key], dict)
|
169
|
-
and subkey not in self.data[timestamp][key]
|
170
|
-
):
|
171
|
-
self.data[timestamp][key][subkey] = 0
|
172
160
|
self.data[timestamp][key][subkey] += other_dissection.data[
|
173
161
|
timestamp
|
174
162
|
][key][subkey]
|
traffic_taffy/dissector.py
CHANGED
@@ -259,16 +259,14 @@ class PCAPDissector:
|
|
259
259
|
match_expression: str | None = None,
|
260
260
|
) -> None:
|
261
261
|
"""Output the results in an FSDB file."""
|
262
|
-
if timestamps is None:
|
263
|
-
timestamps = [0]
|
264
262
|
import pyfsdb
|
265
263
|
|
266
264
|
fh = pyfsdb.Fsdb(
|
267
265
|
out_file_handle=sys.stdout,
|
268
|
-
out_column_names=["key", "subkey", "value"],
|
266
|
+
out_column_names=["timestamp", "key", "subkey", "value"],
|
269
267
|
converters={"value": int},
|
270
268
|
)
|
271
|
-
for
|
269
|
+
for timestamp, key, subkey, value in self.dissection.find_data(
|
272
270
|
timestamps=timestamps,
|
273
271
|
match_string=match_string,
|
274
272
|
match_value=match_value,
|
@@ -276,7 +274,7 @@ class PCAPDissector:
|
|
276
274
|
make_printable=True,
|
277
275
|
match_expression=match_expression,
|
278
276
|
):
|
279
|
-
fh.append([key, subkey, value])
|
277
|
+
fh.append([timestamp, key, subkey, value])
|
280
278
|
fh.close()
|
281
279
|
|
282
280
|
|
@@ -113,6 +113,8 @@ class DissectionEngineScapy(DissectionEngine):
|
|
113
113
|
|
114
114
|
try:
|
115
115
|
field_value = getattr(layer, field_name)
|
116
|
+
if not field_value: ## can return empty field values like []
|
117
|
+
continue
|
116
118
|
if hasattr(field_value, "fields"):
|
117
119
|
self.add_layer(field_value, new_prefix + "_")
|
118
120
|
else:
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"""Traffic-Taffy plugin to look up addresses in the BLAG blocklist."""
|
2
|
+
from blagbl import BlagBL
|
3
|
+
import ipaddress
|
4
|
+
|
5
|
+
from traffic_taffy.hooks import register_hook
|
6
|
+
from traffic_taffy.dissector import POST_DISSECT_HOOK, INIT_HOOK
|
7
|
+
from traffic_taffy.dissection import Dissection
|
8
|
+
|
9
|
+
blag = None
|
10
|
+
blag_ips = None
|
11
|
+
|
12
|
+
|
13
|
+
@register_hook(INIT_HOOK)
|
14
|
+
def init_blag(**kwargs):
|
15
|
+
"""Initialize the BLAG block list table."""
|
16
|
+
global blag
|
17
|
+
global blag_ips
|
18
|
+
|
19
|
+
if blag is None:
|
20
|
+
blag = BlagBL()
|
21
|
+
blag.parse_blag_contents()
|
22
|
+
blag_ips = blag.ips
|
23
|
+
|
24
|
+
|
25
|
+
@register_hook(POST_DISSECT_HOOK)
|
26
|
+
def ip_blagbl_lookup(dissection: Dissection, **kwargs):
|
27
|
+
"""Perform IP address lookups within the BLAG block list."""
|
28
|
+
timestamps = dissection.data.keys()
|
29
|
+
|
30
|
+
for timestamp in timestamps:
|
31
|
+
keys = list(dissection.data[timestamp].keys())
|
32
|
+
|
33
|
+
for key in keys:
|
34
|
+
key = str(key)
|
35
|
+
if (
|
36
|
+
key.endswith("IP_src") or key.endswith("IP_dst")
|
37
|
+
# or key.endswith("IPv6_src")
|
38
|
+
# or key.endswith("IPv6_dst")
|
39
|
+
):
|
40
|
+
for value in dissection.data[timestamp][key]:
|
41
|
+
try:
|
42
|
+
value = str(ipaddress.IPv4Address(value))
|
43
|
+
except Exception:
|
44
|
+
continue
|
45
|
+
count = dissection.data[timestamp][key][value]
|
46
|
+
|
47
|
+
if value in blag_ips:
|
48
|
+
for blocklist in blag_ips[value]:
|
49
|
+
dissection.data[timestamp][key + "_blocklist"][
|
50
|
+
blocklist
|
51
|
+
] += count
|
traffic_taffy/hooks/ip2asn.py
CHANGED
@@ -9,7 +9,7 @@ from traffic_taffy.taffy_config import taffy_default, TaffyConfig
|
|
9
9
|
|
10
10
|
i2a = None
|
11
11
|
|
12
|
-
taffy_default("modules.ip2asn.database",
|
12
|
+
taffy_default("modules.ip2asn.database", ip2asn.DEFAULT_IP2ASN_FILE)
|
13
13
|
|
14
14
|
|
15
15
|
@register_hook(INIT_HOOK)
|
@@ -20,7 +20,7 @@ def init_ip2asn(**kwargs):
|
|
20
20
|
config = TaffyConfig()
|
21
21
|
db_path = config.get_dotnest("modules.ip2asn.database")
|
22
22
|
|
23
|
-
if not Path(db_path).exists():
|
23
|
+
if db_path and not Path(db_path).exists():
|
24
24
|
error("The ip2asn plugin requires a ip2asn-combined.tsv in this directory")
|
25
25
|
error("Please download it from https://iptoasn.com/")
|
26
26
|
|
traffic_taffy/tools/dissect.py
CHANGED
@@ -43,6 +43,12 @@ def dissect_parse_args() -> Namespace:
|
|
43
43
|
help="Print results in an FSDB formatted output",
|
44
44
|
)
|
45
45
|
|
46
|
+
parser.add_argument(
|
47
|
+
"-t", "--fsdb-all-timestamps",
|
48
|
+
action="store_true",
|
49
|
+
help="Print FSDB that includes all timestamps",
|
50
|
+
)
|
51
|
+
|
46
52
|
parser.add_argument(
|
47
53
|
"--dont-fork",
|
48
54
|
action="store_true",
|
@@ -89,9 +95,12 @@ def main() -> None:
|
|
89
95
|
pd.dissection = dissection
|
90
96
|
|
91
97
|
# output as requested
|
92
|
-
if args.fsdb:
|
98
|
+
if args.fsdb or args.fsdb_all_timestamps:
|
99
|
+
timestamps = [0]
|
100
|
+
if args.fsdb_all_timestamps:
|
101
|
+
timestamps = None
|
93
102
|
pd.print_to_fsdb(
|
94
|
-
timestamps
|
103
|
+
timestamps,
|
95
104
|
match_string=args.match_string,
|
96
105
|
match_value=args.match_value,
|
97
106
|
minimum_count=args.minimum_count,
|
@@ -1,10 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: traffic-taffy
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.7
|
4
4
|
Summary: A tool for doing differential analysis of pcap files
|
5
5
|
Project-URL: Homepage, https://traffic-taffy.github.io/
|
6
6
|
Author-email: Wes Hardaker <opensource@hardakers.net>
|
7
7
|
License-File: LICENSE.txt
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
8
9
|
Classifier: Operating System :: OS Independent
|
9
10
|
Classifier: Programming Language :: Python :: 3
|
10
11
|
Requires-Python: >=3.7
|
@@ -13,7 +14,7 @@ Requires-Dist: cryptography
|
|
13
14
|
Requires-Dist: dnssplitter
|
14
15
|
Requires-Dist: dotnest>=1.0
|
15
16
|
Requires-Dist: dpkt
|
16
|
-
Requires-Dist: ip2asn
|
17
|
+
Requires-Dist: ip2asn>=1.6.6
|
17
18
|
Requires-Dist: msgpack
|
18
19
|
Requires-Dist: pandas
|
19
20
|
Requires-Dist: pcap-parallel
|
@@ -1,10 +1,10 @@
|
|
1
|
-
traffic_taffy/__init__.py,sha256=
|
1
|
+
traffic_taffy/__init__.py,sha256=KrTiNpk5yqhV4Br8BI-UzCx2ZR98WVKivhHFc_1856k,22
|
2
2
|
traffic_taffy/compare.py,sha256=g9rU6oa_2Wy0nUJ7K6TI8JTctyGCRvYEUakDBf7blOY,8644
|
3
3
|
traffic_taffy/comparison.py,sha256=KJxOp4UqhfRkF4LI1PMDRIefeyTm2w5sbdr7VUTS4KM,1451
|
4
4
|
traffic_taffy/config.py,sha256=DgTu2kA1Ec4Hbwl_44kTsdyJYvxAabgJk9a7aOH2XXU,4444
|
5
|
-
traffic_taffy/dissection.py,sha256=
|
5
|
+
traffic_taffy/dissection.py,sha256=DNxcXoNyk2lpJiaSzvAq1YHwHhYPY6xtlVkHTs-eb9Q,23904
|
6
6
|
traffic_taffy/dissectmany.py,sha256=SWFXFyERNCi0j7hiMDEeJJdPYDpa0SOlSj1V8AqpXUA,5189
|
7
|
-
traffic_taffy/dissector.py,sha256=
|
7
|
+
traffic_taffy/dissector.py,sha256=9QwGMGugHzVE8GWRpsfPXfSj02Sm2i_ZNU0Ah9AZ7BI,15654
|
8
8
|
traffic_taffy/graph.py,sha256=EfkxH5D9PNlDpvftkh9GyUusV05EV537QGB7JOMeW4w,4730
|
9
9
|
traffic_taffy/graphdata.py,sha256=r_QNXO3FzC7Vx4123SdCliAh7j2NCQ4Lb5uoOJnlt2M,3376
|
10
10
|
traffic_taffy/report.py,sha256=Yzb27hUWcWL-RxWpSQmRyM8NyWxQGT0l0jUCGHoYDSY,224
|
@@ -18,9 +18,10 @@ traffic_taffy/algorithms/statistical.py,sha256=0Hr62ZUZlFCNPUh6yVBRFjNho42cTGeX_
|
|
18
18
|
traffic_taffy/dissector_engine/__init__.py,sha256=Hu-UQtz7yhivmQLUP5b8tFQLEhy2bfvrRV3Q4aZp6vg,2202
|
19
19
|
traffic_taffy/dissector_engine/dnstap.py,sha256=rBzVlB0D3YVhHOsr17cbnCIZU13g20srgR4sE7ZfNUE,4810
|
20
20
|
traffic_taffy/dissector_engine/dpkt.py,sha256=q7cJz6WWpe9xUcEbAY_yn_cma_4loXuS3QKIVln6FHQ,12788
|
21
|
-
traffic_taffy/dissector_engine/scapy.py,sha256=
|
21
|
+
traffic_taffy/dissector_engine/scapy.py,sha256=S3yrUmSeDjt3oE1I07L3iLFLF8Df8XAZg535FY_eu90,5004
|
22
22
|
traffic_taffy/hooks/__init__.py,sha256=Bvhl6RnyBqQkWuCU6TS0O_ZHe4qCQsC4HE8FELigWPw,661
|
23
|
-
traffic_taffy/hooks/
|
23
|
+
traffic_taffy/hooks/blag.py,sha256=KWFhDYbH8sRcUsujCSdlycE0pYkX5ymyRRbHxi20z3U,1626
|
24
|
+
traffic_taffy/hooks/ip2asn.py,sha256=G7zo2lFRLK-fbbzGMMcsaxIIh9ME6BoM0E6cJDaeE18,2233
|
24
25
|
traffic_taffy/hooks/labels.py,sha256=5jHXq3-kxDQj9PRYgak-gDzE8dvSUiCEq9mBs9nE014,1933
|
25
26
|
traffic_taffy/hooks/psl.py,sha256=A3maHS9FOholOEv1LuX0xSO3u34GyqeYl9_EtJG1pMY,2119
|
26
27
|
traffic_taffy/iana/tables.msgpak,sha256=d-R5Xw9yG9t4RqGJRrpE6cjH4YfaxQBwQiBhNjKZbwI,172825
|
@@ -47,12 +48,12 @@ traffic_taffy/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
47
48
|
traffic_taffy/tools/cache_info.py,sha256=ZanO6jDlTdfJ7w0N_7BkLyJj4NyZGShaH7SrUulbIoE,2085
|
48
49
|
traffic_taffy/tools/compare.py,sha256=oT5fIqfPeY6nGI9vSVAoKDsAVzzqfXJDzyOw2BhPfSI,3509
|
49
50
|
traffic_taffy/tools/config.py,sha256=RwJYyfI1yiAKbMzU5mcPTguBiH-hGRy5vk_YvAAjPuM,2343
|
50
|
-
traffic_taffy/tools/dissect.py,sha256=
|
51
|
+
traffic_taffy/tools/dissect.py,sha256=kGG0K2d9-OwrAhEU97id2m29PvhYaXZYIw1nLi1aVsE,3346
|
51
52
|
traffic_taffy/tools/explore.py,sha256=gUcOfAgangJJI1si1gLPUoWRUKmWUAXSP0oTD2JJygw,24149
|
52
53
|
traffic_taffy/tools/export.py,sha256=9zBBGhZK95b4ZiLJ8XK30GPsaBjgR84Sk1HoPIxRpTI,2844
|
53
54
|
traffic_taffy/tools/graph.py,sha256=KiKDY9R8JLT5-JouANoi_1WGcdFMhXsLnYlhPsFRWpM,2316
|
54
|
-
traffic_taffy-0.9.
|
55
|
-
traffic_taffy-0.9.
|
56
|
-
traffic_taffy-0.9.
|
57
|
-
traffic_taffy-0.9.
|
58
|
-
traffic_taffy-0.9.
|
55
|
+
traffic_taffy-0.9.7.dist-info/METADATA,sha256=JBugfulFVW9XOxNcx9vjDPyVIkWN4F8AAvT5qTewBBk,2311
|
56
|
+
traffic_taffy-0.9.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
57
|
+
traffic_taffy-0.9.7.dist-info/entry_points.txt,sha256=F0lqjvw94nQ3hY4eerN7faT9aKhhGUHbqBhuEr9q1r8,361
|
58
|
+
traffic_taffy-0.9.7.dist-info/licenses/LICENSE.txt,sha256=eFp2vwcZFJW55SUQRoEfXio3K9XdwvsaI_WHntR7I2M,11338
|
59
|
+
traffic_taffy-0.9.7.dist-info/RECORD,,
|
File without changes
|