Created
May 24, 2018 10:38
-
-
Save lukpueh/a595f74d8edfb512d4f5be7056dfdb1e to your computer and use it in GitHub Desktop.
Script to help me position my `Alcatel Linkhub HH40v` LTE modem for the best signal strength
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
<Program Name> | |
say_lte.py | |
<Author> | |
Lukas Puehringer <[email protected]> | |
<Purpose> | |
Script to help me position my `Alcatel Linkhub HH40v` LTE modem for the | |
best signal strength. | |
If a change in signal strength is detected, it uses the OS X command line | |
tool `say` to say the new signal strength. | |
<Usage> | |
1. Connect your computer to your Alcatel Linkhub's WiFi | |
2. Open a browser and go to the admin page at `192.168.1.1` | |
3. Open your browser's developer tools, go to the `network` tab and look | |
for requests to `http://192.168.1.1/jrd/webapi` | |
4. Take any request, copy the value of the header | |
`_TclRequestVerificationKey` and assign it to below variable | |
`REQUEST_KEY` | |
5. Turn up the volume of your computer and run the script | |
6. Walk your Alcatel Linkhub around your apartment (long extension cord is | |
helpful) and place it at where your computer tells you a high signal. | |
""" | |
import time | |
import requests | |
import subprocess | |
############################################################################### | |
# CHANGE REQUIRED !!! | |
# Add value of you _TclRequestVerificationKey here | |
############################################################################### | |
REQUEST_KEY = None | |
if not REQUEST_KEY: | |
raise Exception("You need to assign your `_TclRequestVerificationKey` to `REQUEST_KEY`") | |
URL = "http://192.168.1.1/jrd/webapi" | |
# JSON rpc request to get information such as signal strength | |
JSON_REQUEST = { | |
"id": "1", | |
"jsonrpc": "2.0", | |
"method": "GetSystemStatus", | |
"params": {} | |
} | |
# Headers required to authenticate with JSON rpc (assessed by trial and error) | |
HEADERS = { | |
"_TclRequestVerificationKey": REQUEST_KEY, | |
"Referer": "http://192.168.1.1/index.html" | |
} | |
def main(): | |
""" Run indefinitely to (at an interval of 1 second) | |
- print requested signal strength to command line, and | |
- if signal strength changes, `say` the new strength. | |
""" | |
last = None | |
while True: | |
r = requests.post(URL, json=JSON_REQUEST, headers=HEADERS) | |
strength = r.json().get("result", {}).get("SignalStrength") | |
print "Signal Strength:", strength | |
if strength != last: | |
process = subprocess.Popen(["say", str(strength)], | |
stdout=subprocess.PIPE) | |
process.communicate() | |
last = strength | |
time.sleep(1) | |
if __name__ == "__main__": | |
main() |
@spolette, in your script for HH72, please how have you found the key "e5dl12XYVggihggafXWf0f2YSf2Xngd1" ? I've tried your script on Alcatel MW45V, it seems that encryption is different between login and password. Thanks
@cguillard35, I've found that key by reverse engineering Alcatel's android app (https://play.google.com/store/apps/details?id=com.alcatel.smartlinkv3)
@spolette can you made python script for MW40V ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@spolette, in your script for HH72, please how have you found the key "e5dl12XYVggihggafXWf0f2YSf2Xngd1" ?
I've tried your script on Alcatel MW45V, it seems that encryption is different between login and password.
Thanks