Skip to content

Instantly share code, notes, and snippets.

@carmelo0x63
Last active December 27, 2021 20:39
Show Gist options
  • Save carmelo0x63/fe27ff302b8bd8602f32206442073109 to your computer and use it in GitHub Desktop.
Save carmelo0x63/fe27ff302b8bd8602f32206442073109 to your computer and use it in GitHub Desktop.
Extremely simple HTTP servers

Bash

$ cat > index.http << EOF
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Server: netcat!

<!doctype html>
<html>
  <body>
    <h1>A webpage served by netcat</h1>
  </body>
</html>
EOF

$ while :; do cat index.http | nc -l 8000; done

Python 3

$ python3 -m http.server <port> --bind <ip_address>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment