From d8002b33fad5e37e37a10f829f56aeb6b312e8d1 Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 19 Sep 2021 00:19:58 +0000 Subject: new tool to filter URI GET params --- Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cc24cbc..175ab7b 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ clean: rm -f *.o install: all + install -t $(PREFIX)/bin xwindowURI + install -t $(PREFIX)/bin uriqueryfilter install -t $(PREFIX)/bin urimatch install -t $(PREFIX)/bin uricut install -t $(PREFIX)/bin urijoin -- cgit v1.2.3 From c1a5bdd0c2cbcd0f81df0011b20197f28e1e3a5e Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 19 Sep 2021 00:26:36 +0000 Subject: Makefile was missing a -D in the install target for a dir that might have not existed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 175ab7b..1abb56a 100644 --- a/Makefile +++ b/Makefile @@ -47,5 +47,5 @@ install: all install -t $(PREFIX)/bin shorten install -t $(PREFIX)/bin urnresolve install -t $(PREFIX)/bin urnstart - install -t $(PREFIX)/share/urn share/urn/* + install -Dt $(PREFIX)/share/urn share/urn/* chgrp shorten $(PREFIX)/bin/shorten && chmod g+s $(PREFIX)/bin/shorten -- cgit v1.2.3 From d5fd6ce0bad91b1cd2e76515e1259fa6c93665a7 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:42:50 +0000 Subject: added a program to convert a string with single-quotes into a shell-escaped version because writing that same sed regex over and over was a pain in the ass. also added a ssh handler. read before use. put them in Makefile --- Makefile | 2 ++ sqesc.c | 18 ++++++++++++++++++ ssh_hack | 26 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 sqesc.c create mode 100755 ssh_hack (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1abb56a..090e2c0 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ clean: rm -f *.o install: all + install -t $(PREFIX)/bin sqesc + install -t $(PREFIX)/bin ssh_hack install -t $(PREFIX)/bin xwindowURI install -t $(PREFIX)/bin uriqueryfilter install -t $(PREFIX)/bin urimatch diff --git a/sqesc.c b/sqesc.c new file mode 100644 index 0000000..6d7ba23 --- /dev/null +++ b/sqesc.c @@ -0,0 +1,18 @@ +#include +#include + +int print_escaped(char *s) { + char *p=0; + for(p=strchr(s,'\'');p && s && *p && *s;p=strchr(s,'\'')) { + *p=0;//null out this single-quote + printf("%s",s); + printf("'\\''"); + s=p+1; + } + printf("%s",s); + return 0; +} + +int main(int argc,char *argv[]) { + return print_escaped(argv[1]); +} diff --git a/ssh_hack b/ssh_hack new file mode 100755 index 0000000..e882cd2 --- /dev/null +++ b/ssh_hack @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +### we need to export each of the query string variables +### then send them over ssh +q="$(printf "%s\n" "$1" | uricut -q)" +p="$(printf "%s\n" "$1" | uricut -p)" +d="$(printf "%s\n" "$1" | uricut -d)" +P="$(printf "%s\n" "$1" | uricut -P)" +u="$(printf "%s\n" "$1" | uricut -u)" + +eval "$(printf '%s\n' "$q" | tr '&' ' ' | grep '[^ ]*=' | sed 's/^/export /g')" +if [ "$p" ];then + p="$(uriunescape "$p")" +fi +if [ "$P" ]; then + HACK_PORT="-p $P" +fi +if [ "$u" ];then + HACK_USER="$u@" +fi + +tmpfile=$(mktemp); +printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g' > "$tmpfile" + +ssh -F "$tmpfile" -t ${HACK_PORT} ${HACK_USER}${d} ${p:1} +#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1} +#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1} -- cgit v1.2.3