Exemplo n.º 1
0
def RespondWithFile(client, filename, dlname=None):
	
	if filename.endswith('.exe'):
		Buffer = ServeExeFile(Payload = ServeFile(filename), ContentDiFile=dlname)
	else:
		Buffer = ServeHtmlFile(Payload = ServeFile(filename))

	Buffer.calculate()
	log.info("{} [HTTP] Sending file {}".format(filename, client))

	return str(Buffer)
Exemplo n.º 2
0
def RespondWithFile(client, filename, dlname=None):

    if filename.endswith('.exe'):
        Buffer = ServeExeFile(Payload=ServeFile(filename),
                              ContentDiFile=dlname)
    else:
        Buffer = ServeHtmlFile(Payload=ServeFile(filename))

    Buffer.calculate()
    print(text("[HTTP] Sending file %s to %s" % (filename, client)))

    return str(Buffer)
Exemplo n.º 3
0
 def add_static_endpoint(url, content_type, path):
     Buffer = ServeHtmlFile(
         ContentType="Content-Type: {}\r\n".format(content_type))
     HTTP.static_endpoints['/' + url] = {'buffer': Buffer, 'path': path}
Exemplo n.º 4
0
 def add_endpoint(url, content_type, payload):
     Buffer = ServeHtmlFile(
         ContentType="Content-Type: {}\r\n".format(content_type),
         Payload=payload)
     Buffer.calculate()
     HTTP.endpoints['/' + url] = Buffer