summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-08-28 12:10:22 +0100
committerKatolaZ <katolaz@freaknet.org>2018-08-28 12:10:22 +0100
commitf9fe15e6a2ea74e523e51e9542df1bf00b23ce7c (patch)
tree8bfe5d4fc67fed50de355e731b316ead43b40321
parent41c081e96ea877055d7418c6775d6e755784379f (diff)
avoid self-loops and cgi trapsHEADmaster
-rwxr-xr-xburrow16
1 files changed, 14 insertions, 2 deletions
diff --git a/burrow b/burrow
index 9335ba8..87b4e79 100755
--- a/burrow
+++ b/burrow
@@ -22,14 +22,26 @@
###
## function
get_dirs(){
- src_id="$1"
+ src_type=$(echo "$1" | cut -d "|" -f 1)
+ src_sel=$(echo "$1" | cut -d "|" -f 2 | cut -d "?" -f 1)
+ src_host=$(echo "$1" | cut -d "|" -f 3)
+ src_port=$(echo "$1" | cut -d "|" -f 4)
+ src_id=$(echo "$1" | cut -d "|" -f 5)
+ ##echo "src_sel: \"${src_sel}\"" >&2
OLDIFS=$IFS
#IFS=$'\t\n'
IFS="|"
src_dir=$(echo "${src_id}" | cut -c -2)
touch "${src_dir}/${src_id}"
while read name sel host port; do
+ ##echo "sel: \"$sel\"" >&2
+ [ "$sel" = "Err" -o -z "$sel" ] && continue
TYPE=$(echo "$name" | cut -c 1)
+ [ "$TYPE" = "i" ] && continue
+ dst_sel=$(echo "$sel" | cut -d "?" -f 1)
+ ##echo "dst_sel: \"${dst_sel}\"" >&2
+ [ "${dst_sel}" = "${src_sel}" -a "${src_type}" = "$TYPE" \
+ -a "${src_host}" = "$host" -a "${src_port}" = "$port" ] && continue;
port=$(echo $port | sed -r -e 's/\r//g')
dir_id=$(echo "${TYPE}|${sel}|${host}|${port}" | sed 's/^1||/1|\/|/g')
dest_id=$(echo "${dir_id}" | sha256sum | cut -d " " -f 1 )
@@ -91,6 +103,6 @@ echo "selector ${src_id} not found" >> logfile.txt
MYNAME=$(basename $0)
if [ -z "${MYNAME##burrow}" ]; then
- retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "${src_id}"
+ retrieve_selector "$SRC" | sed -r -e 's/\t/|/g' | get_dirs "$SRC"
fi