mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-06 01:08:11 +00:00
support for python3
Signed-off-by: Weston Steimel <weston.steimel@gmail.com>
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
import core
|
||||
import modules
|
||||
from . import core
|
||||
from . import modules
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import types
|
||||
import events
|
||||
from . import types
|
||||
from . import events
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
from handler import *
|
||||
import types
|
||||
from .handler import *
|
||||
from . import types
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
import time
|
||||
from abc import ABCMeta
|
||||
from collections import defaultdict
|
||||
from Queue import Queue
|
||||
from queue import Queue
|
||||
from threading import Lock, Thread
|
||||
|
||||
from __main__ import config
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from os.path import dirname, basename, isfile
|
||||
import glob
|
||||
|
||||
from common import *
|
||||
from .common import *
|
||||
|
||||
# dynamically importing all modules in folder
|
||||
files = glob.glob(dirname(__file__)+"/*.py")
|
||||
for module_name in (basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')):
|
||||
if module_name != "handler":
|
||||
exec('from {} import *'.format(module_name))
|
||||
exec('from .{} import *'.format(module_name))
|
||||
|
||||
@@ -51,4 +51,4 @@ class PrivilegeEscalation(KubernetesCluster):
|
||||
class DenialOfService(object):
|
||||
name = "Denial of Service"
|
||||
|
||||
from events import handler # import is in the bottom to break import loops
|
||||
from .events import handler # import is in the bottom to break import loops
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import report
|
||||
import discovery
|
||||
import hunting
|
||||
from . import report
|
||||
from . import discovery
|
||||
from . import hunting
|
||||
|
||||
@@ -4,4 +4,5 @@ import glob
|
||||
# dynamically importing all modules in folder
|
||||
files = glob.glob(dirname(__file__)+"/*.py")
|
||||
for module_name in (basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')):
|
||||
exec('from {} import *'.format(module_name))
|
||||
if not module_name.startswith('test_'):
|
||||
exec('from .{} import *'.format(module_name))
|
||||
|
||||
@@ -4,4 +4,4 @@ import glob
|
||||
# dynamically importing all modules in folder
|
||||
files = glob.glob(dirname(__file__)+"/*.py")
|
||||
for module_name in (basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')):
|
||||
exec('from {} import *'.format(module_name))
|
||||
exec('from .{} import *'.format(module_name))
|
||||
|
||||
@@ -3,7 +3,7 @@ import logging
|
||||
|
||||
import requests
|
||||
|
||||
from kubelet import ExposedRunHandler
|
||||
from .kubelet import ExposedRunHandler
|
||||
|
||||
from ...core.events import handler
|
||||
from ...core.events.types import Event, Vulnerability
|
||||
|
||||
@@ -4,4 +4,4 @@ import glob
|
||||
# dynamically importing all modules in folder
|
||||
files = glob.glob(dirname(__file__)+"/*.py")
|
||||
for module_name in (basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')):
|
||||
exec('from {} import *'.format(module_name))
|
||||
exec('from .{} import *'.format(module_name))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from collector import services, vulnerabilities, services_lock, vulnerabilities_lock
|
||||
from .collector import services, vulnerabilities, services_lock, vulnerabilities_lock
|
||||
|
||||
class BaseReporter(object):
|
||||
def get_nodes(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import json
|
||||
from base import BaseReporter
|
||||
from .base import BaseReporter
|
||||
|
||||
class JSONReporter(BaseReporter):
|
||||
def get_report(self):
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import print_function
|
||||
from prettytable import ALL, PrettyTable
|
||||
|
||||
from __main__ import config
|
||||
from collector import services, vulnerabilities, services_lock, vulnerabilities_lock
|
||||
from .collector import services, vulnerabilities, services_lock, vulnerabilities_lock
|
||||
|
||||
EVIDENCE_PREVIEW = 40
|
||||
MAX_TABLE_WIDTH = 20
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import StringIO
|
||||
|
||||
from io import StringIO
|
||||
from ruamel.yaml import YAML
|
||||
from base import BaseReporter
|
||||
from .base import BaseReporter
|
||||
|
||||
class YAMLReporter(BaseReporter):
|
||||
def get_report(self):
|
||||
@@ -13,4 +12,4 @@ class YAMLReporter(BaseReporter):
|
||||
}
|
||||
output = StringIO.StringIO()
|
||||
yaml.dump(report, output)
|
||||
return output.getvalue()
|
||||
return output.getvalue()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import requests_mock
|
||||
import time
|
||||
from Queue import Empty
|
||||
from queue import Empty
|
||||
|
||||
from src.modules.discovery.hosts import FromPodHostDiscovery, RunningAsPodEvent, HostScanEvent, AzureMetadataApi
|
||||
from src.core.events.types import Event, NewHostEvent
|
||||
@@ -59,4 +59,4 @@ class testHostDiscoveryEvent(object):
|
||||
@handler.subscribe(AzureMetadataApi)
|
||||
class testAzureMetadataApi(object):
|
||||
def __init__(self, event):
|
||||
assert config.azure
|
||||
assert config.azure
|
||||
|
||||
Reference in New Issue
Block a user