Changed the way variables for binaries are created
This commit is contained in:
parent
ceae25a8b6
commit
ab955c9fa5
@ -24,27 +24,29 @@
|
|||||||
# Version 0.1
|
# Version 0.1
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
Nmap="/usr/bin/nmap"
|
Which="/bin/which"
|
||||||
Sed="/bin/sed"
|
Binaries=(nmap sed awk printf ls grep cut tr head)
|
||||||
Awk="/usr/bin/awk"
|
|
||||||
Printf="/usr/bin/printf"
|
|
||||||
Ls="/bin/ls"
|
|
||||||
Grep="/bin/grep"
|
|
||||||
Cut="/usr/bin/cut"
|
|
||||||
Tr="/usr/bin/tr"
|
|
||||||
Head="/usr/bin/head"
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
Version="0.1"
|
Version="0.1"
|
||||||
Plugindir="dummy_checks"
|
Plugindir="dummy_checks/"
|
||||||
|
|
||||||
# Sanity check
|
|
||||||
for Bin in $Nmap $Sed $Awk $Printf; do
|
# Sanity check binaries and create variables for them
|
||||||
if [ ! -x $Bin ]; then
|
Count=0
|
||||||
echo "Can't execute $Bin"
|
for i in ${Binaries[@]}; do
|
||||||
|
$Which $i &> /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
declare $(echo ${Binaries[$Count]^}=`${Which} $i`)
|
||||||
|
((Count++))
|
||||||
|
else
|
||||||
|
echo "It seems you don't have ${Binaries[$Count]} installed"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Define functions
|
||||||
print_usage()
|
print_usage()
|
||||||
{
|
{
|
||||||
$Printf "Usage: `basename $0` -H <host> -o <output-file> -h (help)\n"
|
$Printf "Usage: `basename $0` -H <host> -o <output-file> -h (help)\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user