-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
47 lines (37 loc) · 1.17 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Configuration management for vulnerability scanner"""
from pydantic import BaseSettings, validator
from typing import List, Dict
import os
from dotenv import load_dotenv
load_dotenv()
class ScannerConfig(BaseSettings):
"""Scanner configuration with validation"""
# HTTP Settings
USER_AGENT: str = "Mozilla/5.0 (compatible; SecurityScanner/1.0)"
REQUEST_TIMEOUT: int = 30
MAX_REDIRECTS: int = 5
VERIFY_SSL: bool = True
# Scan Settings
MAX_URLS_PER_SCAN: int = 100
MAX_DEPTH: int = 3
CONCURRENT_SCANS: int = 10
# Rate Limiting
REQUESTS_PER_SECOND: int = 10
BURST_SIZE: int = 20
# Paths/Extensions to Exclude
EXCLUDE_PATHS: List[str] = [
"/logout", "/signout", "/delete",
"/static", "/assets", "/images"
]
EXCLUDE_EXTENSIONS: List[str] = [
".jpg", ".jpeg", ".png", ".gif",
".css", ".js", ".ico", ".svg"
]
@validator("REQUEST_TIMEOUT")
def validate_timeout(cls, v):
if v < 1:
raise ValueError("Timeout must be at least 1 second")
return v
class Config:
env_prefix = "SCANNER_"
case_sensitive = True