Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Last active March 14, 2023 23:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfeilbach/da86f3c77e6675e26e8a695ed542e64c to your computer and use it in GitHub Desktop.
Save jfeilbach/da86f3c77e6675e26e8a695ed542e64c to your computer and use it in GitHub Desktop.
super fast tail to web cheat using netcat

tail log file to web via netcat

Server side

sudo yum install nc -y && (echo -e ‘HTTP/1.1 200 OK\nAccess-Control-Allow-Origin: *\nContent-type: text/event-stream\n’ && tail -f /var/log/squid/access.log | grep 10.120.13.31| sed -u -e ‘s/^/data: /;s/$/\n/’) | nc -l 8000

Client browser

new EventSource("http://${server}:8000/").onmessage = function(e) {
  console.log(e.data);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment