Feeds:
Posts
Comments

Archive for the ‘Linksys WRT54G – my hacking guide’ Category

First, let’s download the sources of a distribution, compile it as it comes and install it in the router. The next step would be to modify a part of it as you need. Download the source code from WhiteRussian distribution from this page:

http://downloads.openwrt.org/whiterussian/0.9/

Use this URL:

http://downloads.openwrt.org/whiterussian/0.9/whiterussian-0.9.tar.bz2

unzip and move to the whiterussian-0.9/ folder. You should start by reading the README file or follow these instructions.

type the following command if you want to change setup options before compiling the distribution:

> make menuconfig

In my case, I didn’t need to mess with that configuration. Probably you won’t need.

> make

The way OpenWrt is created is as follows: All you download are configuration files. When you run the compilation scripts, they will download the source files from the Linux kernel and other programs needed, like the sources of the gcc compiler, the libraries for STD, and others. In the case of WhiteRussian, it downloads the sources for kernel version 2.4. Be aware that it will download the zip of the sources only if it’s not found under the /dl folder of the root folder. So, the first time you compile it, it will download all the libraries and the kernel. The next time this won’t happen, unless files are deleted from /dl folder.

—–

If you want to modify the sources, what I’ve done so far is modifying the Linux kernel. Because WhiteRussian downloads the kernel from a well known Linux kernel download website, it’s necessary to tell the compilation scripts that I want it to download my modified version of the source files. In my case, I downloaded the source files for the kernel, applied a patch, zipped again, and uploaded it to my website. Then I found the configuration file I needed to modify, which is found here:

/whiterussian-0.9/toolchain/kernel-headers/

And opened the Makefile. There I found the variable LINUX_HEADERS_SITE, which was set to the Linux kernel download website, and changed it to the following:

LINUX_HEADERS_SITE=www.csee.usf.edu/~mjimeno \
http://www.fr.kernel.org/pub/linux/kernel/v2.4 \
http://www.kernel.org/pub/linux/kernel/v2.4 \

http://www.de.kernel.org/pub/linux/kernel/v2.4

I also modified the LINUX_KERNEL_MD5SUM, which of course changed when I compiled the sources again. (The md5sum the file comes with should be the one for the kernel files located in the Linux website, which of course doesn’t change)

Then I ran “make clean” and “make” to see the changes.

Read Full Post »

This is were the fun gets funnier. The existing packages usually have many of the applications you can think of to put in a small router. But, as you use your customizable router, you might start thinking about good tasks that your router should perform.

The first things you need to do are downloading and untar-ing the OpenWRT SDK. For this, you need to know which of the different versions of SDK you need to download. This could be trivial for some people, but it was not for me at the beginning, so this might help some of you. Quoting from a post found in a Linux forum, the following are the different versions you will find for the SDK, and you can select yours according to the description:

“Basically, the different kernel designations identify which instruction set the compiler was told to optimize for. An i686 CPU can run i586 and i386 instructions, so, as you observed, an i686 can run an i386 kernel. However, it may not execute as optimally as one specifically compiled for an i686.

These are the designations you will typically run into:

x86_64 Processors
* AMD’s Athlon 64, Athlon 64-FX, and Opteron
* Intel EMT64 processors – Nocona Xeon, Pentium 4′s using the E0 revision of the Prescott core (AKA Pentium 4, model F)

i686 Processors
* All Intel 32-bit Pentiums (excluding Pentium 1 and Pentium MMX)
* All AMD 32-bit Athlon

i586 Processors
* All 32-bit AMD Ks
* Pentium 1
* Pentium MMX

i386 Processors
* A generic “lowest common denominator” designation for Intel 80386 compatible CPUs (includes all of the above, but does not take advantage of extended instructions on those later CPUs).”

Taken from: http://www.linuxquestions.org/questions/linux-newbie-8/please-explain-386-vs.-686-versions-310099/

As I’m using WhiteRussian, I will download the SDK from here:

http://downloads.openwrt.org/whiterussian/newest/

Now, this is the OpenWrt link to create and build your own package:

http://wiki.openwrt.org/BuildingPackagesHowTo

The above tutorial could be too much for people starting in this idea of flashing routers, like me. It shows all the options available to create and install packages, but the authors supposed you were building a whole new big package. So, they assume your code is located under a URL, and is based on tons of files and makefiles. This is not what I was looking for, at least not at the beginning. So, I finally could find the tutorial that worked for me, here:

http://gargoyle-router.com/openwrt-coding.html

This is the most complete tutorial for creating packages I’ve found that has been designed for people willing to start from zero. The point is that the tutorial shows how to create a package for a simple helloworld. So, your only source is a C file with 6 lines of code. At the end, you have your own hello world! running in your router. From that, you can start building your desired functionalities.

Read Full Post »

Xwrt is a web interface for WRT. I’ve have tried and can say that is much better than the original the WhiteRussian comes with. The basic interface allows you to do only basic stuff like installing a firmware, changing the IP of the router, and other simple tasks. The XWRT allows you the same, but you can also install a package from the web interface, uninstall any exisiting package, see memory usage, CPU usage, reboot the router, and many other tasks I haven’t tried yet.

It can be downloaded from the site www.x-wrt.org.

I run this command:

> ipkg install http://ftp.berlios.de/pub/xwrt/webif_latest_stable.ipk

Some packages might be needed, due to an error generated while trying to install it. I got the following error:

An error occurred, return value: 1.
Collected errors:
ERROR: Cannot satisfy the following dependencies for webif:
ipkg-upgrade-fix base-files-uci

Then I had to download the above mentioned packages from the following url:

ftp://ftp.berlios.de/pub/xwrt/packages

For example, for base-files-uci, I did the following:
> cd /tmp
> wget ftp://ftp.berlios.de/pub/xwrt/packages/base-files-uci_0-3_mipsel.ipk
> /bin/ipkg install base-files-uci_0-3_mipsel.ipk

Then the same for the package ipkg-upgrade-fix

After installing those packages, I tried to install the x-wrt and worked fine.

Read Full Post »

Is good you read this tutorial for the ipkg command

http://www.dd-wrt.com/wiki/index.php/Ipkg

Almost for sure you would like to install new packages, there are 2 list of packages for whiterussian. I’m still trying to know which is the difference. The lists can be found here:

http://downloads.openwrt.org/backports/0.9/
http://downloads.openwrt.org/whiterussian/packages/

Given that OpenWrt is documented, but not as desired, and besides that, many of the packages are developed by different people, you will find that many of them are not well or not even documented. For this reason, the best I’ve found to get some previous documentation before installing the packages is doing the following:

>ipkg update

This will create two files, one called WhiteRussian, the other non-free. Both can be found under the folder /usr/lib/ipkg/lists. Anyhow, the same information will be given by OpenWrt when you type the above command. Take a look at the WhiteRussian list. Has the same list of packages found in the http://downloads.openwrt.org/whiterussian/packages/ URL. But, it has a lot of extra information, including a very very brief description of what the packages does. Reading the descriptions I found one that sends WoL magic packets. Another one is the libpcap, the well known package to sniff the network. So, you might find one that interests you…

I personally needed srelay, that can be found in the backports url. This slreay is an implementation of a Socks proxy server. So, I needed to download it to the router, so I first browsed to the tmp folder, as recommended in the ipkg tutorial, and then I used the following command:

> wget http://downloads.openwrt.org/backports/0.9/srelay_0.4.6-1_mipsel.ipk

then I installed the package:

> /bin/ipkg install srelay_0.4.6-1_mipsel.ipk

While trying to run the srelay, it threw an error message, it was needing another package. So thanks a post found in the OpenWrt forum, I realized I needed to install another package, a libwrap. So, I did the same:

> wget http://downloads.openwrt.org/backports/0.9/libwrap_7.6-1_mipsel.ipk

And then installed it the same way. Then the proxy worked fine.

Read Full Post »

SSH: Now that you have a new firmware, you can talk to your router using ssh. So just type “>ssh 192.168.1.1″ in a terminal window, and the router will ask for password for root. When logged in, you can navigate through your router’s folders almost as if you were in a regular Linux machine. It doesn’t have many of the fancy applications from a regular Linux distribution, but it has as much as necessary.

TFTP: You will need it if you want to upload a file to the router. I will eventually update this part (I tried TFTP but found it not intuitive).

I actually found the way to upload files (actually download files) to the router. I uploaded the file first to my website, then issued a wget command from the ssh command prompt to download the file.

Read Full Post »

The OpenWrt version WhiteRussian RC 9 is used.

The binaries for this version can be downloaded from:

http://downloads.openwrt.org/whiterussian/newest/

- You will see 4 folders, 3 of them (default, micro and pptp) are for different OpenWrt versions, the other is for packages. Select default. More info on the versions is here:

http://wiki.openwrt.org/OpenWrtDocs/Installing#head-1a60a7c16a58cbcb8ba1434325f4f24567b0b965

- Click on default:
http://downloads.openwrt.org/whiterussian/newest/default/
then select the image according to the version of the router (openwrt-wrt54g-squashfs.bin in my case).

- Compare the checksum of the file downloaded with what you should have. This is to be sure the file is not corrupted. The list of the checksums for the binary files is here:

http://downloads.openwrt.org/whiterussian/newest/MD5SUMS

- In Linux, you can use the command >md5sum [name of file]

- Compare checksums from using the command and the one found in the file to be sure everything is ok.

Login to your Linksys administration page (usually 192.168.1.1) and type user and password (admin admin if the first time). Look for the option to upgrade firmware, then browse for the OpenWrt image you just downloaded, and upload it to the router. The firmware itself will be updated and you will realize is done because the administration page is changed to the one from OpenWrt.

Is recommended that you change the password immediately to something easy to remember for you.

Read Full Post »

The following are the steps to flash a Linksys WRT54G router. It’s necessary that the version is no greater than 5. For this project the router used is version 2.2. You would have to buy it through Ebay today, because what’s offered in BestBuy or Amazon are version 6 and above. I got it for $50 in Ebay.

Tools:

  1. Soft version of the book “Linksys WRT54G Ultimate Hacking”
  2. The Linksys router
  3. Linux machine to connect to the router
  4. 2 Ethernet cables, of course

Prerequisites:

- Be sure the Linux machine, if in a laptop, is plugged to the wall, so it will not be turned off during flashing. Flashing procedure must not be interrupted, otherwise, recovering will teach you not do it ever again.

- It’s recommended from the book that the Linux machine uses a fixed IP instead of a dynamic one (used as default)

- Download Linksys firmware (just in case you don’t like the new firmware and want to come back). Go to Linksys, and select Support -> Technical Support -> Choose a product -> Routers and Access points -> (Select Category) Wireless Routers -> WRT54G -> Downloads (Firmware, etc) -> Please select version (2.2 in my case) -> Download Firmware

Read Full Post »

Follow

Get every new post delivered to your Inbox.