First commit
This commit is contained in:
18
LogScript
Executable file
18
LogScript
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/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
|
||||||
|
echo pwd
|
||||||
|
touch log
|
||||||
|
echo PROCESS > log
|
||||||
|
ps >> log
|
||||||
|
echo TACHE >> log
|
||||||
|
echo PERIPHERIQUE >> log
|
||||||
|
lsusb >> log
|
||||||
|
lspci >> log
|
||||||
|
echo MODELE >> log
|
||||||
|
cat /proc/version >> log
|
||||||
|
echo COPIE LOG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
30
agent.sh
Executable file
30
agent.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PASS="agent123"
|
||||||
|
|
||||||
|
id=$1
|
||||||
|
|
||||||
|
center="mickael@172.16.131.74"
|
||||||
|
|
||||||
|
host=$USER"@"$(ip a | grep "inet " | tail -1 | cut -d " " -f 6 | cut -d "/" -f 1)
|
||||||
|
|
||||||
|
remote=$(sed -n "1p" config)
|
||||||
|
|
||||||
|
if [ "$remote" != "" ]
|
||||||
|
then
|
||||||
|
echo "From : "$host
|
||||||
|
echo "To : "$remote
|
||||||
|
sed -i "1d" config
|
||||||
|
sshpass -p $PASS ssh-copy-id -o StrictHostKeyChecking=no $remote 2> /dev/null
|
||||||
|
ssh $remote "
|
||||||
|
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:analyze.sh $remote:analyze.sh;
|
||||||
|
./analyze.sh;
|
||||||
|
scp -o StrictHostKeyChecking=no log $center:log/log-$remote;
|
||||||
|
rm log;
|
||||||
|
./agent.sh $id;"
|
||||||
|
fi
|
||||||
17
analyze.sh
Executable file
17
analyze.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/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
|
||||||
|
echo COPIE LOG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2
config-save
Normal file
2
config-save
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mickael@172.16.131.33
|
||||||
|
mickael@172.16.131.74
|
||||||
Reference in New Issue
Block a user