What's new

[R7800] Voxel firmware - Custom bootstrap admin pages

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

MichelvW

New Around Here
Hello everyone! I'm new here and as I recently got my hands on a R7800 and installed Voxel's firmware shortly after. Quite the upgrade from my buggy linksys ea6400! The firmware performs really well and i'm absolutely happy with it, but i'm not a fan of the default netgear design of the admin pages and decided to do something about it. I'm not a programmer perse, but i know my way around html, css and javascript and i made a start gettinh tg rid of the default css implementing bootstrap instead, replacing the iframe(s) with ajax divs and restructuring some menu options (what's withe default basic vs. advanced main menu options anyway?). I got a question though.

How and where is the serverside processing being handled for the pages. I see a lot of functions called between serverside script tags like <% cfg_get("...") %> and cannot get my head around how this is processed. Where is it referring to and could i possibly alter the serverside scripts? It looks PHP-ish but i'm not sure. I tried searching the GIT repo for some of the function names, but got no returns (besides the html pages calling the functions). Sorry if i'm asking stupid questions, i don't intend to waste your precious time.

Hope you can help me out and thanks in advance!
 
Very welcome here!:D

It's processed by the Netgear binary blob: /usr/sbin/net-cgi. No source code available.
So there are no scripts that can be changed :(
You need to "hi-jack" and create your own functions/scripts.

Please share the result of your efforts or show an example of the new look!:cool:
 
Last edited:
Too bad. I was afraid it was something like that. Guess i'll have to do with whatever output /usr/sbin/net-cgi is giving then. Another question then, against better judgement, is there any documentation on net-cgi?
 
:(
strings /usr/sbin/net-cgi
gives you some ideas, because it's not compressed or encrypted.
A good disassembler and you are ready to find out :cool:
Also running the html pages in e.g. chrome debug mode gives an insight.
But why you need to care?
If you just want a nicer skin, you can do a lot better than stock anyhow...
 
Yeah. I'm using the chrome debug mode heavily. Reason why i was asking if i could alter the code is that some of these functions don't just return values, but complete html, including the markup (why would you do this?!). I wanted to change some stuff inside the markup (used classes in div's for example). Guess i'll have to work my way around that then.

Example:
Code:
basic_wireless()

Returns:
HTML:
<div id="wireless" class="basic_icon" onclick="click_action('wireless');">
        <div class="icon_name">Wireless</div>
        <div id="wlan_stat" class="icon_long_status">
            <span>SSID: <b>MYSSIDHERE</b><div id="pwd_div"><div id="pwd_label" style="margin-left: 12.5px;">Password: </div><div id="passwd" title="MYPWD" style="float: left;"><div id="pwd_begin"><b>MYPWD</b></div><div id="pwd_end"></div></div></div></span>
        </div>    
</div>
 
I've made a list of all calls being done within the webpages. One with all parameters and one overview with just the plain functions (268). I'll leave these here for future reference, might someone ever be looking for this.

* i tried adding a file with the output of strings net-cgi as well, but somehow that upload fails everytime
 

Attachments

  • net_cgi_functions.txt
    5 KB · Views: 136
  • net_cgi_functions_withparms.txt
    60.4 KB · Views: 267
Last edited:
Haha, I have done the same.
But most things you can make yourself with some shell scripts and CGI :eek:
 
Maybe we should simply install a minimal php server on the router (on @Voxel firmware) that would allow us to have total control of the router from http/s without relying on NG cgi.

This way, we could create a totally separate GUI using our own scripts.
 
Ok, I try to understand this net-cgi thing.

Any call from a page on the server with this tag <% cgi_function %> is calling the cgi_function hard coded in net-cgi.

I made a wrapper to hi-jack net-cgi (the same way @Voxel is hi-jacking net-wall) and I logged when it is called with the time (date) and the arguments sent to it ($*). The hi-jack works, but the log shows that when net-cgi is called, there is no arguments passed to it.

So how is net-cgi aware of the function called from the html page?
 
Ok, I try to understand this net-cgi thing.

Any call from a page on the server with this tag <% cgi_function %> is calling the cgi_function hard coded in net-cgi.

I made a wrapper to hi-jack net-cgi (the same way @Voxel is hi-jacking net-wall) and I logged when it is called with the time (date) and the arguments sent to it ($*). The hi-jack works, but the log shows that when net-cgi is called, there is no arguments passed to it.

So how is net-cgi aware of the function called from the html page?

Could you share your wrapper code?
 
Well, the wrapper did not bring any positive result; moreover, it happens that using net-cgi is not required at all as you can make your own cgi engine (thank you @kamoj for the pointers on that).

Basically, any script in /www/cgi-bin/ can be called from the web (think Ajax) and you can retrieve the get string in $QUERY_STRING.

With that, anything is possible ;)

Could you share your wrapper code?
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top