[INIT] - add client & server

This commit is contained in:
2022-03-16 10:02:26 +01:00
commit ec039ce26a
9 changed files with 104 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
cd $(dirname $0)/conf-server/
ScriptDir=$(pwd)/scripts/
SondeFile=$(pwd)/sonde.cfg
source service.cfg
echo "coproc cryptcat -k "${LocalPassword}" -l ${LocalIp} ${LocalPort}"
while true
do
coproc cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort}
while read -r cmd; do
logger "Running $cmd"
cpt=0
while read DATA
do
Sonde=$(echo ${DATA}| cut -d"#" -f1)
Exec=$(echo ${DATA}| cut -d"#" -f2)
RealCmd=$(echo ${cmd} | cut -d"#" -f1)
ArgCmd=$(echo ${cmd} | cut -d"#" -f2)
if [[ "${RealCmd}" == "$Sonde" ]]
then
logger "Exec $Exec $Arg $cpt"
bash ${ScriptDir}/${Exec} $ArgCmd
cpt=$((cpt+1))
break
fi
done < ${SondeFile}
[[ "${cpt}" -eq 0 ]] && logger "You Failed $Sonde $Exec $Arg"
done <&"${COPROC[0]}" >&"${COPROC[1]}"
done
@@ -0,0 +1,9 @@
Exit() {
Val=$(echo $1| cut -d"|" -f1)
Txt=$(echo $1| cut -d"|" -f2)
echo "$Val|$Txt"
exit $Val
}
@@ -0,0 +1,12 @@
#!/bin/bash
source $(dirname $0)/FunctionOutput
File="${1}"
[[ -z ${File} ]] && Exit "5|no argument"
[[ -f ${File} ]] && Exit "0|File $File exist" || Exit "2|File $File is NOT present"
+3
View File
@@ -0,0 +1,3 @@
LocalIp=127.0.0.1
LocalPort=8080
LocalPassword='Evil@MonitoR-666'
+3
View File
@@ -0,0 +1,3 @@
network#ip.sh
file#file-present.sh