MCPcopy Index your code
hub / github.com/SpyGuard/SpyGuard / load

Method load

analysis/classes/engine.py:106–146  ·  view source on GitHub ↗
(cls, get_cfg: Callable[[tuple[str, str]], Any])

Source from the content-addressed store, hash-verified

104
105 @classmethod
106 def load(cls, get_cfg: Callable[[tuple[str, str]], Any]) -> "EngineConfig":
107 def _as_int_list(value: Any) -> list[int]:
108 if value is None:
109 return []
110 if isinstance(value, list):
111 out: list[int] = []
112 for v in value:
113 try:
114 out.append(int(v))
115 except (TypeError, ValueError):
116 continue
117 return out
118 return []
119
120 heuristics = bool(get_cfg(("analysis", "heuristics")))
121 iocs = bool(get_cfg(("analysis", "iocs")))
122 whitelist = bool(get_cfg(("analysis", "whitelist")))
123 active = bool(get_cfg(("analysis", "active")))
124 userlang = str(get_cfg(("frontend", "user_lang")) or "en")
125 max_ports_raw = get_cfg(("analysis", "max_ports"))
126 try:
127 max_ports = int(max_ports_raw)
128 except (TypeError, ValueError):
129 max_ports = 1024
130
131 http_default_ports = _as_int_list(get_cfg(("analysis", "http_default_ports")))
132 tls_default_ports = _as_int_list(get_cfg(("analysis", "tls_default_ports")))
133 indicators_types_raw = get_cfg(("analysis", "indicators_types")) or []
134 indicators_types = [str(x) for x in indicators_types_raw] if isinstance(indicators_types_raw, list) else []
135
136 return cls(
137 heuristics_analysis=heuristics,
138 iocs_analysis=iocs,
139 whitelist_analysis=whitelist,
140 active_analysis=active,
141 userlang=userlang,
142 max_ports=max_ports,
143 http_default_ports=http_default_ports,
144 tls_default_ports=tls_default_ports,
145 indicators_types=indicators_types,
146 )
147
148
149class WhitelistIndex:

Callers 15

get_configFunction · 0.45
get_deviceFunction · 0.45
__init__Method · 0.45
read_jsonMethod · 0.45
__init__Method · 0.45
read_configFunction · 0.45
effective_capture_exportFunction · 0.45
write_configFunction · 0.45
get_reportMethod · 0.45
getMethod · 0.45
read_configFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected