From 5ad25fb23dc983ede48d210fda3c6e609e3c2482 Mon Sep 17 00:00:00 2001 From: guillaume Date: Wed, 16 Mar 2022 13:09:36 +0000 Subject: [PATCH] [UPDATE] - add muli server --- client/conf-client/exec.sh | 25 ++++++++++++++----------- client/conf-client/functions | 4 +++- client/conf-client/service.cfg | 6 ++---- client/conf-client/sonde.cfg | 8 ++++---- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/client/conf-client/exec.sh b/client/conf-client/exec.sh index f9c2f99..a324d69 100755 --- a/client/conf-client/exec.sh +++ b/client/conf-client/exec.sh @@ -7,18 +7,21 @@ 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} ${RemoteIp} ${RemotePort} " || NcCmd="timeout ${TimeOut} nc ${RemoteIp} ${RemotePort}" +[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} " || NcCmd="timeout ${TimeOut} nc " - -while read DATA - do - Cmd=$(echo $DATA| cut -d"#" -f1) - Arg=$(echo $DATA| cut -d"#" -f2) - Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} 2> /dev/null) - Ret=$? - PrintRes "${Res:-5|No sonde $Cmd on serveur $RemoteIp}" - PrintWeb "${Res:-5|No sonde $Cmd on serveur $RemoteIp}" $Cmd $Arg - done < ${SondeFile} +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 diff --git a/client/conf-client/functions b/client/conf-client/functions index 743dabc..7944d32 100644 --- a/client/conf-client/functions +++ b/client/conf-client/functions @@ -7,7 +7,7 @@ PrintRes() { PrintWeb() { - if [ ! -f /tmp/webmonithor ] + if [[ ! -f /tmp/webmonithor ]] || [[ "$1" == "START_TRATS" ]] then echo ' @@ -43,12 +43,14 @@ PrintWeb() { Txt=$(echo $1 | cut -d"|" -f2) Sonde=$2 Arg=$3 + Remote=$4 Color=red [[ $Val == "0" ]] && Color=green [[ $Val == "1" ]] && Color=yellow echo ' + '$Remote' '$Sonde' '$Arg' '$Val' diff --git a/client/conf-client/service.cfg b/client/conf-client/service.cfg index a679022..de5b09b 100644 --- a/client/conf-client/service.cfg +++ b/client/conf-client/service.cfg @@ -1,9 +1,7 @@ -RemoteIp=192.168.0.22 -RemotePort=8990 +RemoteIp=10.10.10.3:1666 LocalPassword='Evil@MonitoR-666' Crypted=no Rotation=1 TimeOut=2 -WebPort=8888 - +WebPort=80 diff --git a/client/conf-client/sonde.cfg b/client/conf-client/sonde.cfg index 3fd4222..352b702 100644 --- a/client/conf-client/sonde.cfg +++ b/client/conf-client/sonde.cfg @@ -1,4 +1,4 @@ -file#/tmp/coucou -file#/tmp/nop -file# -NotRealSondeName#reboot +10.10.10.3:1666#file#/tmp/coucou +10.10.10.3:1666#file#/tmp/nop +10.10.10.3:1666#file# +10.10.10.3:1666#NotRealSondeName#reboot