Advanced (3)
The full source code for Sky Router Tool is available from Google Code. Visual Studio .NET 2010 is required to compile the application (older versions of visual studio may work but are untested).
Modifying the Web Interface
The web interface is saved in the 'htdocs' folder of the Sky Router Tool installation directory.
index.html contains the basic page layout, all other content is in "contentData.json". This is a json representation of all the pages used in the web interface.
In the \Sources\pH-Http\htdocs\pages folder of the source code package you will find an easier-to-edit version of the pages contained in contentData.json. Once you have changed the content of these pages you can update the contentData.json file by running the "updatePages.php" script (this requires PHP to be installed). The pages are largely HTML and javascript but also contain some custom templating tags; I will try and document these at a later stage.
Sky Router Tool first checks to see if it can access http://192.168.0.1:8234/do_cmd.sh (Which it wont be able to if the router has been restarted since the tool was last run).
If it cant access the page it then runs the following commands using the URL injection hack (http://192.168.0.1/setup.cgi?todo=ping_test&nextfile=diagping.htm&c4_IPAddr=127.0.0.1>/dev/null;...):
mkdir /tmp/new_web | - Makes a new temporary directory |
rm /tmp/new_web/do_cmd.sh | - Removes any old cgi script |
wget -P /tmp/new_web http://computer running sky router tool/do_cmd.sh | - Downloads the cgi script from the sky router tool web interface |
chmod 777 /tmp/new_web/do_cmd.sh | - Adds execute permissons to the script |
ln /etc/htpasswd /tmp/new_web/.htpasswd | - Link to htpasswd file (makes the new web server be username/password protected) |
kill `cat /tmp/mini_httpd.pid` | - Kill any already running http servers created by sky router tool |
mini_httpd -p 8324 -d /tmp/new_web/ -c "**sh" -i /tmp/mini_httpd.pid | - Starts a new web server on port 8324 |
do_cmd.sh is just a simple script which runs any commands which are posted to it (you can find a copy of it in the 'htdocs' folder of the Sky Router Tool installation directory). Sky Router Tool uses this do_cmd.sh to send commands to the router and return responses.
The data logged by Sky Router Tool is saved in a SQL Compact Edition database file. This is located at "C:\ProgramData\sky router tool\routerlogs.sdf". There is also another database in this folder called "settings.sdf", this contains the consolidation rules.