DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-07-18 02:14:54

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Edit the WebInterface of the DNS323 / CH3SNAS

Hi

my first post here, please excuse my poor english.

I got my Conceptronic CH3SNAS ( which seem to be identically constructed with the DNS323) 4 days ago.
Since that I spend every free minute on that device ( with poor Linux knowledge to :-) .

I searched a way to modify the web-interface so I can place a few informations on the start page ( for the moment two links to the mldonkey & twonkyvision webinterface).


Perhaps it's interessting for someone. I'm using the following script:

Code:

#!/bin/sh
#    /mnt/HD_a2/pwebinterface/pwebinterface.sh

PWEB_DIR="/mnt/HD_a2/pwebinterface"

#the following line is only for debug purposes
#rm -r $PWEB_DIR/resources/

#at the first time the script is started, check if resources directory exist, 
#if not, make a copy of the internal webinterface to /mnt/HD_a2/pwebinterface/resources
#later this directory become the new homedirectory

if [ ! -e  $PWEB_DIR/resources ]
then
    cp /sys/crfs/web_page  $PWEB_DIR/resources -R

    #chmod the resources, to allow editing over samba 
    chmod 777  $PWEB_DIR/resources/* -R    
    
    #copy predefined changes from the /mnt/HD_a2/pwebinterface/changes/ directory
    # into resoures and chmod the resources again
    cp  $PWEB_DIR/changes/*  $PWEB_DIR/resources -R
    chmod 777  $PWEB_DIR/resources/* -R    
fi

# place a symbolic link to the new home directory
rm /web/web
ln -s  $PWEB_DIR/resources /web/web

Meanwhile I used the copy of the interface to translate
nearly the hole CH3SNAS interface to German and change the base design to my wishes.
( Conceptronic is using a bad red color in their interface yikes )

I've attached a complete package with all changes. Perhaps someone can use it.

Stefan

Last edited by spflug (2007-07-18 02:30:37)

Offline

 

#2 2007-07-18 08:32:40

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

i have recompiled the webserver to have home in /mnt/HD_a2/web and run on port 88
http://upit.jtw.dk/dl/uwn/


First user to fun_plug the dns-323.

Offline

 

#3 2007-07-18 09:42:05

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

Tried your file this moment, works fine!

I think I should place the "webs" on the HDD too and kill the original server before starting it ?

Code:

PID=$(/bin/pidof webs)

if [ -n "$PID" ]
then
   kill -9 $PID
fi 
/mnt/HD_a2/webs&

With exception of the changed port, I see no advantage at the moment.
Perhaps I'm blind :/

Offline

 

#4 2007-07-18 10:09:51

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

you still have the old interface left if you fuck anything up and we can compile extra stuff in to the webserver.


First user to fun_plug the dns-323.

Offline

 

#5 2007-07-18 10:40:07

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

KRH wrote:

if you fuck anything up.

Perfect for me lol

The simplest advantage -> I'm blind yikes:

Offline

 

#6 2007-07-18 11:00:14

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

If I modified the funplug start scripts to accept "start", "stop" and "status" parameters, do you guys think it's possible to add a "fun-plug'ged services" page that uses the start-scripts to shows service status and start/stop buttons?

Offline

 

#7 2007-07-18 11:23:17

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

sure im running commands on my own webs server right now.


First user to fun_plug the dns-323.

Offline

 

#8 2007-07-19 00:48:32

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

@krh
do you've a hint how to start with such a service page? ( dummy alarm yikes )
I've googled the last 2 hours and have no idea where to start.

Is CGI or php needed for this ? Is this only possible under lighttpd or can I use the webs Webserver ?

Last edited by spflug (2007-07-19 00:49:54)

Offline

 

#9 2007-07-19 14:01:52

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Edit the WebInterface of the DNS323 / CH3SNAS

spflug,

pure speculation on my side since I haven't looked into the webpages at all:

Take the DNS-323 standard status page as an example.
Or even better the ones for the FTP-Server (or iTunes). These show a status and allow starting and stopping of a service.

I'd take these and go from there.

Cheers,

Emacs

Offline

 

#10 2007-07-19 17:06:27

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

I've already done so.

For example the FTP-Status and the start/stop buttons are called by "<% show_ftp_status();%>" in a file named ftp_settings.asp.

The only file that contains the same string is the compiled file "webs" ( I think the webserver itself ?!?).

I fear to crosscompile that file, cause I've never done that before.

On the other hand we grow with the challenge smile

Offline

 

#11 2007-07-19 22:40:28

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

fonz wrote:

If I modified the funplug start scripts to accept "start", "stop" and "status" parameters

Done for most of the scripts. Currently uploading as funplug-0.3-testing-3.tar.gz. Status will print "running" or "stopped" depending on whether the process exists or not (more sophisticated checks can be added later if necessary), e.g.:

Code:

/ # sh /mnt/HD_a2/fun_plug.d/start/inetd.sh status
stopped
/ # sh /mnt/HD_a2/fun_plug.d/start/lighttpd.sh status
running

Offline

 

#12 2007-07-19 22:43:42

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

spflug wrote:

For example the FTP-Status and the start/stop buttons are called by "<% show_ftp_status();%>" in a file named ftp_settings.asp.
The only file that contains the same string is the compiled file "webs" ( I think the webserver itself ?!?).

I don't know anything about asp, but I was hoping that you can just call shell scripts and generate HTML from an asp page without modifying the web server code. If I understood KRH correctly he's doing stuff like that already.

Offline

 

#13 2007-07-20 13:03:11

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

im on vacation right now will be back home next weekend then i can give some hints.


First user to fun_plug the dns-323.

Offline

 

#14 2007-07-20 21:07:02

cyboc
Member
From: Vancouver, BC, Canada
Registered: 2007-07-14
Posts: 27
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

spflug wrote:

I searched a way to modify the web-interface so I can place a few informations on the start page ( for the moment two links to the mldonkey & twonkyvision webinterface).


Perhaps it's interesting for someone. I'm using the following script:...

spflug, I like your approach. It's similar to the approach I came up with this week. I guess the main difference is that I copy the original pages from flash every time I reboot, whether or not the copies already exist.

KRH wrote:

you still have the old interface left if you fuck anything up and we can compile extra stuff in to the webserver.

So the old webserver can be used as a failsafe? Excellent idea! This will allow us to modify the form actions in web_api.c, recompile webs, and run it in parallel with the old webs. This will allow us to fix the password restrictions (max length 8 chars, no symbol chars) on the server side instead of on the client (i.e. asp) side (for client side fix, see my new asp pages).

The no symbol chars fix can be made right inside web_api.c with just a few lines of code (basically, you just need to replicate how I did it in the asp code). However, the max length 8 chars fix might be a bit trickier (the truncation to 8 characters is done outside of web_api.c, either in busybox code, uClibc code or tinylogin code -- not sure yet).


"If you feel yourself irreplaceable, put a finger in a glass of water. If you leave a hole when you take it out, you truly are irreplaceable."

Offline

 

#15 2007-07-20 21:12:02

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

we can not change web_api.c as we miss some of the files included. budt we can make new things just by making a new file and compile it in to webs. budt my dev server at home are offline and im 900km from it smile (on vacation)


First user to fun_plug the dns-323.

Offline

 

#16 2007-07-20 22:17:01

cyboc
Member
From: Vancouver, BC, Canada
Registered: 2007-07-14
Posts: 27
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

KRH wrote:

we can not change web_api.c as we miss some of the files included.

Ah, yes, thanks for that tip. I guess these are some of the missing header files?:

Code:

#include "../../module/include/wireless.h"
#include "../../module/include/ap.h"
#include "../../module/include/mail.h"

KRH wrote:

but we can make new things just by making a new file and compile it in to webs.

You're quite right. I download the GoAhead source code directly from GoAhead.com and had a look at it. The file web_api.c is not an integral part of GoAhead. Rather, it was an implemented and added on by the NAS vendors. In theory, we should be able to reimplement web_api.c, reusing some parts of the original. It might be tedious to reimplement everything though. Perhaps we could start with a few simple mods. Again, I like your idea of running the stock webs and our custom webs in parallel.

Another important file is the NAS vendor's main.c. It does all of the mapping of form actions to c handler functions with websFormDefine.

This should be a fun way to waste time and make my wife mad and say things like "When are you getting off that stupid computer?" :-)


"If you feel yourself irreplaceable, put a finger in a glass of water. If you leave a hole when you take it out, you truly are irreplaceable."

Offline

 

#17 2007-07-20 22:20:53

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

the goahead source from the CH3SNAS can compile fine if you just remove the ref. to some upnp thing. not sure if it breaks anything in the webserver havent testet that much.


First user to fun_plug the dns-323.

Offline

 

#18 2007-07-20 22:24:22

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Edit the WebInterface of the DNS323 / CH3SNAS

cyboc wrote:

Again, I like your idea of running the stock webs and our custom webs in parallel.

The bad thing about the stock webs is that it occupies port 80. Also the web interface isn't too great, so I for one wouldn't mind using a complete replacement web interface - based on goahead, lighttpd+lua, picolisp or whatever...

Offline

 

#19 2007-07-20 22:31:44

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

For the moment I've found a silly workaround for me.

I use the lighttpd + php on Port 8080 to start the following start.php file in an IFRAME played in login.asp:

Code:

<?php
    if(isset($_POST['action']) && $_POST['action'] == 'ok') {
        echo(shell_exec( $_POST["pcmd"]));
    }
?> 
        
<html>
    <head>
        <META content=text/html;charset=iso-8859-1 http-equiv=content-type>
        <LINK href="http://<?php echo $_SERVER['SERVER_ADDR']; ?>/web/images/css.css" type=text/css rel=STYLESHEET>
    </head>

    
    <body>
        <TABLE  cellSpacing=0 borderColorDark=#000000 width=90%  align=center bgColor=#FFFFFF border=0>    
            <tr>
                <td colspan="3" ALIGN=CENTER>
                    <A HREF="Http://<?php echo $_SERVER['SERVER_ADDR']; ?>:9000" TARGET="_blank"><IMG HEIGHT=65 ALT="TwonkyVision Weboberfläche" Border=0 SRC="twonky.png"></IMG></A>
                    &nbsp;&nbsp;&nbsp;
                    <A HREF="Http://<?php echo $_SERVER['SERVER_ADDR']; ?>:4080" TARGET="_blank"><IMG HEIGHT=65 ALT="TwonkyVision Weboberfläche" Border=0 SRC="donkey.png"></IMG></A>
                </td>            
            </tr>    
            <TR> 
                <TD width=100%>  
                    <FIELDSET class="FS_Intro">
                    <LEGEND>SERVER STATUS</LEGEND>
                    
                    <Table Border=0>
                        <TR>
                            <TD class="labelCell2">Mldonkey:</TD>
                            <TD Width=80>
                                <?php                                
                                    echo shell_exec("if [ ! -z \"`pidof mlnet`\" ]; then echo gestartet;else echo beendet; fi");  //system call                
                                ?>                                
                            </TD>
                            <TD >
                                <form method="POST"  name="shell2">                                    
                                    <input type="hidden" name="action" value="ok" />
                                    <input type="hidden" name="pcmd" value="/mnt/HD_a2/www/support.sh mldonkey" />                                    
                                    <input name="B5" type="submit" value="Start / Stop"  class="BtnSubmit2">&nbsp;
                                </Form>    
                            </TD>
                        </TR>
                        <TR>
                            <TD class="labelCell2">Twonky Vision:</TD>
                            <TD>
                                <?php                                
                                    echo shell_exec("if [ ! -z \"`pidof twonkymedia`\" ]; then echo gestartet;else echo beendet; fi");  //system call                
                                ?>
                            </TD>
                            <TD>
                                <form method="POST"  name="shell2">                                    
                                    <input type="hidden" name="action" value="ok" />
                                    <input type="hidden" name="pcmd" value="/mnt/HD_a2/www/support.sh twonky" />                                    
                                    <input name="B5" type="submit" value="Start / Stop"  class="BtnSubmit2">&nbsp;
                                </Form>    
                            </TD>
                        </TR>
                    </Table>

                    </FIELDSET>                  
                    </DIV>
                </td>    
            </TR>
        </Table>        
    </body>
</html>

The Form call the start.php itself and gives 2 Parameters to if clause at the beginning.
The pcmd Variable calls the shell script which toogles mldonkey or twonkyvision.

I know it's a not a fine solution.
It's unsecure, bad coded, but it work's for the moment.
I'll try to pursue your work on a better solution, but at the moment I'm not sure where to start ....

Last edited by spflug (2007-07-20 22:37:08)

Offline

 

#20 2007-07-21 13:29:01

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Edit the WebInterface of the DNS323 / CH3SNAS

Hi spflug,

is the twonky server running with lighttpd as well, or have you installed an apache for that?

I'm currently running Oxyl under lighttpd on my box - which is perfect for the Pinnacle Showcenter I have right now.
But in the past I've experimented a lot with twonky and might come back to it if I ever change the client hardware.

Cheers,

Emacs

Offline

 

#21 2007-07-21 19:56:41

spflug
Member
From: Germany
Registered: 2007-07-18
Posts: 21

Re: Edit the WebInterface of the DNS323 / CH3SNAS

Twonky brings it own webservice under port 9000 by default.

Offline

 

#22 2011-01-09 15:44:03

ako673de
New member
Registered: 2011-01-04
Posts: 3

Re: Edit the WebInterface of the DNS323 / CH3SNAS

spflug wrote:

Hi
[...]
I've attached a complete package with all changes. Perhaps someone can use it.

Stefan

Hi,

Here's my wishlist for the web interface of my CH3MNAS:

In first place I'm especially interested in putting links to the other webinterfaces (transmission, twonkymedia, ...) on the front page of my CH3MNAS. I've no idea of ASP and therefore I thought your attachment might give me some hints, but I can't find it in this thread. Could you please re-post or PM?

Second I'd like to integrate configuration options for external packages (coming with funplug or the like), that originally don't have any web based configuration (dnsmasq, inadyn, Wake-On-Lan(!), ...), here, too. Most probably I will have to extract those e.g. from "freetz" (a "FritzBox" extension), or does anybody know a better source (I didn't manage to find something deliberately dedicated to funplug)?

Last but not least I'd like to have everything being served on the standard port 80. This is essential if you're often working in environments where all other ports except 80 are being blocked! However, simply reconfiguring the other servers to port 80 does not work because the NAS always takes over and displays it's own webpage. So, is that possible at all? If so, then how?

Thanks
ako673de

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB