Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
241ee2385f | ||
|
|
6beee1e2ba | ||
|
|
5d89ac6417 | ||
|
|
c4801fa8dc | ||
|
|
44e406c80f | ||
|
|
06caf72a34 | ||
| 19accb4c0e | |||
| 5718426164 | |||
| 86011bbacf | |||
| 2f2a283f7e | |||
| 2ff5c979b5 | |||
| 8fd4776f92 | |||
| ffc9ad66ed | |||
| 3de8864695 | |||
| 0fb4bdf279 | |||
| ae439aed2d |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
client/web/index.html
|
client/web/index.html
|
||||||
build
|
build/*
|
||||||
|
|||||||
@ -6,7 +6,7 @@ MoniThor is a simple monitoring tools in bash.
|
|||||||
|
|
||||||
You can use it with netcat or cryptcat
|
You can use it with netcat or cryptcat
|
||||||
|
|
||||||
You can see result on the client from a web page (self hosted python web server)
|
You can see result on the client from a web page (self hosted python3 web server)
|
||||||
|
|
||||||
|
|
||||||
## Server Configuration
|
## Server Configuration
|
||||||
@ -160,7 +160,7 @@ sudo /etc/init.d/monithor-c start/stop
|
|||||||
|
|
||||||
### WEB
|
### WEB
|
||||||
|
|
||||||
The client start a python sumple http server on localhost on `WebPort`
|
The client start a python3 sumple http server on localhost on `WebPort`
|
||||||
|
|
||||||
```
|
```
|
||||||
/usr/local/bin/monithor-client.d/MoniThorWebServer
|
/usr/local/bin/monithor-client.d/MoniThorWebServer
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
doc/monithor-client.1.gz
Normal file
BIN
doc/monithor-client.1.gz
Normal file
Binary file not shown.
@ -1,28 +1,15 @@
|
|||||||
---
|
---
|
||||||
Title: MONITHOR-CLIENT
|
title: monithor-client
|
||||||
section: 1
|
section: 1
|
||||||
header: Serveur bash de monitoring
|
author: Guillaume Astier Ruiz
|
||||||
footer: monithor-server 1.7
|
date: 20220320
|
||||||
date: January 13, 2022
|
...
|
||||||
---
|
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
NAME
|
|
||||||
=====
|
|
||||||
|
|
||||||
** monithor-client ** - service
|
|
||||||
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
=====
|
|
||||||
|
|
||||||
`/usr/local/bin/monithor-client [start/stop]`
|
|
||||||
|
|
||||||
`/etc/init.d/monithor-c [start/stop]`
|
`/etc/init.d/monithor-c [start/stop]`
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
DESCRIPTION
|
|
||||||
=====
|
|
||||||
|
|
||||||
monithor-client(1) permet de surveiller votre système d'information
|
monithor-client(1) permet de surveiller votre système d'information
|
||||||
|
|
||||||
@ -30,10 +17,9 @@ monithor-client(1) permet de surveiller votre système d'information
|
|||||||
|
|
||||||
- il peut aussi utiliser cryptcat (chiffré)
|
- il peut aussi utiliser cryptcat (chiffré)
|
||||||
|
|
||||||
- un serveur web en python est lancé sur votre machine de monitoring
|
- un serveur web en python3 est lancé sur votre machine de monitoring
|
||||||
|
|
||||||
INIT.D
|
# INIT.D
|
||||||
======
|
|
||||||
|
|
||||||
le service peut être démarré et arrêté via system V
|
le service peut être démarré et arrêté via system V
|
||||||
|
|
||||||
@ -43,17 +29,14 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
- Arrêt
|
- Arrêt
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-c stop`
|
||||||
|
|
||||||
CONFIGURATION SERVICE
|
# CONFIGURATION SERVICE
|
||||||
=====
|
|
||||||
|
|
||||||
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
||||||
|
|
||||||
`$ cat etc/monithor-client/service.cfg `
|
`$ cat etc/monithor-client/service.cfg `
|
||||||
|
|
||||||
`RemoteIp=10.10.10.3:1666 `
|
|
||||||
|
|
||||||
`LocalPassword='Evil@MonitoR-666'`
|
`LocalPassword='Evil@MonitoR-666'`
|
||||||
|
|
||||||
`Crypted=no`
|
`Crypted=no`
|
||||||
@ -64,8 +47,6 @@ CONFIGURATION SERVICE
|
|||||||
|
|
||||||
`WebPort=80`
|
`WebPort=80`
|
||||||
|
|
||||||
* RemoteIp : correspond au couple adresse IP/Port de l'interface réseau utilisée
|
|
||||||
|
|
||||||
* LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
* LocalPassword : correspond au mot de passe utilisé pour chiffré la connexion si Crypted est à "yes"
|
||||||
|
|
||||||
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
||||||
@ -74,10 +55,9 @@ CONFIGURATION SERVICE
|
|||||||
|
|
||||||
* TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde
|
* TimeOut : correspond à la valeur en seconde (float) du temps maximal d'éxécution de chaque sonde
|
||||||
|
|
||||||
* WebPort : correpond au port utilisé pour lancer le serveur web python
|
* WebPort : correpond au port utilisé pour lancer le serveur web python3
|
||||||
|
|
||||||
CONFIGURATION SONDE
|
# CONFIGURATION SONDE
|
||||||
=====
|
|
||||||
|
|
||||||
- La configuration des sondes est stocké dans le répertoires :
|
- La configuration des sondes est stocké dans le répertoires :
|
||||||
|
|
||||||
|
|||||||
BIN
doc/monithor-server.1.gz
Normal file
BIN
doc/monithor-server.1.gz
Normal file
Binary file not shown.
@ -1,28 +1,18 @@
|
|||||||
---
|
---
|
||||||
Title: MONITHOR-SERVER
|
title: monithor-server
|
||||||
section: 1
|
section: 1
|
||||||
header: Serveur bash de monitoring
|
author: Guillaume Astier Ruiz
|
||||||
footer: monithor-server 1.7
|
date: 20220320
|
||||||
date: January 13, 2022
|
...
|
||||||
---
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
`/usr/local/bin/monithor-d [start/stop]`
|
||||||
|
|
||||||
|
`/etc/init.d/monithor-d [start/stop]`
|
||||||
|
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
NAME
|
|
||||||
=====
|
|
||||||
|
|
||||||
** monithor-server ** - service
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
======
|
|
||||||
|
|
||||||
`/usr/local/bin/monithor-server [start/stop]`
|
|
||||||
|
|
||||||
`/etc/init.d/monithor-c [start/stop]`
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
=====
|
|
||||||
|
|
||||||
monithor-server(1) permet d'accépter des requêtes venant d'un instance monithor-client
|
monithor-server(1) permet d'accépter des requêtes venant d'un instance monithor-client
|
||||||
|
|
||||||
@ -36,18 +26,17 @@ le service peut être démarré et arrêté via system V
|
|||||||
|
|
||||||
- Démarrage
|
- Démarrage
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-d start`
|
||||||
|
|
||||||
- Arrêt
|
- Arrêt
|
||||||
|
|
||||||
`/etc/init.d/monithor-c start`
|
`/etc/init.d/monithor-d stop`
|
||||||
|
|
||||||
CONFIGURATION SERVICE
|
# CONFIGURATION SERVICE
|
||||||
=====
|
|
||||||
|
|
||||||
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
- Le fichier responsable de la gestion IP/PORT est : service.cfg
|
||||||
|
|
||||||
`LocalIp=10.10.10.4`
|
`RemoteIp=10.10.10.4`
|
||||||
|
|
||||||
`LocalPort=1666`
|
`LocalPort=1666`
|
||||||
|
|
||||||
@ -55,7 +44,7 @@ CONFIGURATION SERVICE
|
|||||||
|
|
||||||
`LocalPassword='Evil@MonitoR-666'`
|
`LocalPassword='Evil@MonitoR-666'`
|
||||||
|
|
||||||
* LocalIp : correspond à l'adresse IP de l'interface réseau en écoute
|
* RemoteIp : correspond à l'adresse IP de l'interface réseau en écoute du client de monitoring
|
||||||
|
|
||||||
* LocalPort : correspond au port de communication du client monithor
|
* LocalPort : correspond au port de communication du client monithor
|
||||||
|
|
||||||
@ -63,8 +52,7 @@ CONFIGURATION SERVICE
|
|||||||
|
|
||||||
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
* Crypted : si la valeur est à "yes" le binnaire crypcat est utilisé, si non netcat est utilisé
|
||||||
|
|
||||||
CONFIGURATION SONDE
|
# CONFIGURATION SONDE
|
||||||
=====
|
|
||||||
|
|
||||||
- La configuration des sondes est stocké dans le répertoires :
|
- La configuration des sondes est stocké dans le répertoires :
|
||||||
|
|
||||||
@ -78,15 +66,13 @@ Chaque sonde est composé de cette manière :
|
|||||||
|
|
||||||
* SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client
|
* SCRIPT : Script éxecuté sur l'instance avec le(s) argument(s) reçu(s) de monithor client
|
||||||
|
|
||||||
SCRIPT
|
# SCRIPT
|
||||||
=======
|
|
||||||
|
|
||||||
les scripts sont tous stocké dans le répertoire :
|
les scripts sont tous stocké dans le répertoire :
|
||||||
|
|
||||||
/usr/local/bin/monithor-server.d/
|
/usr/local/bin/monithor-server.d/
|
||||||
|
|
||||||
Exemple
|
# Exemple
|
||||||
======
|
|
||||||
|
|
||||||
* Configuration server :
|
* Configuration server :
|
||||||
|
|
||||||
@ -96,9 +82,9 @@ Exemple
|
|||||||
|
|
||||||
* Configuration client :
|
* Configuration client :
|
||||||
|
|
||||||
`$ cat /etc/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg`
|
`$ cat /etc/monithor-client/etc/monithor-client/conf/sample.cfg
|
||||||
|
|
||||||
`10.10.10.3:1666#part#/home/isen|50|80`
|
`#10.10.10.3:1666#part#/home/isen|50|80`
|
||||||
|
|
||||||
* Explication
|
* Explication
|
||||||
|
|
||||||
@ -112,6 +98,8 @@ SERVEUR exécute : /usr/local/bin/monithor-server.d/part-space.sh /home/isen 50
|
|||||||
|
|
||||||
SERVEUR renvoie les valeur récupéré à CLIENT
|
SERVEUR renvoie les valeur récupéré à CLIENT
|
||||||
|
|
||||||
|
Les lignes commençant par '#' sont à supprimer ou à décommenter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
38
generate.sh
38
generate.sh
@ -25,12 +25,15 @@ CheckDep() {
|
|||||||
|
|
||||||
GitVersion() {
|
GitVersion() {
|
||||||
|
|
||||||
LastTag=$(git tag | sed "s/^V//g" | cut -d"-" -f1 | sort | tail -n1)
|
LastTag=$(git tag | sed "s/^V//g" | cut -d"-" -f1 | sort -n -k2 -t. | tail -n1)
|
||||||
NewTag=${LastTag}-rebuild
|
NewTag=${LastTag}-rebuild
|
||||||
}
|
}
|
||||||
|
|
||||||
CpArchName() {
|
CpArchName() {
|
||||||
cp -Rf monithor-${1} /tmp/monithor-${1}_${2}_all
|
|
||||||
|
rm -Rf /tmp/monithor-*
|
||||||
|
cp -Rf ${Wai}/monithor-${1} /tmp/monithor-${1}_${2}_all
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -43,9 +46,10 @@ BuildDeb(){
|
|||||||
echo -n "Gen monithor-${1} [$2] : "
|
echo -n "Gen monithor-${1} [$2] : "
|
||||||
cd /tmp/ &> /dev/null
|
cd /tmp/ &> /dev/null
|
||||||
Dist=$(lsb_release -a 2> /dev/null | grep Distributor |awk '{print $NF}' |tr '[:upper:]' '[:lower:]')
|
Dist=$(lsb_release -a 2> /dev/null | grep Distributor |awk '{print $NF}' |tr '[:upper:]' '[:lower:]')
|
||||||
[[ $Dist == "ubuntu" ]] && Compress=' -z 0'
|
[[ $Dist == "ubuntu" ]] && Compress=' -Z gzip -S fixed '
|
||||||
dpkg-deb ${Compress} --build --root-owner-group monithor-${1}_${2}_all &> /dev/null
|
dpkg-deb ${Compress} --build --root-owner-group monithor-${1}_${2}_all &> /dev/null
|
||||||
[[ "$?" -eq "0" ]] && echo "OK" || echo "FAILED"
|
[[ "$?" -eq "0" ]] && echo "OK" || echo "FAILED"
|
||||||
|
cp monithor-*deb ${Wai}/build
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,17 +61,10 @@ CleanTemp() {
|
|||||||
|
|
||||||
ManPage() {
|
ManPage() {
|
||||||
|
|
||||||
if [[ $2 == "create" ]]
|
mkdir -p /tmp/monithor-${1}_${2}_all/usr/share/man/man1/
|
||||||
then
|
|
||||||
pandoc -s -t man ${Wai}/doc/monithor-${1}.md -o ${Wai}/doc/monithor-${1}.1
|
pandoc -s -t man ${Wai}/doc/monithor-${1}.md -o /tmp/monithor-${1}_${2}_all/usr/share/man/man1/monithor-${1}.1
|
||||||
gzip ${Wai}/doc/monithor-${1}.1
|
gzip /tmp/monithor-${1}_${2}_all/usr/share/man/man1/monithor-${1}.1
|
||||||
cp ${Wai}/doc/monithor-${1}.1.gz ${Wai}/monithor-${1}/usr/local/man/fr/man1/
|
|
||||||
fi
|
|
||||||
if [[ $2 == "delete" ]]
|
|
||||||
then
|
|
||||||
rm ${Wai}/monithor-${1}/usr/local/man/fr/man1/*
|
|
||||||
rm ${Wai}/doc/monithor-${1}.1.gz
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ ! -z $1 ]] && usage
|
[[ ! -z $1 ]] && usage
|
||||||
@ -76,14 +73,11 @@ CheckDep
|
|||||||
GitVersion
|
GitVersion
|
||||||
|
|
||||||
CpArchName server $NewTag
|
CpArchName server $NewTag
|
||||||
CpArchName client $NewTag
|
|
||||||
SedControl server $NewTag
|
SedControl server $NewTag
|
||||||
SedControl client $NewTag
|
ManPage server $NewTag
|
||||||
ManPage client create
|
|
||||||
ManPage server create
|
|
||||||
BuildDeb client $NewTag
|
|
||||||
BuildDeb server $NewTag
|
BuildDeb server $NewTag
|
||||||
ManPage client delete
|
|
||||||
ManPage server delete
|
|
||||||
|
|
||||||
CleanTemp
|
CpArchName client $NewTag
|
||||||
|
SedControl client $NewTag
|
||||||
|
ManPage client ${NewTag}
|
||||||
|
BuildDeb client $NewTag
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Package: monithor-client
|
Package: monithor-client
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Dependsd:netcat,cryptcat,screen,python,netcat,cryptcat,elinks
|
Dependsd:netcat,cryptcat,screen,python3,netcat,cryptcat,elinks
|
||||||
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
||||||
Description: monithor client (with simple http server python)
|
Description: monithor client (with simple http server python3)
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mandb
|
echo "Update man page"
|
||||||
|
mkdir /var/cache/man/oldlocal/fr -p
|
||||||
|
mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mandb
|
echo "Update man page"
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
mkdir /var/cache/man/oldlocal/fr -p
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
# Provides: monithor-c
|
# Provides: monithor-c
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop:
|
# Default-Stop:
|
||||||
# Short-Description: MoniThor Server
|
# Short-Description: MoniThor client
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@ -21,15 +21,20 @@ case "$1" in
|
|||||||
logger "monithor-client is running ..."
|
logger "monithor-client is running ..."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
logger "Starting MoniThor Server"
|
logger "Starting MoniThor client "
|
||||||
/usr/local/bin/monithor-client start
|
/usr/local/bin/monithor-client start
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
logger "Stoping MoniThor server" "monithor-c" || true
|
logger "Stoping MoniThor client " "monithor-c" || true
|
||||||
/usr/local/bin/monithor-client stop
|
/usr/local/bin/monithor-client stop
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
logger "status MoniThor client " "monithor-c" || true
|
||||||
|
[ $(ps axf| grep MoniThor | grep SCREEN | wc -l) -gt 1 ] && echo "monithor-c is running" || echo "montihor-c is dead"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/monithor-c {start|stop|status}" || true
|
echo "Usage: /etc/init.d/monithor-c {start|stop|status}" || true
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
10.10.10.3:1666#file#/tmp/test
|
|
||||||
10.10.10.3:1666#part#/home/isen|50|80
|
|
||||||
10.10.10.3:1666#process#sshd
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
10.10.10.4:1666#file#/tmp/test
|
|
||||||
10.10.10.4:1666#part#/home/isen|50|80
|
|
||||||
10.10.10.4:1666#process#sshd
|
|
||||||
4
monithor-client/etc/monithor-client/conf/sample.cfg
Normal file
4
monithor-client/etc/monithor-client/conf/sample.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#IP:PORT#SONDE#ARGUMENT
|
||||||
|
#Ex :
|
||||||
|
#10.10.10.3:1666#part#/home/isen|50|80
|
||||||
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
RemoteIp=10.10.10.3:1666
|
|
||||||
LocalPassword='Evil@MonitoR-666'
|
LocalPassword='Evil@MonitoR-666'
|
||||||
Crypted=no
|
Crypted=no
|
||||||
Rotation=1
|
Rotation=1
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
10.10.10.3:1666#file#/tmp/coucou
|
|
||||||
10.10.10.3:1666#file#/tmp/nop
|
|
||||||
10.10.10.3:1666#file#
|
|
||||||
10.10.10.3:1666#NotRealSondeName#reboot
|
|
||||||
10.10.10.4:1666#file#/tmp/coucou
|
|
||||||
10.10.10.4:1666#file#/tmp/nop
|
|
||||||
10.10.10.4:1666#file#
|
|
||||||
10.10.10.4:1666#NotRealSondeName#reboot
|
|
||||||
@ -1,12 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /etc/monithor-client/service.cfg
|
source /etc/monithor-client/service.cfg
|
||||||
Ip=$(echo $RemoteIp| cut -d":" -f1)
|
|
||||||
|
|
||||||
Exit () {
|
Exit () {
|
||||||
|
|
||||||
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
||||||
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -16,15 +14,13 @@ if [[ $(id -u) != "0" ]]
|
|||||||
Exit root
|
Exit root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ! -z $(ifconfig | grep inet | awk '{print $2}' | grep $Ip) ]] && Exit Config
|
|
||||||
|
|
||||||
if [[ "$1" == "start" ]]
|
if [[ "$1" == "start" ]]
|
||||||
then
|
then
|
||||||
[[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor
|
[[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor
|
||||||
rm /tmp/Monitor* /tmp/webmonithor &> /dev/null
|
rm /tmp/Monitor* /tmp/webmonithor &> /dev/null
|
||||||
|
|
||||||
TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg|wc -l)
|
TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep .*\.cfg| wc -l)
|
||||||
for Conf in $(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg)
|
for Conf in $(ls -1 /etc/monithor-client/conf/ | grep .*\.cfg)
|
||||||
do
|
do
|
||||||
screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf}
|
screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf}
|
||||||
done
|
done
|
||||||
@ -33,7 +29,7 @@ fi
|
|||||||
|
|
||||||
if [[ "$1" == "stop" ]]
|
if [[ "$1" == "stop" ]]
|
||||||
then
|
then
|
||||||
killall python &> /dev/null
|
killall python3 &> /dev/null
|
||||||
rm /tmp/Monithor* &> /dev/null
|
rm /tmp/Monithor* &> /dev/null
|
||||||
touch /tmp/endmonitor
|
touch /tmp/endmonitor
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,19 @@ while [[ ! -f /tmp/endmonitor ]]
|
|||||||
GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp
|
GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp
|
||||||
sleep ${Rotation}
|
sleep ${Rotation}
|
||||||
else
|
else
|
||||||
while read DATA
|
while read DATA
|
||||||
do
|
do
|
||||||
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
|
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
|
||||||
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
|
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
|
||||||
Cmd=$(echo $DATA| cut -d"#" -f2)
|
Cmd=$(echo $DATA| cut -d"#" -f2)
|
||||||
Arg=$(echo $DATA| cut -d"#" -f3)
|
Arg=$(echo $DATA| cut -d"#" -f3)
|
||||||
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
|
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
|
||||||
Ret=$?
|
Ret=$?
|
||||||
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp
|
if [[ ! -z $(echo $DATA | grep ^"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*#.*#" ) ]]
|
||||||
done < /etc/monithor-client/conf/${ConfFile}
|
then
|
||||||
|
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp
|
||||||
|
fi
|
||||||
|
done < /etc/monithor-client/conf/${ConfFile}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ CheckAllEnd() {
|
|||||||
echo '
|
echo '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>MoniThor on '${RemoteIp}' </title>
|
<title>MoniThor on '$(hostname)' </title>
|
||||||
<meta http-equiv="refresh" content="1" />
|
<meta http-equiv="refresh" content="1" />
|
||||||
</head>
|
</head>
|
||||||
<title>MONITHOR</title>
|
<title>MONITHOR</title>
|
||||||
|
|||||||
@ -3,18 +3,20 @@
|
|||||||
|
|
||||||
pushd /var/www/html/monithor
|
pushd /var/www/html/monithor
|
||||||
source /usr/local/bin/monithor-client.d/MoniThorFnct
|
source /usr/local/bin/monithor-client.d/MoniThorFnct
|
||||||
python -m SimpleHTTPServer ${1} &
|
python3 -m http.server ${1} &
|
||||||
|
|
||||||
|
|
||||||
echo '<html>
|
echo '<html>
|
||||||
<head>
|
<head>
|
||||||
<title>MoniThor on '${RemoteIp}' </title>
|
<title>MoniThor on '$(hostname)' </title>
|
||||||
<meta http-equiv="refresh" content="1" />
|
<meta http-equiv="refresh" content="1" />
|
||||||
</head>
|
</head>
|
||||||
<title>MONITHOR</title>
|
<title>MONITHOR</title>
|
||||||
|
|
||||||
!!!! Initialization !!!!
|
!!!! Initialization !!!!
|
||||||
|
|
||||||
|
Warning : check the config /etc/monithor-client/conf/*cfg
|
||||||
|
|
||||||
' > index.html
|
' > index.html
|
||||||
|
|
||||||
while [[ ! -f /tmp/endmonitor ]]
|
while [[ ! -f /tmp/endmonitor ]]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Package: monithor-client
|
Package: monithor-server
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Dependsd:netcat,cryptcat,screen,python,netcat,cryptcat,elinks
|
Dependsd:netcat,cryptcat,screen,python3,netcat,cryptcat,elinks
|
||||||
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
Maintainer: Guillaume Astier <guillaume@gastier.net>
|
||||||
Description: monithor client (with simple http server python)
|
Description: monithor server (netcat & snort)
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mandb
|
echo "Update man page"
|
||||||
|
#mkdir /var/cache/man/oldlocal/fr -p
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mandb
|
echo "Update man page"
|
||||||
|
#mandb 2>&1 > /dev/null
|
||||||
|
|
||||||
|
echo "Fin d'installation"
|
||||||
|
|
||||||
|
mkdir -p /var/cache/man/oldlocal/fr
|
||||||
|
|||||||
@ -30,6 +30,13 @@ case "$1" in
|
|||||||
/usr/local/bin/monithor-server stop
|
/usr/local/bin/monithor-server stop
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
logger "status MoniThor server" "monithor-d" || true
|
||||||
|
[ "$(ps axf| grep '/usr/local/bin/monithor-server'|grep -v grep)" ] && echo "monithor-d is running" || echo "montihor-d is dead"
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: /etc/init.d/monithor-d {start|stop|status}" || true
|
echo "Usage: /etc/init.d/monithor-d {start|stop|status}" || true
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
LocalIp=10.10.10.4
|
RemoteIp=10.10.10.4
|
||||||
LocalPort=1666
|
LocalPort=1666
|
||||||
########
|
########
|
||||||
Crypted=no
|
Crypted=no
|
||||||
|
|||||||
@ -8,7 +8,7 @@ source /etc/monithor-server/service.cfg
|
|||||||
Exit () {
|
Exit () {
|
||||||
|
|
||||||
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
[[ "$1" == "root" ]] && echo "You have to be root ..."
|
||||||
[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
#[[ "$1" == "Config" ]] && echo "Ip configuration will failed"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -18,17 +18,17 @@ if [[ $(id -u) != "0" ]]
|
|||||||
Exit root
|
Exit root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -z $(ifconfig | grep inet | awk '{print $2}' | grep $LocalIp) ]] && Exit Config
|
#[[ -z $(ifconfig | grep inet | awk '{print $2}' | grep $RemoteIp) ]] && Exit Config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort} " || NcCmd="nc -l ${LocalIp} ${LocalPort}"
|
[[ "${Crypted}" == "yes" ]] && NcCmd="cryptcat -k ${LocalPassword} -l ${RemoteIp} -p ${LocalPort} " || NcCmd="nc -l ${RemoteIp} -p ${LocalPort}"
|
||||||
|
|
||||||
if [[ "${1}" == "start" ]]
|
if [[ "${1}" == "start" ]]
|
||||||
then
|
then
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
#coproc cryptcat -k ${LocalPassword} -l ${LocalIp} -p ${LocalPort}
|
#coproc cryptcat -k ${LocalPassword} -l ${RemoteIp} -p ${LocalPort}
|
||||||
coproc eval ${NcCmd}
|
coproc eval ${NcCmd}
|
||||||
while read -r cmd; do
|
while read -r cmd; do
|
||||||
logger "Running $cmd"
|
logger "Running $cmd"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user