Move WHOIS cache to data directory and update .gitignore to ignore report directories
This commit is contained in:
1 parent
15019de3d8
commit
42d786b0a2
4 files changed
+12
-10
No files matched your search
@@ -13,6 +13,12 @@ MikroTik RouterOS export -- lives in this module.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
import bad_patterns
|
||||
from whitelists import (
|
||||
WHITELISTS,
|
||||
WHITELIST_NETS as _WHITELIST_NETS,
|
||||
refresh_whitelists,
|
||||
)
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
@@ -33,14 +39,8 @@ from typing import Any, Callable, Iterable, Iterator, Sequence
|
||||
ANSI_RE = re.compile(r"\x1b\[[0-9;]*m")
|
||||
|
||||
# Whitelists (imported from dedicated module)
|
||||
from whitelists import (
|
||||
WHITELISTS,
|
||||
WHITELIST_NETS as _WHITELIST_NETS,
|
||||
refresh_whitelists,
|
||||
)
|
||||
|
||||
# Malicious pattern detection
|
||||
import bad_patterns
|
||||
|
||||
#: (header, getter) pair used for CSV + console tables
|
||||
Column = tuple[str, Callable[[Any], Any]]
|
||||
@@ -95,7 +95,7 @@ def is_whitelisted(value: str) -> bool:
|
||||
|
||||
# WHOIS Cache file path
|
||||
WHOIS_CACHE_PATH = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), "reports", "whois_cache.json"
|
||||
os.path.dirname(os.path.abspath(__file__)), "data", "whois_cache.json"
|
||||
)
|
||||
|
||||
_whois_cache: dict[str, str] = {}
|
||||
@@ -365,7 +365,8 @@ def aggregate(requests: Iterable[Request]) -> dict[str, IPStats]:
|
||||
if r.path and bad_patterns.is_malicious(r.path):
|
||||
s.malicious_hits += 1
|
||||
for p in bad_patterns.classify_path(r.path):
|
||||
s.malicious_patterns[p.name] = s.malicious_patterns.get(p.name, 0) + 1
|
||||
s.malicious_patterns[p.name] = s.malicious_patterns.get(
|
||||
p.name, 0) + 1
|
||||
return stats
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user