Salamek / huawei-lte-api

API For huawei LAN/WAN LTE Modems
GNU Lesser General Public License v3.0
376 stars 92 forks source link

I ran the example but didn't work #198

Open Zibri opened 11 months ago

Zibri commented 11 months ago

Device nameB535-933 Orange.eg FlyBOX

from huawei_lte_api.Client import Client
from huawei_lte_api.Connection import Connection

# with Connection('http://192.168.8.1/') as connection: For limited access, I have valid credentials no need for limited access
with Connection('http://admin:MYPWD@192.168.8.1/') as connection:
...    client = Client(connection)
...    print(client.device.signal())
...    print(client.device.information())
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Connection.py", line 32, in __init__
    super().__init__(url, timeout=timeout, requests_session=requests_session)
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 75, in __init__
    self._initialize_csrf_tokens_and_session()
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 176, in _initialize_csrf_tokens_and_session
    token = self._get_token()
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 309, in _get_token
    data = self.get('webserver/token')
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 34, in wrapped
    return fn(*args, **kw)
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 305, in get
    return cast(dict, self._check_response_status(self._process_response_data(response)))
  File "/home/zibri/.local/lib/python3.10/site-packages/huawei_lte_api/Session.py", line 123, in _process_response_data
    return xmltodict.parse(data, dict_constructor=dict) if data else {}
  File "/home/zibri/.local/lib/python3.10/site-packages/xmltodict.py", line 378, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: junk after document element: line 2, column 0
>
Salamek commented 11 months ago

Are you sure that http://192.168.8.1/ is correct IP of your device? It so, it is also possible that B535-933 is using different FW than expected (provided by Huawei or by Orange)

Zibri commented 11 months ago

Yep... weirdly that happened using pip3 install... So I cloned this repository and then I did pip3 install . after that it worked. So perhaps the repositoryis different.

Zibri commented 11 months ago

@Salamek do you have any idea how could I dump/intercept the firmware update? fwup There is one available but I do not wish to update. I wish to dump it.

Salamek commented 11 months ago

Try this call,

https://github.com/Salamek/huawei-lte-api/blob/1a28bbf96eec2480b04e03b46584f67ffeb9dc11/huawei_lte_api/api/OnlineUpdate.py#L15C9-L15C17

(or maybe status or check_new_version)

Zibri commented 11 months ago

Try this call,

https://github.com/Salamek/huawei-lte-api/blob/1a28bbf96eec2480b04e03b46584f67ffeb9dc11/huawei_lte_api/api/OnlineUpdate.py#L15C9-L15C17

(or maybe status or check_new_version)

url-list, status and check new version return there is an update and the version but not the URL..

==== OnlineUpdate.check_new_version
100002: No support

==== OnlineUpdate.status
{'CurrentComponentIndex': '0',
 'CurrentComponentStatus': '12',
 'DownloadProgress': '0',
 'TotalComponents': '1',
 'autodownload': '0',
 'forcedupdate': '0',
 'updatebatterystatus': '0',
 'upgradetype': '0'}

==== OnlineUpdate.url_list
{'ComponentList': {'Component': {'ChangeLog': {'component': {'@name': 'FIRMWARE1',
                                                             '@version': '11.0.5.51(H470SP3C314)'},
                                               'default-language': {'#text': '1033',
                                                                    '@name': 'en-us'},
                                               'language': [{'@code': '1033',
                                                             '@name': 'en-us',
Salamek commented 11 months ago

@Zibri well that is where my ideas end... maybe try to access telnet and see what you can do there? idk...