netcat-web-server/ncws.sh
2024-12-06 22:14:39 -05:00

27 lines
433 B
Bash
Executable File

#!/bin/env bash
read -r -d '' HTML << EOM
HTTP/1.1 200 OK
Content-Type: text/html;
Server: netcat
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
EOM
echo "netcat web server"
while true; do
printf '%s' "$HTML" | netcat -v -N -l 8080;
done