diff --git a/agent.sh b/agent.sh index 9a6e2ec..fe1ed06 100755 --- a/agent.sh +++ b/agent.sh @@ -1,11 +1,18 @@ #!/bin/bash -PASS="" +#PASSWD -echo -n "password : " -read -s $PASS +if [ "$PASS" = "" ] +then + echo -n "password : " + read -s input + echo "" + PASS=$input + 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" @@ -24,10 +31,13 @@ sshpass -p $PASS ssh-copy-id -o StrictHostKeyChecking=no $host 2> /dev/null; 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.sh $remote:agent.sh; +scp -o StrictHostKeyChecking=no $host:agent.tmp.sh $remote:agent.tmp.sh; scp -o StrictHostKeyChecking=no $host:analyze.sh $remote:analyze.sh; -./analyze.sh; -scp -o StrictHostKeyChecking=no log $center:log/log-$remote; -rm log; -./agent.sh $id;" +chmod u+x agent.tmp.sh; +chmod u+x analyze.sh; +./analyze.sh $log_f; +scp -o StrictHostKeyChecking=no $log_f $center:log/log-$remote; +rm $log_f; +./agent.tmp.sh $id;" fi + diff --git a/analyze.sh b/analyze.sh index 3e2ed8c..878715a 100755 --- a/analyze.sh +++ b/analyze.sh @@ -1,15 +1,15 @@ #!/bin/bash # Indique au système que l'argument qui suit est le programme utilisé pour exécuter ce fichier # En règle générale, les "#" servent à mettre en commentaire le texte qui suit comme ici -touch log -echo PROCESS > log -ps >> log -echo TACHE >> log -echo PERIPHERIQUE >> log -lsusb >> log -lspci >> log -echo MODELE >> log -cat /proc/version >> log +file=$1 +echo PROCESS > $file +ps >> $file +echo TACHE >> $file +echo PERIPHERIQUE >> $file +lsusb >> $file +lspci >> $file +echo MODELE >> $file +cat /proc/version >> $file echo COPIE LOG diff --git a/config-save b/config-save index 1af0972..7b7fea6 100644 --- a/config-save +++ b/config-save @@ -1,2 +1,2 @@ -mickael@172.16.131.33 +mickael@172.16.131.32 mickael@172.16.131.74 \ No newline at end of file