skimpax / fbxosctrl Goto Github PK
View Code? Open in Web Editor NEWShell tool to control some Freebox OS stuff: wifi, reboot...
License: GNU General Public License v3.0
Shell tool to control some Freebox OS stuff: wifi, reboot...
License: GNU General Public License v3.0
Impossible to register app with 2.0.0 fresh install
Hello, thanks for your script.
I've already used your script on other machines, but I need to use it on an older nas with Alt -f software as SE.
I've installed SimpleJson and request, and registrated with success .
But when I try to reboot the Freebox, I've this error :
[root@dns320]# ./fbxosctrl.py -c fbxosctrl_registration.txt --reboot
Traceback (most recent call last):
File "./fbxosctrl.py", line 510, in
rc = cli.cmdExec(sys.argv[1:])
File "./fbxosctrl.py", line 497, in cmdExec
return self.dispatch(argsdict.keys())
File "./fbxosctrl.py", line 504, in dispatch
return self.cmdCallbacks.get(cmd, self.parser.print_help)()
File "./fbxosctrl.py", line 342, in reboot
self._login()
File "./fbxosctrl.py", line 162, in _login
h = hmac.new(apptoken, key, sha1)
File "build/bdist.linux-armv5tel/egg/hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "build/bdist.linux-armv5tel/egg/hmac.py", line 72, in init
self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode
my python version is 2.7.2-4.
Thanks for your help.
Ability to display system information
J'utilisais cette appli pendant 3 ans avec Debian 9 Stretch, qui utilise Python 3.5, mais lors du passage sur Debian 11 l'appli a cessé de fonctionner, étant préciser que la version de Python3 a changé:
Python 3.9.2
En cherchant des solutions, j'ai modifié le programme tout légèrement:
self._reg_params.get('track_id') is not None and self._reg_params.get('app_token') is not ''):
elif self._resp.get('success') is not True and self._resp['success'] is not False:
if self._session_token is not None:
timeout=timeout if timeout is not None else self._http_timeout)
timeout=timeout if timeout is not None else self._http_timeout)
timeout=timeout if timeout is not None else self._http_timeout)
if resp.result['has_sfp'] is not True and resp.result['sfp_present'] is not True:
if resp.result['link'] is not True:
Apres cette modification tout refonctionne comme avant 👍
fbxosctrl.py 2.4.4
Il faut peut-être modifier les sources sur ce git.
This is the code I get when I try to set the Wifi off :
>>> setWifiOff
>>> _setWifiStatus
>>> _login
>>> isRegistered
>>> hasRegistrationParams
>>> _loadRegistrationParams: file: fbxosctrl_registration.txt
>>> getRegistrationStatus
>>> hasRegistrationParams
http://mafreebox.freebox.fr/api/v1/login/authorize/1
GET url: http://mafreebox.freebox.fr/api/v1/login/authorize/1
GET response: {"success":true,"result":{"status":"granted","challenge":"rF7pTgHX8flUZ9TFqa6+Yr\/+0N0yCO3M","password_salt":"KpDAqdZIgRdDX7IXKqkFccT4taWFZ8+Y"}}
GET url: http://mafreebox.freebox.fr/api/v1/login/
GET response: {"success":true,"result":{"logged_in":false,"challenge":"rF7pTgHX8flUZ9TFqa6+Yr\/+0N0yCO3M","password_salt":"KpDAqdZIgRdDX7IXKqkFccT4taWFZ8+Y"}}
challenge: rF7pTgHX8flUZ9TFqa6+Yr/+0N0yCO3M, apptoken: a4a7K0S5iPwboVUaWmfalFd3/pHoYYawljcAvhHzRBn3dZD9gM6rAX5lMXZRElZI
Traceback (most recent call last):
File "fbxosctrl.py", line 467, in <module>
rc = cli.cmdExec(sys.argv[1:])
File "fbxosctrl.py", line 454, in cmdExec
return self.dispatch(argsdict.keys())
File "fbxosctrl.py", line 461, in dispatch
return self.cmdCallbacks.get(cmd, self.parser.print_help)()
File "fbxosctrl.py", line 397, in setWifiOff
return self._setWifiStatus(False)
File "fbxosctrl.py", line 212, in _setWifiStatus
self._login()
File "fbxosctrl.py", line 159, in _login
h = hmac.new(apptoken, key, sha1)
File "/volume1/@appstore/python/lib/python2.7/hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "/volume1/@appstore/python/lib/python2.7/hmac.py", line 72, in __init__
self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode
Hi,
I tried your application as apparently it does everything I need but it does not work in bridged mode as Zeroconf is unable to retrieve the conf.
Is it supposed to work ?
OK, this is clearly my misunderstanding, this is my 1st (well 2nd-failed) attempt at using this repo.
Whilst "OSError: [Errno 101] Network is unreachable
" sounds embarassingly like I'm doing something dumb I've no idea what that is.
I'm running on Ubuntu18.04 LTS, with Python 3.6.5.
I'm running command
/usr/bin/python3 ./fbxosctrl.py --regapp
to use the system Python which has zeroconf module installed.
It obtains the addressing and certificate files OK.
Below are the contents of the addressing file: (with my hostname masked)
{
"api_base_url": "/api/",
"api_domain": "****.fbxos.fr",
"api_version": "6.0",
"port": "46736",
"protocol": "https"
}
but then the script barfs with a network connection issue - see below.
I tried pinging the address which works fine.
I tried nmap on the port which says it's filtered (didn't really expect anything else!).
What's happening?
What should I do to fix/debug?
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 284, in connect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd4e56dba8>: Failed to establish a new connection: [Errno 101] Network is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sd4gr1i9.fbxos.fr', port=46736): Max retries exceeded with url: /api/v6/login/authorize/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd4e56dba8>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./fbxosctrl.py", line 1204, in <module>
rc = cli.dispatch(args)
File "./fbxosctrl.py", line 1192, in dispatch
return self._cmd_handlers.get(cmd, self._parser.print_help)()
File "./fbxosctrl.py", line 564, in register_app
resp = self._http.post(uri, data=data, no_login=True)
File "./fbxosctrl.py", line 369, in post
timeout=timeout if timeout is not None else self._http_timeout)
File "/usr/lib/python3/dist-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sd4gr1i9.fbxos.fr', port=46736): Max retries exceeded with url: /api/v6/login/authorize/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd4e56dba8>: Failed to establish a new connection: [Errno 101] Network is unreachable',))
Hi,
I like your script but it always show me Traceback logs when exit (but the script works great).
Any idee where the problem come from ?
Thanks.
Seems that v2.4.4 is no more compatible with new freebox OS v4.2.
Is there an update forcast?
Hello,
when i launch the registration, i have this error :
Traceback (most recent call last):
File "fbxosctrl.py", line 960, in
ctrl.conf.load()
File "fbxosctrl.py", line 125, in load
self._load_addressing_params()
File "fbxosctrl.py", line 182, in _load_addressing_params
self._addr_params['protocol'] = 'https' if mdns_info.properties[b'https_available'].decode() else 'http'
AttributeError: 'NoneType' object has no attribute 'properties
mdns_info is empty, and i don't know why.
Thanks
I just upgraded to last version, and I noticed typos in the readme file, dependencies section :
DependEncies:
python3-requests and python3-zeroconf You can use this command to install them:
apt-get install python3-requests python3-zeroconf
Add a command to display downloads information.
Bad registration handling: re-attempt generate throwing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.