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 2008-02-05 03:52:06

jayas
Member
Registered: 2008-01-24
Posts: 151

re: patching DNS-323 web scripts

Hello,

I like to patch simple nags on the web interface, for example to remove the (strange) restriction to using special characters in password in /web/tools/admin.asp page.

I can do this by copying the entire web to disk, and changing the symbolic link.  I would like to know if there is a simpler method, for example to change just that page and update it in the flash file system.

Kind regards,

Jaya


H/W=B1 F/W=1.04; RAID1: SAMSUNG HD501LJ T166 (500GB, SATA 3.0Gb/s 16MB)

Offline

 

#2 2008-02-05 09:04:03

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

Re: re: patching DNS-323 web scripts

copy the web dir whit webs in it and just run webs then  it will use the files from where it is (from what i rember)


First user to fun_plug the dns-323.

Offline

 

#3 2008-02-05 12:02:03

jules
Member
Registered: 2008-01-26
Posts: 78

Re: re: patching DNS-323 web scripts

jayas wrote:

I would like to know if there is a simpler method, for example to change just that page and update it in the flash file system.

Updating the flash content is possible, like the fonz's fun_plug store-passwd.sh does to update the /etc/passwd and /etc/shadow files.
You need only to mount the right device and copy the updated asp file, i think.


CH3SNAS - Black Box Ed. • FW:1.03b6a • 2 x WD5000AAKS

Offline

 

#4 2008-02-05 12:54:50

HaydnH
Member
Registered: 2007-09-28
Posts: 187

Re: re: patching DNS-323 web scripts

Or another alternative is to copy the web stuff to disk and mount it over the existing folder, e.g: "cp -Rd /web/web /mnt/HD_a2/web && mount /mnt/HD_a2/web /web/web". I'm currently undecided about editing the pages in flash, I can't see too many problems with it other than possibly losing the changes each firmware update and possibly having issues with d-link re: warranty if you ever need to return the box... but you never know...

Offline

 

#5 2008-02-05 13:45:47

jayas
Member
Registered: 2008-01-24
Posts: 151

Re: re: patching DNS-323 web scripts

HaydnH wrote:

Or another alternative is to copy the web stuff to disk and mount it over the existing folder...

This was the first thing I did (see my original post) and I am looking for something better.  I think Jules's suggestion is a good lead.  I think I can work out where the image of web pages is stored in flash file system.

Jaya


H/W=B1 F/W=1.04; RAID1: SAMSUNG HD501LJ T166 (500GB, SATA 3.0Gb/s 16MB)

Offline

 

#6 2008-02-05 15:11:56

HaydnH
Member
Registered: 2007-09-28
Posts: 187

Re: re: patching DNS-323 web scripts

Sorry - I miss read your post.

Having a [very] quick look, I doubt you'll be able to easily edit the webpages as they're stored as cramfs:

Code:

/ # ls /sys/crfs/web_page 
ChangeHD.asp    error.asp       login.asp       temper.asp
advanced        formatHD        main_menu.asp   tools
close_page.asp  help            non_HD.asp      user
css.css         home            relogin.asp     version.asp
debug.asp       images          status
/ # mount |grep /sys/crfs
/dev/loop0 on /sys/crfs type cramfs (ro)
/ #

Offline

 

#7 2008-02-05 15:38:49

jayas
Member
Registered: 2008-01-24
Posts: 151

Re: re: patching DNS-323 web scripts

Hi HaydnH,

On my 1.04 firmware CRFS seems mounted differently to yours:

Code:

~ # mount | grep crfs
/image.cfs on /sys/crfs type cramfs (rw,loop=/dev/loop0)

I can dump /image.cfs, work out how to patch it and rebuild a new image.  I need to work out how to save the patched image to flash as /image.cfs.  If warranty call is required  I just have to restore the original image.

Regards

Jaya


H/W=B1 F/W=1.04; RAID1: SAMSUNG HD501LJ T166 (500GB, SATA 3.0Gb/s 16MB)

Offline

 

#8 2008-02-05 17:04:50

HaydnH
Member
Registered: 2007-09-28
Posts: 187

Re: re: patching DNS-323 web scripts

hmmm... good point, cramfs is located in root, this seems possible as below BUT I haven't put the image back to see if this works - so I take NO RESPONSIBILITY blah blah blah - however I'd be interested to know the results!

From a linux box (10.8.0.1 is the vpn ip address of my nas box):

Code:

[root@localhost cramfs]$ scp 10.8.0.1:/image.cfs .
root@10.8.0.1's password: 
image.cfs                                     100% 5276KB  23.6KB/s   03:44    
[root@localhost cramfs]$ file image.cfs
image.cfs.gz: Linux Compressed ROM File System data, little endian size 65536 CRC 0x9d5e2e18, edition 1571809397, 1395023733 blocks, -1147084280 files
[root@localhost cramfs]# mount image.cfs /mnt -o loop
[root@localhost cramfs]# mkdir out
[root@localhost cramfs]# cd out/
[root@localhost out]# cp -Rd /mnt/* .
[root@localhost out]# ls -al
total 64
drwxr-xr-x 16 root  root  4096 2008-02-05 14:54 .
drwxrwxr-x  3 haydn haydn 4096 2008-02-05 14:54 ..
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 bin
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 codepages
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 default
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 etc_codepage
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 lib
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 lltd
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 LPRng
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 samba
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 sbin
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 scsi
drwxr-xr-x  5 root  root  4096 2008-02-05 14:54 shared_name
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 upnp
drwxr-xr-x  2 root  root  4096 2008-02-05 14:54 web
drwxr-xr-x 10 root  root  4096 2008-02-05 14:54 web_page
[root@localhost out]# cd web_page/
[root@localhost web_page]# touch test
[root@localhost web_page]# cd ..
[root@localhost out]# mkfs.cramfs . ../test.img
[root@localhost out]# cd ..
[root@localhost cramfs]# ls -alh
total 16M
drwxrwxr-x  3 haydn haydn 4.0K 2008-02-05 14:57 .
drwxrwxr-x  4 haydn haydn 4.0K 2008-02-05 14:31 ..
-rw-r--r--  1 haydn haydn 5.2M 2008-02-05 14:35 image.cfs
-rw-r--r--  1 haydn haydn 5.2M 2008-02-05 14:46 image.cfs.SAVE
drwxr-xr-x 16 root  root  4.0K 2008-02-05 14:54 out
-rw-r--r--  1 root  root  5.2M 2008-02-05 14:57 test.img
[root@localhost cramfs]# umount /mnt
[root@localhost cramfs]# mount ./test.img /mnt -o loop
[root@localhost cramfs]# cd /mnt/web_page/
[root@localhost web_page]# ls -lh test
-rw-r--r-- 1 root root 0 1970-01-01 01:00 test
[root@localhost web_page]#

Offline

 

#9 2008-02-05 17:09:06

HaydnH
Member
Registered: 2007-09-28
Posts: 187

Re: re: patching DNS-323 web scripts

hmmm: comparing the output of file before and after:

Before: Linux Compressed ROM File System data, little endian size 65536 CRC 0x9d5e2e18, edition 1571809397, 1395023733 blocks, -1147084280 files
Aftere:  Linux Compressed ROM File System data, little endian size 5402624 version #2 sorted_dirs CRC 0xd093b27d, edition 0, 2926 blocks, 288 files

Looks like you may need to work out the arguments to mkfs.cramfs....

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB