Last active
September 19, 2024 03:18
-
-
Save m2kar/fed93428d00089a4f80285a341167fd5 to your computer and use it in GitHub Desktop.
One-Liner HttpServer Return Command Exec Result
This file contains 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
#!/bin/bash | |
# PROT=18080 | |
# CMD="uptime" | |
while true; do response=$($CMD); length=$(echo -n "$response" | wc -c); echo -e "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: ${#response}\r\n\r\n$response" | nc -l -p $PORT; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment