Coder Social home page Coder Social logo

jamodevnich / superhub3-cli Goto Github PK

View Code? Open in Web Editor NEW
17.0 5.0 2.0 91 KB

A command-line interface for managing the VM SuperHub 3/ARRIS TG2492S/CE router. Allows listing current/past connected devices, toggle private/guest WLAN, rebooting and viewing router status

Python 100.00%
python api superhub clients wlan router-status virgin-media hub-3

superhub3-cli's People

Contributors

jamodevnich avatar richard-scott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

superhub3-cli's Issues

HTTP/1.1 Response Code 401 Received

`Yarde Superhub Client API (Part of the Wifi Doorbell Transponder Project) by Nicholas Elliott
Version 0.1.4

Searching for superhub (192.168.0.1)...
Logging in...
Validating login...
--! HTTP/1.1 Response Code 401 Received
Traceback (most recent call last):
File "superhubclientsapi.py", line 232, in
main();
File "superhubclientsapi.py", line 221, in main
raise Exception("The login could not be validated. Retrying usually fixes this random error.");
Exception: The login could not be validated. Retrying usually fixes this random error.
`

Bug: Finding ip address

I had to comment out line 350-352 ("Finding the superhub") otherwise it throws:
"Could not find Superhub, please ensure the correct IP address is set", even though hub exists on that ip.

Do I need to set the correct md5? I also don't get to the menu, just:
192.168.0.1>_

Can still type the commands and they work.
Using latest python (3.7.0)

Support for Virgin Media HUB 5

Is there any chance that support for Virgin Media HUB 5 will be added?
In particular I am interested in setting the CPU governor in performance mode.
Does anyone know if it's even possible?

Error when Admin user already logged in.

I have been using your script for a while, and when I am logged in via the Web UI in a browser on my desktop, I get this error on the command line:

Searching for 192.168.0.1...
Logging in...
Checking firmware compatibility...
--! HTTP/1.1 Response Code 401 Received
Traceback (most recent call last):
  File "/root/bin/tools/superhubclientsapi.py", line 850, in <module>
    Main.app();
  File "/root/bin/tools/superhubclientsapi.py", line 834, in app
    raise Exception(Hub.ErrorMessages.firmware_warn);
Exception: Couldn't check firmware version, something must have went wrong with the login.

This happens as only one Admin can be logged in at a time.

Modify DNS settings

Did you find anything relating to hidden DNS settings when poking around the superhub3?

Staying in the loop

Any advice on how to prevent it from dropping out/exiting after a command is run? It seems like this was the intended behaviour.

Add support for DDNS modification

The Hub 3 secretly has DDNS capabilities with several common providers.

To see and edit these settings, log in to the admin page, then open devtools. Go to Application, then Session Storage and replace the disable and hide keys' values with ;;. This will unlock all hidden settings to the user, including the DDNS functionality, which works correctly.

More interestingly, this shows new IPv6 info on the Admin > Info page, too.

Codebase Refactoring for 2.0.0

Overview

Planning to tidy up the codebase and also take the opportunity to implement some new features ๐Ÿ˜€. The end goal is to enable the script to also function as a library (rather than only a CLI interface), and to improve maintainablility of the overall codebase.

The project will remain a single python file with no dependencies on external packages, and all of the existing functionality will remain.

Any suggestions/changes/feedback would be much appreciated!

Core Changes

  • Replace the 'web' function with Python's urllib
  • Create Session class to handle logging in/out & SNMP-over-HTTP requests
  • Refactor all classes to inherit a new base class 'APIRequest' Edit: 'RouterSessionClientBase'
  • Create Output class to handle formatting the output in the command line
  • Custom session exceptions - e.g. login failed
  • User input exception - allow an user to input text if running as CLI
  • All global variables removed (except version)

Documentation

  • Custom session exceptions
  • User input exception

New Features and minor changes

  • Check if a user is already logged in
  • Add 'is ethernet/wlan' column to clients list
  • Include data from the base64-encoded login cookie to the diagnostic output
  • Login action now returns HTTP status code 500 if the password is incorrect. Previously this used to be an empty response, could use this to provide a more user-friendly exception.

Feature Request: Toggle Wireless Radio

Hey, amazing work! Are you able to use this to disable and enable the wireless radio? I'd like to be able to toggle it quickly when I'm not using it.

oid defines for reboot

Hi,

I happened to find extra oid defines to reboot the VM SuperHub3, it's been tested OK from me and hope that can be of help if you'd like to improve further. They are:

#to raise reboot command
web(superhub_ip_addr+"/snmpSet?oid=1.3.6.1.4.1.4115.1.20.1.1.5.15.0;"+superhub_req_ext,superhub_cookie_header);

#to confirm reboot
web(superhub_ip_addr+"/snmpSet?oid=1.3.6.1.2.1.69.1.1.3.0=2;2;"+superhub_req_ext,superhub_cookie_header);

#logout VM
web(superhub_ip_addr+"/logout?"+superhub_req_ext);

Regards,

JC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.