Agent: Make do_GET() and inner function of _get_new_http_handler_class

This commit is contained in:
Mike Salvatore 2022-03-07 05:21:48 -05:00
parent 95be74ed81
commit 0e01264bb6
1 changed files with 19 additions and 19 deletions

View File

@ -97,17 +97,6 @@ def _get_new_http_handler_class(
stored as class variables. Creating the request handler classes dynamically at runtime allows
multiple ExploitClassHTTPServers, each with it's own unique state, to run concurrently.
"""
return type(
"HTTPHandler",
(http.server.BaseHTTPRequestHandler,),
{
"java_class": java_class,
"class_downloaded": class_downloaded,
"download_lock": threading.Lock(),
"do_GET": do_GET,
},
)
def do_GET(self):
with self.download_lock:
@ -126,3 +115,14 @@ def do_GET(self):
self.end_headers()
logger.info("Sending the payload class!")
self.wfile.write(self.java_class)
return type(
"HTTPHandler",
(http.server.BaseHTTPRequestHandler,),
{
"java_class": java_class,
"class_downloaded": class_downloaded,
"download_lock": threading.Lock(),
"do_GET": do_GET,
},
)