traffic-taffy 0.9.8__py3-none-any.whl → 0.9.9__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 CHANGED
@@ -1 +1 @@
1
- __VERSION__ = "0.9.8"
1
+ __VERSION__ = "0.9.9"
@@ -1,14 +1,20 @@
1
1
  """Traffic-Taffy plugin to look up addresses in the BLAG blocklist."""
2
+ from pathlib import Path
2
3
  from blagbl import BlagBL
4
+ import blagbl
3
5
  import ipaddress
6
+ from logging import error
4
7
 
5
8
  from traffic_taffy.hooks import register_hook
6
9
  from traffic_taffy.dissector import POST_DISSECT_HOOK, INIT_HOOK
7
10
  from traffic_taffy.dissection import Dissection
11
+ from traffic_taffy.taffy_config import taffy_default, TaffyConfig
8
12
 
9
13
  blag = None
10
14
  blag_ips = None
11
15
 
16
+ taffy_default("modules.blag.database", str(blagbl.DEFAULT_STORE.joinpath("blag.zip")))
17
+
12
18
 
13
19
  @register_hook(INIT_HOOK)
14
20
  def init_blag(**kwargs):
@@ -17,7 +23,14 @@ def init_blag(**kwargs):
17
23
  global blag_ips
18
24
 
19
25
  if blag is None:
20
- blag = BlagBL()
26
+ config = TaffyConfig()
27
+ blag_db_path = config.get_dotnest("modules.blag.database")
28
+
29
+ if blag_db_path and not Path(blag_db_path).exists():
30
+ error(f"The ip2asn plugin requires a blag.zip file in {blag_db_path}")
31
+ error("Please run blagbl --fetch to download it")
32
+
33
+ blag = BlagBL(database=blag_db_path)
21
34
  blag.parse_blag_contents()
22
35
  blag_ips = blag.ips
23
36
 
@@ -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", ip2asn.DEFAULT_IP2ASN_FILE)
12
+ taffy_default("modules.ip2asn.database", str(ip2asn.DEFAULT_IP2ASN_FILE))
13
13
 
14
14
 
15
15
  @register_hook(INIT_HOOK)
@@ -21,8 +21,8 @@ def init_ip2asn(**kwargs):
21
21
  db_path = config.get_dotnest("modules.ip2asn.database")
22
22
 
23
23
  if db_path and not Path(db_path).exists():
24
- error("The ip2asn plugin requires a ip2asn-combined.tsv in this directory")
25
- error("Please download it from https://iptoasn.com/")
24
+ error(f"The ip2asn plugin requires a ip2asn-combined.tsv file in {db_path}")
25
+ error("Please run ip2asn --fetch to download it")
26
26
 
27
27
  info(f"loading {db_path}")
28
28
  i2a = ip2asn.IP2ASN(db_path)
@@ -32,6 +32,11 @@ try:
32
32
  except ModuleNotFoundError:
33
33
  logging.debug("psl module not loadable")
34
34
 
35
+ try:
36
+ from traffic_taffy.hooks.blag import ip_blagbl_lookup as ip_blagbl_lookup
37
+ except ModuleNotFoundError:
38
+ logging.debug("blag module not loadable")
39
+
35
40
 
36
41
  def taffy_config_parse_args() -> Namespace:
37
42
  """Parse the command line arguments."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: traffic-taffy
3
- Version: 0.9.8
3
+ Version: 0.9.9
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>
@@ -1,4 +1,4 @@
1
- traffic_taffy/__init__.py,sha256=uP67YUi8VVs_JVB_tdvT_PnmKv3-I2IqRNX1DcwDqGs,22
1
+ traffic_taffy/__init__.py,sha256=YzFL7CfEcDRyEbnlof00gym6eTq-mBSIojBAQGrorTU,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
@@ -19,8 +19,8 @@ traffic_taffy/dissector_engine/dnstap.py,sha256=rBzVlB0D3YVhHOsr17cbnCIZU13g20sr
19
19
  traffic_taffy/dissector_engine/dpkt.py,sha256=q7cJz6WWpe9xUcEbAY_yn_cma_4loXuS3QKIVln6FHQ,12788
20
20
  traffic_taffy/dissector_engine/scapy.py,sha256=S3yrUmSeDjt3oE1I07L3iLFLF8Df8XAZg535FY_eu90,5004
21
21
  traffic_taffy/hooks/__init__.py,sha256=Bvhl6RnyBqQkWuCU6TS0O_ZHe4qCQsC4HE8FELigWPw,661
22
- traffic_taffy/hooks/blag.py,sha256=KWFhDYbH8sRcUsujCSdlycE0pYkX5ymyRRbHxi20z3U,1626
23
- traffic_taffy/hooks/ip2asn.py,sha256=G7zo2lFRLK-fbbzGMMcsaxIIh9ME6BoM0E6cJDaeE18,2233
22
+ traffic_taffy/hooks/blag.py,sha256=NgXcJ0uRFMUk-YkBeAdixNKFuzZ5iZJhh9rxuLb5zrI,2172
23
+ traffic_taffy/hooks/ip2asn.py,sha256=wTOevUytyogehV20JU-UdJ0vRhzgm7te1KVIuuKCvH0,2235
24
24
  traffic_taffy/hooks/labels.py,sha256=5jHXq3-kxDQj9PRYgak-gDzE8dvSUiCEq9mBs9nE014,1933
25
25
  traffic_taffy/hooks/psl.py,sha256=A3maHS9FOholOEv1LuX0xSO3u34GyqeYl9_EtJG1pMY,2119
26
26
  traffic_taffy/iana/tables.msgpak,sha256=d-R5Xw9yG9t4RqGJRrpE6cjH4YfaxQBwQiBhNjKZbwI,172825
@@ -45,13 +45,13 @@ traffic_taffy/tests/test_value_printing.py,sha256=rhmCUqnh1Lk1TTZvZi7ksvUWm4XDB4
45
45
  traffic_taffy/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  traffic_taffy/tools/cache_info.py,sha256=ZanO6jDlTdfJ7w0N_7BkLyJj4NyZGShaH7SrUulbIoE,2085
47
47
  traffic_taffy/tools/compare.py,sha256=oT5fIqfPeY6nGI9vSVAoKDsAVzzqfXJDzyOw2BhPfSI,3509
48
- traffic_taffy/tools/config.py,sha256=RwJYyfI1yiAKbMzU5mcPTguBiH-hGRy5vk_YvAAjPuM,2343
48
+ traffic_taffy/tools/config.py,sha256=lW9KKlWedGsVpq6c2KyC4TzbowYmGHWyEY3WqfGnhVI,2501
49
49
  traffic_taffy/tools/dissect.py,sha256=kGG0K2d9-OwrAhEU97id2m29PvhYaXZYIw1nLi1aVsE,3346
50
50
  traffic_taffy/tools/explore.py,sha256=gUcOfAgangJJI1si1gLPUoWRUKmWUAXSP0oTD2JJygw,24149
51
51
  traffic_taffy/tools/export.py,sha256=9zBBGhZK95b4ZiLJ8XK30GPsaBjgR84Sk1HoPIxRpTI,2844
52
52
  traffic_taffy/tools/graph.py,sha256=KiKDY9R8JLT5-JouANoi_1WGcdFMhXsLnYlhPsFRWpM,2316
53
- traffic_taffy-0.9.8.dist-info/METADATA,sha256=AhnwUs9q5jfXHgQOWbF5wYFEkSX3al81a02UgMZLgak,2311
54
- traffic_taffy-0.9.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
55
- traffic_taffy-0.9.8.dist-info/entry_points.txt,sha256=F0lqjvw94nQ3hY4eerN7faT9aKhhGUHbqBhuEr9q1r8,361
56
- traffic_taffy-0.9.8.dist-info/licenses/LICENSE.txt,sha256=eFp2vwcZFJW55SUQRoEfXio3K9XdwvsaI_WHntR7I2M,11338
57
- traffic_taffy-0.9.8.dist-info/RECORD,,
53
+ traffic_taffy-0.9.9.dist-info/METADATA,sha256=c287QYMbyfRv0cjIKLnaoyTowxqr6mVa_sd4q9MUW5w,2311
54
+ traffic_taffy-0.9.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
55
+ traffic_taffy-0.9.9.dist-info/entry_points.txt,sha256=F0lqjvw94nQ3hY4eerN7faT9aKhhGUHbqBhuEr9q1r8,361
56
+ traffic_taffy-0.9.9.dist-info/licenses/LICENSE.txt,sha256=eFp2vwcZFJW55SUQRoEfXio3K9XdwvsaI_WHntR7I2M,11338
57
+ traffic_taffy-0.9.9.dist-info/RECORD,,