ran black to format

This commit is contained in:
Daniel Sagi
2022-01-27 21:36:41 +02:00
parent c33c1c2440
commit a5e805564d
4 changed files with 11 additions and 16 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ config = Config(
service_account_token=args.service_account_token,
kubeconfig=args.kubeconfig,
enable_cve_hunting=args.enable_cve_hunting,
custom=args.custom
custom=args.custom,
)
setup_logger(args.log, args.log_file)
set_config(config)
+4 -5
View File
@@ -1,12 +1,10 @@
from dataclasses import dataclass, field
from typing import Any, Optional
def get_default_core_hunters():
return [
"FromPodHostDiscovery",
"HostDiscovery",
"PortDiscovery"
]
return ["FromPodHostDiscovery", "HostDiscovery", "PortDiscovery"]
@dataclass
class Config:
@@ -54,6 +52,7 @@ class Config:
_config: Optional[Config] = None
def get_config() -> Config:
if not _config:
raise ValueError("Configuration is not initialized")
+5 -5
View File
@@ -267,21 +267,21 @@ class EventQueue(Queue):
Returns true if:
1. partial hunt is disabled
2. partial hunt is enabled and hunter is in core hunter class
3. partial hunt is enabled and hunter is specified in config.partial
3. partial hunt is enabled and hunter is specified in config.partial
@param target_hunter: hunter class for registration check
"""
"""
config = get_config()
if not config.custom:
return True
hunter_class_name = target_hunter.__name__
if hunter_class_name in self.core_hunters or hunter_class_name in config.custom:
return True
return False
def subscribe_event(self, event, hook=None, predicate=None, is_register=True):
def subscribe_event(self, event, hook=None, predicate=None, is_register=True):
if not is_register:
return
if not self.allowed_for_custom_registration(hook):
+1 -5
View File
@@ -12,11 +12,7 @@ class HTTPDispatcher:
dispatch_url = os.environ.get("KUBEHUNTER_HTTP_DISPATCH_URL", "https://localhost/")
try:
r = requests.request(
dispatch_method,
dispatch_url,
json=report,
headers={"Content-Type": "application/json"},
verify=False
dispatch_method, dispatch_url, json=report, headers={"Content-Type": "application/json"}, verify=False
)
r.raise_for_status()
logger.info(f"Report was dispatched to: {dispatch_url}")