addd exports path configuration variable and default values, restored old filename
This commit is contained in:
@@ -25,6 +25,9 @@ dashboard:
|
|||||||
# secret_path: super-secret-dashboard-path
|
# secret_path: super-secret-dashboard-path
|
||||||
secret_path: test
|
secret_path: test
|
||||||
|
|
||||||
|
exports:
|
||||||
|
path: "exports"
|
||||||
|
|
||||||
database:
|
database:
|
||||||
path: "data/krawl.db"
|
path: "data/krawl.db"
|
||||||
retention_days: 30
|
retention_days: 30
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class Config:
|
|||||||
infinite_pages_for_malicious: bool = True # Infinite pages for malicious crawlers
|
infinite_pages_for_malicious: bool = True # Infinite pages for malicious crawlers
|
||||||
ban_duration_seconds: int = 600 # Ban duration in seconds for IPs exceeding limits
|
ban_duration_seconds: int = 600 # Ban duration in seconds for IPs exceeding limits
|
||||||
|
|
||||||
|
# exporter settings
|
||||||
|
exports_path: str = "exports"
|
||||||
# Database settings
|
# Database settings
|
||||||
database_path: str = "data/krawl.db"
|
database_path: str = "data/krawl.db"
|
||||||
database_retention_days: int = 30
|
database_retention_days: int = 30
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from firewall.fwtype import FWType
|
|||||||
from firewall.iptables import Iptables
|
from firewall.iptables import Iptables
|
||||||
from firewall.raw import Raw
|
from firewall.raw import Raw
|
||||||
|
|
||||||
|
config = get_config()
|
||||||
app_logger = get_app_logger()
|
app_logger = get_app_logger()
|
||||||
|
|
||||||
# ----------------------
|
# ----------------------
|
||||||
@@ -24,7 +25,7 @@ TASK_CONFIG = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EXPORTS_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "exports")
|
EXPORTS_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "exports")
|
||||||
OUTPUT_FILE = os.path.join(EXPORTS_DIR, "malicious_ips.txt")
|
EXPORTS_DIR = config.exports_path
|
||||||
|
|
||||||
|
|
||||||
# ----------------------
|
# ----------------------
|
||||||
@@ -52,7 +53,6 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Filter out local/private IPs and the server's own IP
|
# Filter out local/private IPs and the server's own IP
|
||||||
config = get_config()
|
|
||||||
server_ip = config.get_server_ip()
|
server_ip = config.get_server_ip()
|
||||||
|
|
||||||
public_ips = [
|
public_ips = [
|
||||||
@@ -71,7 +71,11 @@ def main():
|
|||||||
fw = FWType.create(fwname)
|
fw = FWType.create(fwname)
|
||||||
banlist = fw.getBanlist(public_ips)
|
banlist = fw.getBanlist(public_ips)
|
||||||
|
|
||||||
output_file = os.path.join(EXPORTS_DIR, f"{fwname}.txt")
|
output_file = os.path.join(EXPORTS_DIR, f"{fwname}_banlist.txt")
|
||||||
|
|
||||||
|
if fwname == "raw":
|
||||||
|
output_file = os.path.join(EXPORTS_DIR, f"malicious_ips.txt")
|
||||||
|
|
||||||
with open(output_file, "w") as f:
|
with open(output_file, "w") as f:
|
||||||
f.write(f"{banlist}\n")
|
f.write(f"{banlist}\n")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user