• Fun with netcat
    9 replies, posted
If you like linux utilities you've probably bumped into netcat once. Well, turns out you can do [B]a lot[/B] of cool stuff with netcat, so why not make a thread about netcat scripts? I'll start off with this really cheap desktop streaming system. No registration required! Streamer: [code]ffmpeg -f x11grab -i ":0.0" -crf 10 -b:v 1M -f asf - | nc -lp 1337[/code] Receiver: [code]nc ip 1337 | vlc -[/code] Preview: [vid]http://dev.novaember.com/s/13-11-15_21-14-48_734177621.webm[/vid] I've also been working on a way to send notifications, which I'll post later when it's kind of usable. [editline]15th November 2013[/editline] putting gzip and gunzip in the pipelines might help if you're having problems [editline]yes[/editline] posting otherwise cool one-liners are fine too
[url=http://farmpolice.com/content/videos/fc23d338.webm]Works as advertised[/url]
Not really a netcat thing but a cool oneliner nonetheless [code]curl -s 'http://www.cavejohnsonhere.com/random/' | grep quote_main | cut -d \> -f 2- | fmt -w $(tput cols)[/code] [img]http://i.imgur.com/hHMRKFr.png[/img]
[code]ffmpeg -f alsa -ac 1 -i hw:U0x46d0x825 -f flac - | nc -lp 1337[/code] [vid]http://farmpolice.com/content/videos/0e48b07f.webm[/vid]
I got some insperation [url=http://xkcd.com/440/][img]http://imgs.xkcd.com/comics/road_rage.png[/img][/url] [quote]Okay, now just as the loss hits him, slam on the brakes.[/quote] [vid]http://BasBieling.com/stuff/xkcd.webm[/vid]
Someone do "netcat -lp 5555 | sudo sh" and give me their ip address.
[QUOTE=IpHa;42875078]Someone do "netcat -lp 5555 | sudo sh" and give me their ip address.[/QUOTE] Sure BasBieling.com:5555 [editline]15th November 2013[/editline] only one can connect at a time though so if it says connection refused just keep spamming it or something [editline]15th November 2013[/editline] Stream any video file: Server [code]cat video.mp4 | gzip | nc -lp 1337[/code] client [code]nc server 1337 | gunzip | vlc -[/code] For example [code]nc basbieling.com 1337 | gunzip | vlc -[/code]
So I've finished my netcat notify-send thing: notify-send for the server: [code] #!/bin/bash ( echo -e "$1\001$2" > /tmp/notifications ) & [/code] notifyd for the server: (run this in the background) [code] #!/bin/bash FILE=/tmp/notifications [ -e "$FILE" ] && rm -rf "$FILE" touch "$FILE" while :; do tail -f /tmp/notifications | nc -lp 2000; done [/code] notifyc for the client: [code] #!/bin/bash # while :; do nc novaember.com 2000 | while read header; do read body; notify-send "$header" "$body"; done; sleep 1s; done while :; do IFS="`echo -e "\001"`" nc novaember.com 2000 | while read -ra notification; do notify-send "${notification[0]}" "${notification[1]}" done sleep 1s done [/code] It should automatically try to reconnect, and notifications will stay on the server until there's a client available. Downsides are that you can't use newlines in notifications and it's insecure (everyone has access to the notifications stream, though only one client can be served at a time.)
My coworkers and I are just getting into security, and one of my teammates wrote an article on using netcat with 7zip: [url]http://www.hackandtinker.net/2013/10/30/ncatand7zip/[/url] Shameless self-promotion.
[QUOTE=Darkwater124;42881280]So I've finished my netcat notify-send thing (...) (...) and[B] it's insecure[/B] (everyone has access to the notifications stream, though only one client can be served at a time.)[/QUOTE] [IMG]http://unek.blinkenshell.org/s/2013-11-23_222942-screenshot.png[/IMG] yup
Sorry, you need to Log In to post a reply to this thread.