Skip to content

Instantly share code, notes, and snippets.

@burris

burris/redir.py Secret

Created February 1, 2020 15:55
Show Gist options
  • Save burris/78a6eb1f3cf34301835e650185bc142b to your computer and use it in GitHub Desktop.
Save burris/78a6eb1f3cf34301835e650185bc142b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import http.server
import socketserver
from http import HTTPStatus
PORT = 8000
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.FOUND)
self.send_header("Location", "magnet:?xt=urn:btih:aa9dc8a79ddaba135a59966ecef849884a336f82&dn=hello.txt")
self.end_headers()
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment