Giter VIP home page Giter VIP logo

Comments (5)

StevenLooman avatar StevenLooman commented on August 22, 2024

It's time to write a contributing-document. :)

The first steps is to discover the URLs your device uses. Lets assume the IP of your modem is 192.168.1.1, can you try this URL? http://192.168.1.1/RootDevice.xml
Not all devices have this, but it is used for auto-detecting the type of the modem. If your device doesn't have this, don't worry. If it does, please add the file RootDevice.xml to this issue.

Then, the next step is to determine the URLs to:

  • login/logout
  • check if session is active (or otherwise login again)
  • get connected devices via LAN
  • get connected devices via WiFi

You can get these by browsing to the web interface of your modem and copy them to this issue.

from pyubee.

saicrazyfire avatar saicrazyfire commented on August 22, 2024

Sure, I'd love to help.

For this model, I was unable to find RootDevice.xml through URL manipulation. My router IP is 192.168.0.1, so I tried 192.168.0.1/RootDevice.xml as well as 192.168.0.1/htdocs/RootDevice.xml. I tried the latter since it looks like an apache directory and the "homepage" of the router is a php file.

Before login

Navigating to 192.168.0.1 shows me a general stats page, with a link to login

image

I click on "Please click here to login" and then get prompted for username and password. This is the standard basic auth you see in a lot of webpages. The URL for this login is http://192.168.0.1/htdocs/cm_info_status.php

Logout

image

Theres tabs up top, with one of them being logout. This link directly logs you out and the URL for it is http://192.168.0.1/htdocs/unauth.php

To view connected devices

Navigate to Gateway -> Mangement -> Client List

image

Direct URL to this page is: http://192.168.0.1/htdocs/rg_mgt_clientlist.php

In the Interfaces column, this is where you'll know how the device is connected. The various values I have are:

  • wl1
  • wl0
  • Eth-Switch LAN(3)
  • Eth-Switch LAN(4)

I assume wl1 and wl0 are the wireless access points, 2.4 GHz and 5 GHz (not sure which is which). I have an unmanaged switch connected to LAN3 so many devices will report connected to it. I also have a direct connection to my desktop to LAN4 so it shows up as LAN4 here.

URL Summary

  • login/logout http://192.168.0.1/htdocs/cm_info_status.php
  • check if session is active (or otherwise login again) Couldn't find. Navigating to the above URL will direct prompt you for username and password
  • get connected devices via LAN http://192.168.0.1/htdocs/rg_mgt_clientlist.php
  • get connected devices via WiFi http://192.168.0.1/htdocs/rg_mgt_clientlist.php

I hope this helps

from pyubee.

StevenLooman avatar StevenLooman commented on August 22, 2024

Thank you for the information, this is already helpful. I need a little bit more. I've written a guide to help you get all the information we need: https://github.com/mzdrale/pyubee/blob/master/ADDING_NEW_MODELS.md

Can you follow this guide and provide the required information? Feel free to comment on the guide, this is just a first version.

from pyubee.

mzdrale avatar mzdrale commented on August 22, 2024

Thanks @saicrazyfire for the information, but could you please go through ADDING NEW MODELS guide and provide the required information, as @StevenLooman requested in previous comment?

from pyubee.

saicrazyfire avatar saicrazyfire commented on August 22, 2024

I tried to gather information but it seems like my model is quite different. I'll try my best to answer the questions in the Adding new models questionnaire.

My router IP is 192.168.0.1 in this context

Auto-detect the model

HTTP 404 error - page not found when navigating to 192.168.0.1/RootDevice.xml.

Log in

There is no < form > tag in the page source. The page actually is just a link, which calls htdocs/cm_info_status.php to login (see above pictures)

Log out

Logout link is http://192.168.0.1/htdocs/unauth.php

Check if we are logged in

Not sure what to get here. The HTML source for the login page does not have any < input > elements nor any class names

Get the connected devices via LAN

As stated above, the client list is located at this url http://192.168.0.1/htdocs/rg_mgt_clientlist.php

What is interesting is that the table is not filled out in HTML, but with a javascript function. There is a javascript variable within < script > tag that contains a JSON dictionary of all relevant details (e.g.

var rg_mgt_cpestatus_jason = ' ${JSON STRING HERE} '
var rg_mgt_cpestatus_obj = jQuery.parseJSON (rg_mgt_cpestatus_jason);
var rg_lan_dhcpinfo_json = ' ${JSON STRING HERE} '
var rg_lan_dhcpinfo_obj = jQuery.parseJSON(rg_lan_dhcpinfo_json);

Sample JSON for rg_mgt_cpestatus_jason and possibliy rg_lan_dhcpinfo_json as well

{
	"mgt_cpestatus_table": [{
		"Interface": "Eth-Switch LAN(1)",
		"Ethno": "0",
		"Status": "1"
	}, {
		"Interface": "Eth-Switch LAN(2)",
		"Ethno": "1",
		"Status": "1"
	}, {
		"Interface": "Eth-Switch LAN(3)",
		"Ethno": "2",
		"Status": "1"
	}, {
		"Interface": "Eth-Switch LAN(4)",
		"Ethno": "3",
		"Status": "1"
	}],
	"lan_dhcpinfo_table": [{
		"lan_dhcpinfo_hostname": "XXXXX",
		"lan_dhcpinfo_ip_address": "192.168.0.XX",
		"lan_dhcpinfo_mac_address": "XX:XX:XX:XX:XX:XX",
		"lan_dhcpinfo_expire_time": "",
		"lan_dhcpinfo_interface": "eth2"
	}, {
		"lan_dhcpinfo_hostname": "Unknown",
		"lan_dhcpinfo_ip_address": "192.168.0.XX",
		"lan_dhcpinfo_mac_address": "XX:XX:XX:XX:XX:XX",
		"lan_dhcpinfo_expire_time": "",
		"lan_dhcpinfo_interface": "eth2"
	}]
}

It then builds the table element with javascript

function ubee_jscript_generate_table_data(lan_dhcpinfo_list) {
		var html_string =  '<table ><thead><th colspan="4">Client List</th></thead>' ;
		html_string += '<tr><td class="level-2-table-header">Host Name</td><td class="level-2-table-header">IP Address</td><td class="level-2-table-header">MAC Address</td><td class="level-2-table-header">Interface</td></tr>' ;
		for (index=0; index < lan_dhcpinfo_list.length ; index++ ) {
			if (index%2==0) {
				html_string += '<tr >';
			} else {
				html_string += '<tr class=\"alt\" >';
			}
			html_string +=  '<td>'+ lan_dhcpinfo_list[index].lan_dhcpinfo_hostname +'</td>';
			html_string +=  '<td>'+ lan_dhcpinfo_list[index].lan_dhcpinfo_ip_address +'</td>';
			html_string +=  '<td>'+ lan_dhcpinfo_list[index].lan_dhcpinfo_mac_address +'</td>';
			if( lan_dhcpinfo_list[index].lan_dhcpinfo_interface == 'eth0' ){
				html_string +=  '<td>'+ 'Eth-Switch LAN(1)' +'</td>';
			} else if( lan_dhcpinfo_list[index].lan_dhcpinfo_interface == 'eth1' ){
				html_string +=  '<td>'+ 'Eth-Switch LAN(2)' +'</td>';
			} else if( lan_dhcpinfo_list[index].lan_dhcpinfo_interface == 'eth2' ){
				html_string +=  '<td>'+ 'Eth-Switch LAN(3)' +'</td>';
			} else if( lan_dhcpinfo_list[index].lan_dhcpinfo_interface == 'eth3' ){
				html_string +=  '<td>'+ 'Eth-Switch LAN(4)' +'</td>';
			} else {
				html_string +=  '<td>'+ lan_dhcpinfo_list[index].lan_dhcpinfo_interface +'</td>';
			}
			html_string += '</tr>' ;
		}
		html_string += '</table>' ;
		return(html_string) ;
	}
  • Get the connected devices via WiFi

See above (the device would be in different Eth-Switch LAN(X) depending on Wifi vs LAN

from pyubee.

Related Issues (8)

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.