Allow to easily control Livebox 3/4 (internet box from Orange ISP) by CLI, easing home automation tasks.
- Clone the repository
- Install dependencies (
composer install
, see composer if you need more details) - run
php livebox/bin/livebox
Some commands require authentication, some not. An authentication file in yaml must be provided :
configuration:
# Optional: specify Livebox local DNS name or IP. Default to 192.168.1.1
host: 192.168.1.1
# Optional: specify user to use for connection
user: admin
password: pass
This authentication file can be passed by 2 different ways :
- Just make a
xxx.yml
that would lie with thelivebox
tool. It will be automatically handled. Note: For this option, commands will be shorter (such aslivebox wifi:switch on
instead oflivebox wifi:switch on --file=/path/to/yaml.yml
) but in this very case you shouldn't put those 2 files in/usr/bin/
, because this is not the configuration file place. - Make your YAML config file and explicitly pass it to commands.
As every Console component-based application, you can have detailled command list by doing livebox list
Note: as stated above, all commands below take one --file
option to pass a configuration file path
livebox wan:infos
Will return a json object with all following data
{"result": {
"status":true,
"data": {
"WanState":"up",
"LinkType":"dsl",
"LinkState":"up",
"MACAddress":"12:34:56:78:9A:BC",
"Protocol":"dhcp",
"ConnectionState":"Bound",
"LastConnectionError":"None",
"IPAddress":"123.123.123.123",
"RemoteGateway":"123.123.123.1",
"DNSServers":"123.123.123.2,123.123.123.3",
"IPv6Address":"1234:5678:9ABC:DEF1:2345:6789:ABCD:EF12",
"IPv6DelegatedPrefix":"1234:5678:9ABC:DEF1::/56"
}
}
}
livebox wifi:status
Return 1 if Wifi is enabled, 0 otherwise.
livebox wifi:switch
Allow to enable/disable wifi with on
or off
argument (i.e livebox wifi:switch on
or livebox wifi:switch off
)
livebox nat:infos
Will return a json object with all following data
{"result": {
"status": {
"webui_SSHD": {
"Id": "webui_HTTP",
"Origin": "webui",
"Description": "HTTP",
"Status": "Enabled",
"SourceInterface": "data",
"Protocol": "6",
"ExternalPort": "80",
"InternalPort": "80",
"SourcePrefix": "",
"DestinationIPAddress": "192.168.1.2",
"DestinationMACAddress": "",
"LeaseDuration": 0,
"HairpinNAT": true,
"SymmetricSNAT": false,
"UPnPV1Compat": false,
"Enable": true
}
}
}}
livebox nat:switch <status> <id>
Allow to enable/disable NAT rule with enable
or disable
argument (i.e livebox nat:switch enable HTTP
or livebox bat:switch disable HTTP
)
livebox nat:create <id> <ip> <external> <internal> [<protocol>]
Allow to create new NAT rule with the following argument :
id
Name of your rule used as IDip
Ip of your destination for routingexternal
External port that is accesible for outsideinternal
Internal port that is available on the destinationprotocal
(optional) Protocol for routing: tcp, udp or both
i.e livebox nat:create HTTP 192.168.1.2 80 80 tcp
livebox nat:delete <id>
Allow to delete specific rule with his id
(i.e livebox nat:delete HTTP
)
I created this script mainly using reverse engineering, and also checking excellent work on sysbus script by rene-d.