Created
November 22, 2025 11:23
-
-
Save sinedsem/50ddcfc825f56187f8275df421f605a7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import http.server | |
| import http.client | |
| import urllib.parse | |
| TARGET_URL = "script.google.com" | |
| TARGET_PATH = "/macros/s/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/exec" | |
| class ProxyHandler(http.server.BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| self.forward_request() | |
| def do_POST(self): | |
| self.forward_request() | |
| def do_PUT(self): | |
| self.forward_request() | |
| def do_DELETE(self): | |
| self.forward_request() | |
| def forward_request(self): | |
| # Read body as raw bytes | |
| content_length = int(self.headers.get('Content-Length', 0)) | |
| body = self.rfile.read(content_length) if content_length > 0 else None | |
| # Forward headers, skipping Host and Connection | |
| headers = {k: v for k, v in self.headers.items() if k.lower() not in ['host', 'connection']} | |
| # Forward the request to Google | |
| conn = http.client.HTTPSConnection(TARGET_URL) | |
| conn.request(self.command, TARGET_PATH + ('?' + self.path.split('?', 1)[1] if '?' in self.path else ''), body=body, headers=headers) | |
| resp = conn.getresponse() | |
| # Send response back to client | |
| self.send_response(resp.status, resp.reason) | |
| for k, v in resp.getheaders(): | |
| if k.lower() not in ['connection', 'transfer-encoding', 'content-length']: | |
| self.send_header(k, v) | |
| data = resp.read() | |
| self.send_header('Content-Length', str(len(data))) | |
| self.end_headers() | |
| self.wfile.write(data) | |
| conn.close() | |
| if __name__ == "__main__": | |
| server_address = ('127.0.0.1', 31247) | |
| httpd = http.server.HTTPServer(server_address, ProxyHandler) | |
| print("Proxy running on http://127.0.0.1:31247") | |
| httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment