aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-05-16 01:10:03 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-05-16 01:10:03 +0200
commit946f03bb0e69f9de042aedab5362278227b88b93 (patch)
tree7d36de93fedb623b2a5a325afc16e6e9e325bac8
parent43943e26128724aaf5516a596772a16afdae06ea (diff)
downloadbin-946f03bb0e69f9de042aedab5362278227b88b93.tar.xz
add sprunc, netcat sprunge client
Written in POSIX sh
-rwxr-xr-xsprunc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sprunc b/sprunc
new file mode 100755
index 0000000..5e59bcf
--- /dev/null
+++ b/sprunc
@@ -0,0 +1,15 @@
+#!/usr/bin/busybox sh
+
+stdin=$(cat /dev/stdin)
+uuenc=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$stdin")
+
+content_length=$(( ${#uuenc} + $(expr length "sprunge=") ))
+
+/usr/bin/nc sprunge.us 80 <<EOF | awk '/17/{getline; print}'
+POST / HTTP/1.1
+Host:sprunge.us
+Content-Type:application/x-www-form-urlencoded
+Content-Length:$content_length
+
+sprunge=$uuenc
+EOF