First commit

This commit is contained in:
mickael
2019-02-08 08:26:58 +01:00
commit 157f364251
5 changed files with 67 additions and 0 deletions

18
LogScript Executable file
View 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
View 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
View 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

0
config Normal file
View File

2
config-save Normal file
View File

@@ -0,0 +1,2 @@
mickael@172.16.131.33
mickael@172.16.131.74