Agent: Make do_GET() and inner function of _get_new_http_handler_class
This commit is contained in:
parent
95be74ed81
commit
0e01264bb6
|
@ -97,6 +97,25 @@ 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.
|
||||
"""
|
||||
|
||||
def do_GET(self):
|
||||
with self.download_lock:
|
||||
if self.class_downloaded.is_set():
|
||||
self.send_error(
|
||||
HTTP_TOO_MANY_REQUESTS_ERROR_CODE,
|
||||
"Java exploit class has already been downloaded",
|
||||
)
|
||||
return
|
||||
|
||||
self.class_downloaded.set()
|
||||
|
||||
logger.info("Java class server received a GET request!")
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "application/octet-stream")
|
||||
self.end_headers()
|
||||
logger.info("Sending the payload class!")
|
||||
self.wfile.write(self.java_class)
|
||||
|
||||
return type(
|
||||
"HTTPHandler",
|
||||
(http.server.BaseHTTPRequestHandler,),
|
||||
|
@ -107,22 +126,3 @@ def _get_new_http_handler_class(
|
|||
"do_GET": do_GET,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def do_GET(self):
|
||||
with self.download_lock:
|
||||
if self.class_downloaded.is_set():
|
||||
self.send_error(
|
||||
HTTP_TOO_MANY_REQUESTS_ERROR_CODE,
|
||||
"Java exploit class has already been downloaded",
|
||||
)
|
||||
return
|
||||
|
||||
self.class_downloaded.set()
|
||||
|
||||
logger.info("Java class server received a GET request!")
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "application/octet-stream")
|
||||
self.end_headers()
|
||||
logger.info("Sending the payload class!")
|
||||
self.wfile.write(self.java_class)
|
||||
|
|
Loading…
Reference in New Issue