summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-02-10 21:27:53 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-02-10 21:27:53 +0100
commitb3189209982ae849811e642a7f6e3ce13860776b (patch)
treeeeb263ea7f16fb9b0e3a7621560fed4b61b7f4ce
parentpkgs (diff)
downloadn-b3189209982ae849811e642a7f6e3ce13860776b.tar
n-b3189209982ae849811e642a7f6e3ce13860776b.tar.gz
n-b3189209982ae849811e642a7f6e3ce13860776b.tar.bz2
n-b3189209982ae849811e642a7f6e3ce13860776b.tar.lz
n-b3189209982ae849811e642a7f6e3ce13860776b.tar.xz
n-b3189209982ae849811e642a7f6e3ce13860776b.tar.zst
n-b3189209982ae849811e642a7f6e3ce13860776b.zip
-rwxr-xr-xvar/www/splstr/links.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/var/www/splstr/links.sh b/var/www/splstr/links.sh
new file mode 100755
index 0000000..d0ff527
--- /dev/null
+++ b/var/www/splstr/links.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+echo ne poganjaj na spletnih straneh, ki jim ne zaupaš!
+u=http://splet/
+[ $1x != x ] && u=$1
+co="--location-trusted --silent --fail --output /dev/null --max-time 5"
+noop () {
+ echo noop $1
+}
+anyproto () {
+ curl http:$1 $co || echo anyproto http: fail $1
+ curl https:$1 $co || echo anyproto https: fail $1
+}
+full () {
+ curl $1 $co || echo full fail $1
+}
+root () {
+ origin=`echo $u | cut -d/ -f1,2,3`
+ curl $u$1 $co || echo root $u fail $1
+}
+rel () {
+ dir=`echo $u | rev | cut -d/ -f2- | rev`
+ curl $dir/$1 $co || echo rel $dir fail $1
+}
+for i in `curl $u | pup a | tr $' ' $'\n' | grep href | cut -d\" -f2`
+do
+ printf .
+ case $i in
+ mail* | xmpp* | mumble* | irc* | tel*)
+ noop $i
+ ;;
+ //*)
+ anyproto $i
+ ;;
+ http*)
+ full $i
+ ;;
+ /*)
+ root $i
+ ;;
+ *)
+ rel $i
+ ;;
+ esac
+done