Skip to content
Snippets Groups Projects
Verified Commit 909b75ee authored by David Beniamine's avatar David Beniamine
Browse files

Wip communication protocol to get registry on reseau

parent 26fca965
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# Copyright (C) 2018 Tetras Libre <Contact@Tetras-Libre.fr>
# Author: Beniamine, David <David.Beniamine@Tetras-Libre.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
netcat="netcat -l $IP 9999"
KPID=`ps aux | grep "$netcat" | awk '{print $2}'`
[ ! -z "$KPID" ] && kill $KPID
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
host=$subnet.52
port=9999
echo "get_registry" | netcat $host $port
nline=$($netcat | cut -d ' ' -f 1)
i=0;
for i in $(seq 1 $nline)
do
$netcat
done
......@@ -45,5 +45,13 @@ do
break
fi
done
elif [ $MAC == "get_registry" ]
then
hostfile="/etc/registry/hosts"
wc -l $hostfile | netcat $host $port
while read line
do
echo "$line" | netcat $host $port
done < $hostfile
fi
done
......@@ -22,7 +22,7 @@
<div id="box" style="font-size:large">
<div id="content">
<h1> Interface d'allumage de PC à distance </h1>
<h1> Interface de gestion des postes </h1>
<p>Merci d'indiquer l'adresse MAC du PC à réveiller</p>
<form action="index.php" method="post">
<input type="hidden" name="action" value="wake">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment