From 6fecc76d86922c586ce47281241adb1904d0c349 Mon Sep 17 00:00:00 2001 From: epoch Date: Wed, 25 Aug 2021 18:57:29 +0000 Subject: had an uninitialized variable. *shs at self* --- uriunescape.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uriunescape.c b/uriunescape.c index 23800a5..2261da9 100644 --- a/uriunescape.c +++ b/uriunescape.c @@ -11,7 +11,7 @@ int main(int argc,char *argv[]) { char buf2[BUFSIZE]; char *ab; int blen; - int hack; + int hack=0; if(argc > 1) { for(argv++,argc--;argc;argc--,argv++) { ab=malloc(strlen(*argv)); @@ -40,6 +40,7 @@ int main(int argc,char *argv[]) { } } } + if(blen < 0) perror("read"); } return 0; } -- cgit v1.2.3 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(+) 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 120031ad92c74d2f2e523a67772952e539424c18 Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 19 Sep 2021 00:20:15 +0000 Subject: forgot to actually add the tool. lol --- uriqueryfilter | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 uriqueryfilter diff --git a/uriqueryfilter b/uriqueryfilter new file mode 100755 index 0000000..233937d --- /dev/null +++ b/uriqueryfilter @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +## list grabbed from: +## https://github.com/newhouse/url-tracking-stripper/blob/master/assets/js/trackers.js +## referenced from: +## https://github.com/rknightuk/TrackerZapper/blob/3fe21dc2a59240dc2883569f8d435415010610d2/TrackerZapper/AppDelegate.swift#L162 +## more: +## https://maxchadwick.xyz/tracking-query-params-registry/ + +## usages: +## ./paramfilter URL1 URL2 URL3 ... +## ./paramfilter < list.uris +## if you use arguments it won't try to read from stdin. +## so if you want to use paramfilter as a filter don't use arguments. + +if [ "$1" ];then + while [ "$1" ];do + printf "%s\n" "$1" + shift + done +else + cat #useless cat? +fi | while read line;do + q="$(uricut -q "$line")" + if [ "$q" ];then + newq="$(printf "%s\n" "$q" | tr '&' '\n' | grep -vf <(grep -A 1000 "^__LIST__$" "$0" | tail -n+2 | sed 's/^/^/g;s/$/=/g') | tr '\n' '&' | sed 's/&$//')" + cat <(uricut "$line") <(printf "query_string: %s\n" "$newq") | urijoin 2>/dev/null + else + printf "%s\n" "$line" + fi +done + +exit 0 +#this was generated with: +# wget -qO- https://github.com/mpchadwick/tracking-query-params-registry/raw/master/_data/params.csv | tail -n+2 | cut -d, -f1 >> paramfilter.sh +__LIST__ +fbclid +gclid +gclsrc +utm_content +utm_term +utm_campaign +utm_medium +utm_source +utm_id +_ga +mc_cid +mc_eid +_bta_tid +_bta_c +trk_contact +trk_msg +trk_module +trk_sid +gdfms +gdftrk +gdffi +_ke +redirect_log_mongo_id +redirect_mongo_id +sb_referer_host +mkwid +pcrid +ef_id +s_kwcid +msclkid +dm_i +epik +pk_campaign +pk_kwd +pk_keyword +piwik_campaign +piwik_kwd +piwik_keyword +mtm_campaign +mtm_keyword +mtm_source +mtm_medium +mtm_content +mtm_cid +mtm_group +mtm_placement +matomo_campaign +matomo_keyword +matomo_source +matomo_medium +matomo_content +matomo_cid +matomo_group +matomo_placement +hsa_cam +hsa_grp +hsa_mt +hsa_src +hsa_ad +hsa_acc +hsa_net +hsa_kw +hsa_tgt +hsa_ver -- 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(-) 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 b74cc5d4a5c748d567cc68bbf02dd054b9b42ae8 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 5 Oct 2021 07:41:41 +0000 Subject: choose is now 1337 h4x0r colors by default --- choose | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/choose b/choose index be4602a..1ec7dd7 100755 --- a/choose +++ b/choose @@ -7,7 +7,9 @@ #shift #sed 's|,|\\,|g;s|:|\\:|g' | tr '\n' ',' | rev | cut -b2- | rev | tr '\n' '\0' | xargs -0 xmessage -nearmouse "$@" "$message" -print -buttons if [ $DISPLAY ];then - dmenu -l 10 -p "$1" +#usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor] +# [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid] + dmenu -l 10 -p "$1" -nb '#000000' -nf '#00aa00' -sb '#006600' -sf '#00ff00' else - printf "%s" "$1" ; ledit head -n1 + printf "%s" "$1" fi -- cgit v1.2.3 From 3918ca258881537fdc3ce0b4fa92cf8d0d96f434 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 12 Oct 2021 14:36:28 +0000 Subject: added ref_src and updated comment about how the list was made --- uriqueryfilter | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uriqueryfilter b/uriqueryfilter index 233937d..72dca47 100755 --- a/uriqueryfilter +++ b/uriqueryfilter @@ -31,7 +31,8 @@ done exit 0 #this was generated with: -# wget -qO- https://github.com/mpchadwick/tracking-query-params-registry/raw/master/_data/params.csv | tail -n+2 | cut -d, -f1 >> paramfilter.sh +# wget -qO- https://github.com/mpchadwick/tracking-query-params-registry/raw/master/_data/params.csv | tail -n+2 | cut -d, -f1 >> uriqueryfilter +# echo ref_src >> uriqueryfilter __LIST__ fbclid gclid @@ -97,3 +98,4 @@ hsa_net hsa_kw hsa_tgt hsa_ver +ref_src -- cgit v1.2.3 From 80050281a53813021abe6ee7f6d12535d1337774 Mon Sep 17 00:00:00 2001 From: epoch Date: Wed, 20 Oct 2021 22:51:31 +0000 Subject: prompt was empty if URL was short enough. --- copy_start_nevermind.sh | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh index 3f7f7af..66bf922 100755 --- a/copy_start_nevermind.sh +++ b/copy_start_nevermind.sh @@ -1,16 +1,35 @@ #!/bin/bash [ "$1" ] || exit 1 uri="$1" + +queryfiltereduri="$(uriqueryfilter "$uri")" +if [ "$uri" != "$queryfiltereduri" ];then + trackeruri="$uri" + uri="$queryfiltereduri" +fi + +### this clipping should be part of choose probably if [ "${uri}" != "${uri:0:64}" ];then prompt="${uri:0:64}..." +else + prompt="${uri}" fi + scheme="$(uricut -s <<< "$uri")" -selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ +selection="$(printf "start with: %s\nremote_csn\ncopy\nshorten\nunshorten\ntitle\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ | choose "${prompt}")" # | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$uri" "$(urigetline "$uri")" )" -default start )" echo "$selection" case "$selection" in +remote_csn) + remote_host="$(choose "remote host to run URI on> " < ~/.config/urirhosts.conf)" + ### TODO: include in the list our own display either to use -X or use our IP and display number? + display="$(ssh "${remote_host}" myXdisplays | choose "which display?")" + uristart "ssh://${remote_host}/copy_start_nevermind.sh%20${uri}?DISPLAY=$display" + exit 0 + ;; + verbose) x-terminal-emulator -e less -f <(printf "%s" "$uri") exit 0 @@ -21,6 +40,11 @@ copy) exit 0 ;; +title) + copy_start_nevermind.sh "$(urititle "$uri")" + exit 0 + ;; + forget) cp ~/.cache/uristart.log ~/.cache/uristart.log.tmp cat ~/.cache/uristart.log.tmp | grep -vFw "${uri}" > ~/.cache/uristart.log @@ -44,11 +68,18 @@ shorten) exit 0 ;; +unshorten) + copy_start_nevermind.sh "$(unshorten.sh "$uri")" + exit 0 + ;; + QR) x-terminal-emulator -hold -e qr "$uri" ;; *) - exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + if [ "$selection" ];then + exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + fi ;; esac -- cgit v1.2.3 From 6bc244ea4584b97a7ba514d4110f43ee30be0515 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 06:34:39 +0000 Subject: added reverse match, used defines for match modes, fixed a argument parsing bug that would break on the second line of input if using non-simple matching --- urimatch.c | 75 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/urimatch.c b/urimatch.c index a90fb68..91177f2 100644 --- a/urimatch.c +++ b/urimatch.c @@ -6,29 +6,43 @@ #define LINE_LENGTH 1024 -int match(char negate,char *part,char *arg) { - if(negate) { - if(part == 0) return 1;//we found that the part isn't here! - } else { - if(part) { - if(!fnmatch(arg,part,FNM_NOESCAPE)) return 1; - } +#define MATCH_UNEXIST 0 +#define MATCH_PATTERN 1 +#define MATCH_REVERSE -1 + +// return 1 if the match and rule should have the main function print this URL. +int match(char rule,char *part,char *arg) { + switch(rule) { + case MATCH_UNEXIST: + if(part == 0) return 1; + break; + case MATCH_REVERSE: + if(part) { + if(!fnmatch(arg,part,FNM_NOESCAPE)) return 0; + else return 1; + } + break; + case MATCH_PATTERN: + if(part) if(!fnmatch(arg,part,FNM_NOESCAPE)) return 1; + break; + default: + fprintf(stderr,"oh god. what the hell happened to get here?\n"); + break; } return 0; } int main(int argc,char *argv[]) { - int i; + int i,j;; int ret=1; struct uri u; - char negate=0; + char rule=MATCH_PATTERN; char *line=malloc(LINE_LENGTH); char copy[LINE_LENGTH]; if(argc < 2) { - printf("usage: urimatch [-][n][s|u|k|d|D|P|p|q|f] [string]\n"); + printf("usage: urimatch [-][n][r][s|u|k|d|P|p|q|f] [string]\n"); printf("scheme://username:password@domain:port/path?query_string#fragment_id\n"); printf("s://u:k@d:P/p?q#f\n"); - printf("The D flag is special. it matches its argument against the last bytes of the input url's domain.\n"); printf("This allows matching of subdomains, like `echo epoch.ano | urimatch -D ano` would match.\n"); printf("the 'n' flag can be put before any of the other flags to check for a missing.\n"); return 1; @@ -40,30 +54,31 @@ int main(int argc,char *argv[]) { memset(&u,0,sizeof(u)); urifromline(&u,line); //use the character in argv[1] to match stdin against argv[2]. if match print whole line. - for(i=1;i= strlen(argv[i+1]) && !strncmp(u.domain+strlen(u.domain)-strlen(argv[i+1]),argv[i+1],strlen(argv[i+1]))) { - printf("%s\n",copy); - ret=0; - } - break; + case '-': j=1; rule=MATCH_PATTERN; break;//so we can't be modifying these! how the fuck? + case 'n': j=1; rule=MATCH_UNEXIST; break; + case 'r': j=1; rule=MATCH_REVERSE; break; + default: break;//handled by the next switch + } + switch(argv[i][j]) { + case 's': if(match(rule,u.scheme,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'u': if(match(rule,u.username,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'k': if(match(rule,u.password,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'd': if(match(rule,u.domain,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'P': if(match(rule,u.port,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'p': if(match(rule,u.path,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'q': if(match(rule,u.query_string,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + case 'f': if(match(rule,u.fragment_id,argv[i+1])) { printf("%s\n",copy); ret=0;} break; + // TODO: after a while, get rid of 'D' completely. + case 'D': fprintf(stderr,"the 'D' flag has been removed.\ninstead of: D 'host'\nuse: d '*host'\n"); default: printf("unknown url part letter! '%c'\n",argv[i][0]); return ret; } + if(rule == MATCH_UNEXIST) {i--;}//UNEXIST doesn't consume the argument after it. so, go backwards 1. we're about to go ahead 2. } } return ret; -- 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 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 From a847f39dc51ba0bf5acd61648946e88a06a57e2c Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:45:50 +0000 Subject: added a program to generate a URI based on currently open X11 window data, then added it and a gopher-get, and another clipboard selection to top of list in urilaunch. switched to choose from dmenu --- urilaunch | 6 ++++-- xwindowURI | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100755 xwindowURI diff --git a/urilaunch b/urilaunch index 88b2a40..fc15323 100755 --- a/urilaunch +++ b/urilaunch @@ -3,10 +3,12 @@ #you'll probably want to change my gopher-get line to be something useful to you. exec copy_start_nevermind.sh \ "$(cat \ - <(printf "%s\n" $(xclip -o | head -n1)) \ + <(printf "%s\n" "$(xclip -o | head -n1)") \ + <(printf "%s\n" "$(xclip -o -selection clipboard | head -n1)") \ + <(xdotool getwindowfocus | xargs xwindowURI) \ <(printf "\n") \ <(gopher-get gopher://batou/0/links.txt) \ <(cat ~/.cache/uristart.log | sort | uniq) \ - | dmenu -l 10 -p urilaunch\> \ + | choose 'urilaunch>' \ | cut '-d ' -f1 )" diff --git a/xwindowURI b/xwindowURI new file mode 100755 index 0000000..6e9235a --- /dev/null +++ b/xwindowURI @@ -0,0 +1,35 @@ +#!/bin/sh +if [ ! "$1" ];then + id="$(xwinID)" +else + id="$1" +fi + +class=$(xclass -id "$id") +#echo "$class" + +case "$class" in +mupdf) + basename="$(xwintitle "$id" | rev | cut '-d ' -f5- | rev)" + echo "b: $basename" + page="$(xwintitle "$id" | tr ' ' '\n' | grep '[0-9][0-9]*/[0-9][0-9]*' | cut -d/ -f1)" + echo "$page" + for PID in $(pgrep mupdf);do + argv1="$(cat /proc/$PID/cmdline | tr '\0' '\n' | sed -n 2p)" + cd "$(readlink /proc/$PID/cwd)" + abspath="$(normalpath "$argv1")" + echo "a: $abspath" + echo "b: $basename" + if [ "$(basename "$abspath")" = "$basename" ];then + printf "file://%s#page=%s\n" "$(uriescape "$abspath")" "$page" + exit 0 + fi + done + ;; +Navigator) + xwintitle "$id" | rev | cut '-d ' -f4 | rev + ;; +*) + echo "class: $class" + ;; +esac -- cgit v1.2.3 From 34181aafcfbfeb434d5ff0ebe4bf1d368ac4936c Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:47:59 +0000 Subject: added a program to act as a generic "search" key-combo handler. just launches a search URI at the end. --- search | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/search b/search index 1c2e67c..7c8c77a 100755 --- a/search +++ b/search @@ -1,2 +1,6 @@ #!/bin/sh -uristart "search:?q=$(echo | dmenu -p 'search>' | tr '\n' '\0' | xargs -0 uriescape | sed 's/&/%26/g;s/#/%23/g')" +q="$(printf "%s\n%s\n" "$(xclip -o | head -n1)" "$(xclip -o -selection clipboard | head -n1)" | choose 'search>' | tr '\n' '\0' | xargs -0 uriescape | sed 's/&/%26/g;s/#/%23/g')" +if [ ! "$q" ];then + exit 1 +fi +exec uristart "search:?q=$q" -- cgit v1.2.3 From 86480f1eca8820cf67c95359780c62c3a89d4485 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:49:36 +0000 Subject: escape the single quotes from the env vars that get exported. stuff with x-face data is good for debugging.. derped on a non-empty check of arguments as multiple quoted strings instead of just one. --- uristart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/uristart b/uristart index a5c3e63..2b0d7f2 100755 --- a/uristart +++ b/uristart @@ -10,6 +10,8 @@ ASKUSER="choose" check=dont +eval "$(printf "%s\n" "$1" | uricut | sed 's/^/export URI/;s/'\''/'\''\\'\'''\''/;s/: /='\''/g;s/$/'\''/')" + uristart_config=~/.config/uristart.conf usage() { @@ -43,7 +45,7 @@ if [ "$verbose" ];then echo "uristart: other:" "$@" >&2 fi -if [ ! "$@" ];then +if [ ! "$*" ];then usage >&2 #to stderr because it is an error to not have any extra args to process exit 1 fi -- cgit v1.2.3 From 84940d9b57eb4a6ab07de6b7b3058ba3c46ac8c8 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:51:04 +0000 Subject: auto-convert urn:btih to magnets using an external script on it... not sure where that script lives atm. --- urnresolve | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/urnresolve b/urnresolve index 1ce59be..e33f56e 100755 --- a/urnresolve +++ b/urnresolve @@ -39,3 +39,7 @@ if [ "$nid" = "fcc" ];then grep "^$nss2\s" $PREFIX/share/urn/fcc:frs | cut -f2 fi fi + +if [ "$nid" = "btih" ];then + btih2magnet "$nss" +fi -- cgit v1.2.3 From 97be01c60eb0e8cac1a9cdd2211aa27e1c50a414 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 25 Oct 2021 07:53:03 +0000 Subject: meh. lost steam while writing the README. code comments ftw. --- README | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/README b/README index 1ea4b28..63707b6 100644 --- a/README +++ b/README @@ -1,16 +1,9 @@ -This is a handy little program to help you handle URIs that any program may want a handler for. -Just point those programs looking for a handler at uristart. +This repo has grown a lot of tools that I use on my own system. -Then write a matching pattern, and a handler pipeline. +There's a uri.h that can be included in other C programs -The matching patterns are a series of pairs of URI-piece and a string. - -Each piece has a single letter you use to select the piece. - -here's an example that uses all of the parts: -s://u:k@d:P/p?q#f - -where each piece is: +Most of the programs will take single letters to refer to parts of a URI. +each piece is: s: scheme u: username k: password (k for key) @@ -19,3 +12,33 @@ P: port p: path q: query_string f: fragment_id + +## uricut + +used for cutting portions of a URI out from the rest of it. + +to cut the domain out of all the input URIs and show one per line. +``` +urilist | uricut -d +``` + +## urimatch + +used for matching URIs +multiple arguments will print if any of the rules match. +so if you want to print only if all of the rules match, pipe urimatch into another urimatch + +to print all gemini or gopher URIs: +``` +urilist | urimatch s gemini s gopher +``` + +to print all the gemini URIs that are for the domain gemini.thebackupbox.net +``` +urilist | urimatch s gemini | urimatch d gemini.thebackupbox.net +``` + +to print all the non-http links using reverse match and globbing +``` +urilist | urimatch rs 'http*' +``` -- cgit v1.2.3 From c38649558142ee7a02c176f373120f417633b022 Mon Sep 17 00:00:00 2001 From: epoch Date: Sat, 30 Oct 2021 00:24:59 +0000 Subject: urnresolve now resolves the made-up urn:phrack --- urnresolve | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/urnresolve b/urnresolve index e33f56e..4e6a39b 100755 --- a/urnresolve +++ b/urnresolve @@ -24,6 +24,16 @@ if [ "$nid" = "ietf" ];then fi fi +if [ "$nid" = "phrack" ];then + if [ "$nss" ];then + if [ "$nss2" ];then + echo "gopher://thebackupbox.net:70/0/phrack/issues/${nss}/${nss2}.txt" + else + echo "gopher://thebackupbox.net:70/1/phrack/issues/${nss}/" + fi + fi +fi + if [ "$nid" = "xkcd" ];then echo "https://xkcd.com/${nss}" fi -- cgit v1.2.3