mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-10 19:26:49 +00:00
locked variables
This commit is contained in:
@@ -91,7 +91,7 @@ def list_hunters():
|
||||
print("* {}\n {}\n".format( name, docs))
|
||||
|
||||
|
||||
tlock3 = threading.Lock
|
||||
tlock3 = threading.Lock()
|
||||
tlock3.acquire()
|
||||
hunt_started = False
|
||||
tlock3.release()
|
||||
@@ -112,7 +112,7 @@ def main():
|
||||
|
||||
if not any(scan_options):
|
||||
if not interactive_set_config(): return
|
||||
tlock = threading.Lock
|
||||
tlock = threading.Lock()
|
||||
tlock.acquire()
|
||||
hunt_started = True
|
||||
tlock.release()
|
||||
@@ -138,4 +138,10 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
for i in range(6):
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
import traceback
|
||||
print ('\n\n\n\n\n\n\n\n\n')
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -65,8 +65,11 @@ class Vulnerability(object):
|
||||
def explain(self):
|
||||
return self.__doc__
|
||||
|
||||
|
||||
tlock1 = threading.Lock()
|
||||
tlock1.acquire()
|
||||
event_id_count = 0
|
||||
tlock1.release()
|
||||
|
||||
""" Discovery/Hunting Events """
|
||||
|
||||
|
||||
@@ -74,9 +77,12 @@ class NewHostEvent(Event):
|
||||
def __init__(self, host, cloud=None):
|
||||
global event_id_count
|
||||
self.host = host
|
||||
self.event_id = event_id_count
|
||||
self.cloud = cloud
|
||||
tlock = threading.Lock()
|
||||
tlock.acquire()
|
||||
self.event_id = event_id_count
|
||||
event_id_count += 1
|
||||
tlock.release()
|
||||
|
||||
def __str__(self):
|
||||
return str(self.host)
|
||||
|
||||
@@ -38,6 +38,8 @@ class Collector(object):
|
||||
|
||||
def execute(self):
|
||||
"""function is called only when collecting data"""
|
||||
tlock = threading.Lock()
|
||||
tlock.acquire()
|
||||
global services, vulnerabilities
|
||||
bases = self.event.__class__.__mro__
|
||||
if Service in bases:
|
||||
@@ -59,6 +61,7 @@ class Collector(object):
|
||||
port=self.event.port,
|
||||
desc=wrap_last_line(console_trim(self.event.explain(), '| '))
|
||||
))
|
||||
tlock.release()
|
||||
|
||||
|
||||
class TablesPrinted(Event):
|
||||
|
||||
Reference in New Issue
Block a user