From 39afb4c8b75ba54f00941e18918255ad3699f809 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Tue, 22 Aug 2017 14:23:08 -0500 Subject: [PATCH] Added anti-redefinition headers to library scripts. --- lib/ArrayUtils.sh | 3 ++- lib/ColorUtils.sh | 3 ++- lib/FormatUtils.sh | 3 +++ lib/HashUtils.sh | 3 ++- lib/IOUtils.sh | 3 ++- lib/InterfaceUtils.sh | 4 +++- lib/SandboxUtils.sh | 3 ++- lib/ap/airbase-ng.sh | 3 +++ lib/ap/hostapd.sh | 3 +++ lib/installer/InstallerUtils.sh | 4 ++-- 10 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/ArrayUtils.sh b/lib/ArrayUtils.sh index 97ab15f..6aaaf4c 100755 --- a/lib/ArrayUtils.sh +++ b/lib/ArrayUtils.sh @@ -1,6 +1,7 @@ #!/bin/bash -ArrayUtilsVersion="1.0" +if [ "$ArrayUtilsVersion" ]; then return 0; fi +readonly ArrayUtilsVersion="1.0" # Due to the fact we're passing arrays via indirection, # we've got to mangle variable names used within array diff --git a/lib/ColorUtils.sh b/lib/ColorUtils.sh index c87df81..a4b617b 100755 --- a/lib/ColorUtils.sh +++ b/lib/ColorUtils.sh @@ -1,6 +1,7 @@ #!/bin/bash -SandboxUtilsVersion="1.0" +if [ "$ColorUtilsVersion" ]; then return 0; fi +readonly ColorUtilsVersion="1.0" ################################# < Shell Color Codes > ################################ readonly CRed="\e[1;31m" diff --git a/lib/FormatUtils.sh b/lib/FormatUtils.sh index ce407c0..f80940f 100644 --- a/lib/FormatUtils.sh +++ b/lib/FormatUtils.sh @@ -1,5 +1,8 @@ #!/bin/bash +if [ "$FormatUtilsVersion" ]; then return 0; fi +readonly FormatUtilsVersion="1.0" + FormatTabLength=8 FormatValidSpecifiers='%([+-]?([0-9]+|\*)?(\.([0-9]+|\*))?)?[bqdiouxXfeEgGcsnaA]' diff --git a/lib/HashUtils.sh b/lib/HashUtils.sh index b5ac1dc..b2d812a 100755 --- a/lib/HashUtils.sh +++ b/lib/HashUtils.sh @@ -1,6 +1,7 @@ #!/bin/bash -HashUtilsVersion="1.0" +if [ "$HashUtilsVersion" ]; then return 0; fi +readonly HashUtilsVersion="1.0" HashOutputDevice="/dev/stdout" diff --git a/lib/IOUtils.sh b/lib/IOUtils.sh index 0787268..323a103 100755 --- a/lib/IOUtils.sh +++ b/lib/IOUtils.sh @@ -1,6 +1,7 @@ #!/bin/bash -IOUtilsVersion="1.0" +if [ "$IOUtilsVersion" ]; then return 0; fi +readonly IOUtilsVersion="1.0" IOUtilsHeader="[x] ================================ [x]" IOUtilsQueryMark="[-] " diff --git a/lib/InterfaceUtils.sh b/lib/InterfaceUtils.sh index 22b0930..e0a5170 100644 --- a/lib/InterfaceUtils.sh +++ b/lib/InterfaceUtils.sh @@ -1,8 +1,10 @@ #!/bin/bash +if [ "$InterfaceUtilsVersion" ]; then return 0; fi +readonly InterfaceUtilsVersion="1.0" + # The methods used in this script are taken from airmon-ng. # This is all thanks for the airmon-ng authors, thanks guys. - InterfaceUtilsOutputDevice="/dev/stdout" if [ -d /sys/bus/usb ] # && hash lsusb diff --git a/lib/SandboxUtils.sh b/lib/SandboxUtils.sh index 08a6805..52aa9e6 100755 --- a/lib/SandboxUtils.sh +++ b/lib/SandboxUtils.sh @@ -1,6 +1,7 @@ #!/bin/bash -SandboxUtilsVersion="1.0" +if [ "$SandboxUtilsVersion" ]; then return 0; fi +readonly SandboxUtilsVersion="1.0" SandboxWorkspacePath="/tmp/sandbox" SandboxOutputDevice="/dev/stdout" diff --git a/lib/ap/airbase-ng.sh b/lib/ap/airbase-ng.sh index 530662b..bdcc193 100644 --- a/lib/ap/airbase-ng.sh +++ b/lib/ap/airbase-ng.sh @@ -1,5 +1,8 @@ #!/bin/bash +if [ "$APServiceVersion" ]; then return 0; fi +readonly APServiceVersion="1.0" + VIGW="at0" VIAP=$WIAccessPoint diff --git a/lib/ap/hostapd.sh b/lib/ap/hostapd.sh index 0b55c6b..96c30bc 100644 --- a/lib/ap/hostapd.sh +++ b/lib/ap/hostapd.sh @@ -1,5 +1,8 @@ #!/bin/bash +if [ "$APServiceVersion" ]; then return 0; fi +readonly APServiceVersion="1.0" + VIGW=$WIAccessPoint VIAP=$WIAccessPoint diff --git a/lib/installer/InstallerUtils.sh b/lib/installer/InstallerUtils.sh index ce74ab0..98d638e 100644 --- a/lib/installer/InstallerUtils.sh +++ b/lib/installer/InstallerUtils.sh @@ -1,7 +1,7 @@ #!/bin/bash -#if [ "$InstallerUtilsVersion" ]; then return 0; fi -# readonly InstallerUtilsVersion="1.0" +if [ "$InstallerUtilsVersion" ]; then return 0; fi +readonly InstallerUtilsVersion="1.0" InstallerUtilsWorkspacePath="/tmp/verspace"