Last active
July 5, 2023 02:35
-
-
Save iknowjason/3525c7a8b8434b50476709f32227b7c1 to your computer and use it in GitHub Desktop.
Data exfiltration using curl and python SimpleHTTPServer class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import HTTPServer, BaseHTTPRequestHandler | |
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.end_headers() | |
self.wfile.write(b'Hello, world!') | |
def do_POST(self): | |
content_length = int(self.headers['Content-Length']) | |
body = self.rfile.read(content_length) | |
self.send_response(200) | |
self.end_headers() | |
decoded = body.decode('utf-8') | |
print('[+] Received: ') | |
print(decoded) | |
f = open('/tmp/exfil.txt', 'w') | |
f.write(decoded) | |
httpd = HTTPServer(('localhost', 8000), SimpleHTTPRequestHandler) | |
httpd.serve_forever() | |
#Run it: python3 post.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment