aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_gns_config_lookup.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-10-25 10:57:35 +0200
committerChristian Grothoff <christian@grothoff.org>2018-10-25 10:58:10 +0200
commit9b52c9179b935f3afbf7119e37af2bf6685efa20 (patch)
tree5b79cd65fc0d79e54e7e9a632bb16140edeb6eeb /src/gns/test_gns_config_lookup.sh
parentf7c6752d8dcda6d73ea9ee93cc8cef1290c45c48 (diff)
downloadgnunet-9b52c9179b935f3afbf7119e37af2bf6685efa20.tar.gz
gnunet-9b52c9179b935f3afbf7119e37af2bf6685efa20.zip
add possibility of hijacking any (sub)domain, not just TLDs, via configuration file [gns] section
Diffstat (limited to 'src/gns/test_gns_config_lookup.sh')
-rwxr-xr-xsrc/gns/test_gns_config_lookup.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/gns/test_gns_config_lookup.sh b/src/gns/test_gns_config_lookup.sh
new file mode 100755
index 000000000..35d7c32d9
--- /dev/null
+++ b/src/gns/test_gns_config_lookup.sh
@@ -0,0 +1,44 @@
1#!/bin/bash
2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4
5LOCATION=$(which gnunet-config)
6if [ -z $LOCATION ]
7then
8 LOCATION="gnunet-config"
9fi
10$LOCATION --version 1> /dev/null
11if test $? != 0
12then
13 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
14 exit 77
15fi
16MY_EGO="myego"
17
18rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
19CFG=`mktemp --tmpdir=$PWD`
20cp test_gns_lookup.conf $CFG || exit 77
21which timeout &> /dev/null && DO_TIMEOUT="timeout 5"
22TEST_IP="dead::beef"
23gnunet-arm -s -c $CFG || exit 77
24gnunet-identity -C $MY_EGO -c $CFG
25EPUB=`gnunet-identity -d -c $CFG | grep $MY_EGO | awk '{print $3}'`
26gnunet-arm -e -c $CFG
27gnunet-config -c $CFG -s "gns" -o ".google.com" -V $EPUB
28gnunet-arm -s -c $CFG
29sleep 1
30gnunet-namestore -p -z $MY_EGO -a -n www -t AAAA -V $TEST_IP -e never -c $CFG
31RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.google.com -t AAAA -c $CFG`
32gnunet-namestore -z $MY_EGO -d -n www -t AAAA -V $TEST_IP -e never -c $CFG
33gnunet-identity -D $MY_EGO -c $CFG
34gnunet-arm -e -c $CFG
35rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME`
36rm $CFG
37
38if [ "$RES_IP" == "$TEST_IP" ]
39then
40 exit 0
41else
42 echo "Failed to resolve to proper IP, got $RES_IP."
43 exit 1
44fi