From 9fe2c2160c13d02d1c4dc688e0df1a9287a287f2 Mon Sep 17 00:00:00 2001 From: zeus Date: Fri, 26 Nov 2021 22:58:18 +0200 Subject: [PATCH] add tools --- tools/poc-dummy-create | 61 ++++++++++++++++++++++++++++++++++ tools/poc-dummy-log | 69 ++++++++++++++++++++++++++++++++++++++ tools/poc-dummy-ls | 52 +++++++++++++++++++++++++++++ tools/poc-dummy-rm | 69 ++++++++++++++++++++++++++++++++++++++ tools/poc-dummy-send | 75 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 326 insertions(+) create mode 100755 tools/poc-dummy-create create mode 100755 tools/poc-dummy-log create mode 100755 tools/poc-dummy-ls create mode 100755 tools/poc-dummy-rm create mode 100755 tools/poc-dummy-send diff --git a/tools/poc-dummy-create b/tools/poc-dummy-create new file mode 100755 index 0000000..aa798f2 --- /dev/null +++ b/tools/poc-dummy-create @@ -0,0 +1,61 @@ +#!/bin/bash + + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + TARGET="$(readlink "$SOURCE")" + if [[ $TARGET == /* ]]; then + #echo "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'" + SOURCE="$TARGET" + else + DIR="$( dirname "$SOURCE" )" + #echo "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')" + SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located + fi +done + +SRPATH="$( dirname "$SOURCE" )" +SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +if [ "$SFPATH" != "$SRPATH" ]; then + RDIR=$SRPATH # relativ path directory +fi + +cwdir=$PWD +wdir=$SFPATH + + +[ $# -eq 0 ] && { echo "Usage: $0 device-name"; exit 1; } +[ -z "$1" ] && { echo "Usage: $0 device-name"; exit 1; } + +dir="$1" + +dir1=/var/log-in/$dir + +ex=$(docker exec -it dummy_service /bin/bash -c "mkdir \"/var/log-in/$dir\"") +(docker exec -i dummy_service sh -c "cat > /tmp/send.sh") < /tmp/send.sh") < /tmp/send.sh") < /tmp/send.sh") <> $dir1/data") + +echo "" +echo "done!" +echo "" + + + + + + + + + + +