first commit

This commit is contained in:
Souti
2025-03-06 11:09:58 +01:00
commit 11f7d440ff
330 changed files with 38306 additions and 0 deletions

54
livebox_fibre.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# Paramètres
LIVEBOX_IP="192.168.1.1"
USERNAME="admin"
PASSWORD="HYJcanGE" # Change avec ton vrai mot de passe
CURL_OPTS="-s"
# 1⃣ Authentification - obtenir le contextID
CONTEXT_ID=$(curl $CURL_OPTS -X POST "http://$LIVEBOX_IP/ws" \
-H "Content-Type: application/x-sah-ws-4-call+json" \
-H "Authorization: X-Sah-Login" \
-d "{
\"service\": \"sah.Device.Information\",
\"method\": \"createContext\",
\"parameters\": {
\"applicationName\": \"curl\",
\"username\": \"$USERNAME\",
\"password\": \"$PASSWORD\"
}
}" | jq -r '.data.contextID')
if [ -z "$CONTEXT_ID" ] || [ "$CONTEXT_ID" == "null" ]; then
echo "❌ Erreur d'authentification"
exit 1
fi
# 2⃣ Récupération de la liste des équipements connectés
DEVICE_LIST=$(curl $CURL_OPTS -X POST "http://$LIVEBOX_IP/ws" \
-H "Content-Type: application/x-sah-ws-4-call+json" \
-H "X-Context: $CONTEXT_ID" \
-d '{
"service": "NeMo.Intf.lan",
"method": "getMIBs",
"parameters": {
"mibs": "dhcp_leases"
}
}')
# 3⃣ Extraction et affichage propre
echo "📡 Appareils connectés :"
echo "$DEVICE_LIST" | jq -r '.data.dhcp_leases[] | "\(.IPAddress) - \(.HostName) - \(.MACAddress)"'
# Optionnel : déconnexion propre (fermeture de la session)
curl $CURL_OPTS -X POST "http://$LIVEBOX_IP/ws" \
-H "Content-Type: application/x-sah-ws-4-call+json" \
-H "X-Context: $CONTEXT_ID" \
-d '{
"service": "sah.Device.Information",
"method": "releaseContext",
"parameters": {}
}' > /dev/null