diff --git a/agent.sh b/agent.sh index fe1ed06..b7c5290 100755 --- a/agent.sh +++ b/agent.sh @@ -1,6 +1,9 @@ #!/bin/bash #PASSWD +id=$1 +log_f="log.tmp" +center="mickael@172.16.131.74" if [ "$PASS" = "" ] then @@ -11,10 +14,6 @@ then sed -e 's/^#PASSWD/PASS="'$PASS'"/g' agent.sh > agent.tmp.sh fi -id=$1 -log_f="log.tmp" - -center="mickael@172.16.131.74" host=$USER"@"$(ip a | grep "inet " | tail -1 | cut -d " " -f 6 | cut -d "/" -f 1) @@ -32,12 +31,15 @@ sshpass -p $PASS ssh-copy-id -o StrictHostKeyChecking=no $center 2> /dev/null; scp -o StrictHostKeyChecking=no $host:config $remote:config; scp -o StrictHostKeyChecking=no $host:agent.tmp.sh $remote:agent.tmp.sh; -scp -o StrictHostKeyChecking=no $host:analyze.sh $remote:analyze.sh; +scp -o StrictHostKeyChecking=no $host:analyze.tmp.sh $remote:analyze.tmp.sh; chmod u+x agent.tmp.sh; -chmod u+x analyze.sh; -./analyze.sh $log_f; +chmod u+x analyze.tmp.sh; +./analyze.tmp.sh $log_f; scp -o StrictHostKeyChecking=no $log_f $center:log/log-$remote; rm $log_f; ./agent.tmp.sh $id;" fi +rm agent.tmp.sh 2> /dev/null +rm config 2> /dev/null +rm analyze.tmp.sh 2> /dev/null diff --git a/config b/config deleted file mode 100644 index e69de29..0000000 diff --git a/config-save b/config-save index 7b7fea6..e272a38 100644 --- a/config-save +++ b/config-save @@ -1,2 +1,2 @@ mickael@172.16.131.32 -mickael@172.16.131.74 \ No newline at end of file +mickael@172.16.131.27 \ No newline at end of file diff --git a/launcher.sh b/launcher.sh new file mode 100755 index 0000000..6aacc18 --- /dev/null +++ b/launcher.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +agents=1 + +cp config-save config +cp analyze.sh analyze.tmp.sh + +echo -n "password : " +read -s input +echo "" + +for i in $(seq $agents) +do + echo $input | ./agent.sh $i +done