diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-05-24 16:48:22 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-05-25 21:57:14 +0200 |
commit | 31c69b6ca1b91e7fd9fd8e14082fd2584c5f538c (patch) | |
tree | 16e789c7d68608831b498f41f54d9482b82a711a /batch/millerCncOnionHost.sh |
first public release
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'batch/millerCncOnionHost.sh')
-rwxr-xr-x | batch/millerCncOnionHost.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/batch/millerCncOnionHost.sh b/batch/millerCncOnionHost.sh new file mode 100755 index 0000000..e01d6b0 --- /dev/null +++ b/batch/millerCncOnionHost.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +TORHFILE=/var/lib/tor/hidden_service/hostname +DEST="$(dirname $0)/../deps/sysroot/${TORHFILE}" +DEFINE="HTTP_ONION" + +if [ $# -ne 1 ]; then + echo -e "usage: $0 [INCLUDE-FILE]\n\te.g. $0 $(realpath $(dirname $0)/../include/xor_strings.h)" >&2 + exit 1 +fi + +if [ -r "${DEST}" ]; then + DEST=$(realpath "${DEST}") + echo "$0: TOR Hidden Service hostname file: ${DEST} -> $(cat ${DEST})" >&2 + CURR_HOST=$(sed -n 's/#define\s*'${DEFINE}'\s*"\([a-zA-Z0-9]*\)"/\1/p' ${1}) + WANT_HOST=$(cat ${DEST} | cut -d'.' -f1) + if [ "${CURR_HOST}" = "${WANT_HOST}" ]; then + echo "$0: WARNING: ${DEFINE} is already the same: ${CURR_HOST} == ${WANT_HOST}" >&2 + exit 0 + fi + sed -i 's/#define\s*'${DEFINE}'\s*"\([a-zA-Z0-9]*\)"/#define '${DEFINE}' "'$(cat ${DEST} | cut -d'.' -f1)'"/' ${1} +else + echo "$0: WARNING: ${DEST} not FOUND !" >&2 +fi |