From 9b82a8944dbaf825afbbf491b0738ea6ba58d816 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Thu, 23 Jul 2020 21:12:48 +0200 Subject: [PATCH] Suppress output of `popd` and implement the help text. --- ddos-mitigator/superscript.sh | 46 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/ddos-mitigator/superscript.sh b/ddos-mitigator/superscript.sh index 5b3fac3..7fda27e 100755 --- a/ddos-mitigator/superscript.sh +++ b/ddos-mitigator/superscript.sh @@ -47,8 +47,42 @@ blue="\033[38;2;0;85;255m" bold="\033[1m" reset="\033[0m" +# Clean up when the script exits. +trap 'sudo -k; popd >/dev/null; rm -r ${tmpdir}' EXIT + +# Create a temp directory, chdir into it and create the (initially empty) +# banlist file. +tmpdir=$(mktemp -d) +# Suppress output of dir stack. +pushd "${tmpdir}" > /dev/null +touch "${banlist}" + function printHelp() { - echo "Help ... to be written." + cat < /dev/null -touch "${banlist}" - # Parse the command line options autopilot=0 netmask=0