Saturday, January 22, 2011

Tomato firmware configuration

I have the Tomato firmware loaded into my Linksys router (WRT54GL 1.1). I acquired a second router of the same type and thought it'd be nice to duplicate the configuration. (if it breaks down or for whatever reason)
When I tried restoring the configuration, I got the error: "You cannot restore settings to a different router".
So I first needed to check what I had to change in the cfg file...

Source device:
gunzip -c tomato_v128_mDA3159.cfg | tr "\0" "\n" | grep "addr=00:1"
et0macaddr=00:16:B6:DA:31:59
lan_hwaddr=00:16:B6:DA:31:59
wan_hwaddr=00:16:B6:DA:31:5A
wl0_hwaddr=00:16:B6:DA:31:5B

Target device (to be overwritten):
gunzip -c tomato_v128_m4AF795.cfg | tr "\0" "\n" | grep "addr=00:1"
et0macaddr=00:1D:7E:4A:F7:95
lan_hwaddr=00:1D:7E:4A:F7:95
wan_hwaddr=00:1D:7E:4A:F7:96
wl0_hwaddr=00:1D:7E:4A:F7:97

Ah! It might check the MAC address! Let's try changing that...
gunzip -c tomato_v128_mDA3159.cfg | perl -pi -e \
's/addr=00:16:B6:DA:31:59/addr=00:1D:7E:4A:F7:95/g;'\
's/addr=00:16:B6:DA:31:5A/addr=00:1D:7E:4A:F7:96/g;'\
's/addr=00:16:B6:DA:31:5B/addr=00:1D:7E:4A:F7:97/g;'\
| gzip -9 > tomato_v128_copy.cfg
(NB: OS X didn't have a sed command that worked nicely with binary files.)

It restored the modified configuration file!
After resetting the modem and other connections that have the old MAC address in memory, I could connect to the internet again.

Update

When upgrading to a different model router, the configuration files will not match. (it checks
boardtype, boardnum, boardflags and other settings).
In that case, you could also SSH to old router and export the configuration in an easier format:
nvram export --dump > 1.txt
scp 1.txt darkfader@192.168.2.103:~

On the new router, you can them import the edited file.

Sunday, January 02, 2011

Snow Leopard theme for Windows 7 (by sagorpirbd)

Download and installation instructions here: Snow Leopard for Windows 7 theme by sagorpirbd
If you run into problems with the free-activator (just click the advertisement) or just want to see what's in there beforehand, you can extract the files yourself.
Extract "Snow Leopard for Win7 Setup.exe" using a RAR-extractor. The password is snhgqzsdhbktin7
Here's a batch file (put in "System Files") to help replacing the system files:

@echo off
SETLOCAL ENABLEEXTENSIONS
if exist backup goto :SKIPBACKUP

:BACKUP
mkdir backup
copy "%windir%\Explorer.exe" backup
copy "%windir%\System32\Shell32.dll" backup
copy "%windir%\System32\ExplorerFrame.dll" backup
copy "%windir%\System32\OobeFldr.dll" backup
pause

:SKIPBACKUP
call :REPLACE "explorer\64 BIT\explorer.exe" "%windir%\Explorer.exe"
call :REPLACE "shell32.dll\64 BIT\shell32.dll" "%windir%\System32\Shell32.dll"
call :REPLACE "ExplorerFrame.dll\64 BIT\ExplorerFrame.dll" "%windir%\System32\ExplorerFrame.dll"
call :REPLACE "Welcome Center\64 BIT\OobeFldr.dll" "%windir%\System32\OobeFldr.dll"
pause
goto :EOF

:REPLACE
echo --- From %~1 to %~2 ---
if not exist "%~1" goto :ERROR
takeown /F "%~2"
Icacls "%~2" /grant Administrators:F
rename "%~2" "%~nx2.old"
copy "%~1" "%~2"
sleep 5
fc /B "%~1" "%~2" || echo ------------- %~2 mismatch ---------------
exit /B

:ERROR
echo Could not find source file!
pause 

There is also a program called "leftsider" which puts the control icons of a window on the left side, just like on a real Mac.