28 lines
924 B
Bash
Executable File

#!/bin/bash
cd $(dirname $0)
SondeFile=$(pwd)/sonde.cfg
source service.cfg
source functions
#[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} ${RemoteIp} ${RemotePort} " || NcCmd="timeout ${TimeOut} nc ${RemoteIp} ${RemotePort}"
[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} " || NcCmd="timeout ${TimeOut} nc "
PrintWeb START_TRATS
while read DATA
do
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
Cmd=$(echo $DATA| cut -d"#" -f2)
Arg=$(echo $DATA| cut -d"#" -f3)
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
Ret=$?
PrintRes "${Res:-5|No sonde $Cmd on serveur $Remote}"
PrintWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata}
done < ${SondeFile}
PrintWeb END_DNE