Projectjes met de Raspberry Pi

Unbricking your router with a Raspberry Pi en

By Gtoniser on Sunday 24 February 2013 15:15 - Comments (6)
Category: Raspberri Pi, Views: 8.504

So one of my friends wanted to install a new firmware on his router (a Netgear WNR3500Lv2). Unfortunately he downloaded a wrong version and thus his router refused to boot. Bricked.

Now there are some tutorials on the internet on how to unbrick this router, one involves a USB-TTL cable and one uses a method which short circuits 2 pins on the mainboard.
The second method helped me out when I bricked my router, the Netgear WNR3500Lv1 (note the v1), but the v2 has a different chip layout and we could not find the right chip on his model.

The first method seems a bit less dangerous, but requires a USB-TTL cable, which I don't happen to have. What I do have is a Raspberry Pi, which has a serial port connection.
Getting started
- Raspberry Pi running Raspbian
- Some cables
- Broken WNR3500Lv2

I'm connecting to my RPi via SSH.
To be able to use the serial port we first need to disable the console login that the RPi automatically starts up on the serial port when booting.

This is done by commenting out the following line in /etc/inittab
change
code:
1
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

to:
code:
1
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100



Now after rebooting the RPi, we can use the serial port for our own purposes.
Connecting the RPi to the router
The Raspberry Pi serial ports are on GPIO 14 and 15:
http://lavalink.com/wp-content/uploads/2012/04/raspberry-pi-serial_sm-241x300.jpg(source: lavalink.com)

We connect these ports to the RX and TX on the router (make sure the router is turned off!). We also connect the GND.
http://static.trabot.net/external/tweakers/rpi-serial-router-01_thumb.jpg(click)
From left to right: GND, RX, TX

Overview:
http://static.trabot.net/external/tweakers/rpi-serial-router-02_thumb.jpg(click)

I am using a breadboard here in between, you can ignore this and all the wires on it, the only reason I used it is because I didn't have any Female-Female cables. Connecting the RPi directly to the router is how it works.
Restoring the firmware
Now to get the serial interface working we use minicom. Install it first on the RPi with
code:
1
sudo apt-get install minicom


Then run minicom on the serial port of the RPi
code:
1
sudo minicom -b 115200 -o -D /dev/ttyAMA0


We are now connected directly to the router with our Raspberry Pi. Feeling like a hacker already?

Now power on the router while holding Ctrl + C in the terminal window:
http://static.trabot.net/external/tweakers/rpi-terminal.png

When this is done just execute the command
code:
1
tftpd

to start the tftp deamon.

Now what I did was connecting a laptop to the router with a static IP address (since I was using my main PC to control the Pi) so that we can reach the router on 192.168.1.1.
When this is done we can download the original firmware for the WNR3500Lv2 and push this to the router with tftp
code:
1
tftp -i 192.168.1.1 put FIRMWARE_FILE


After this the router rebooted and I could access the admin interface on 192.168.1.1 in my browser.

If you want to try this for yourself, the following guides can be helpful:
SSH connection to your RPi
Using the RPi serial port
http://www.myopenrouter.c...USB-TTL-Cable-on-Windows/ (step 9 and further explain how to put the firmware on the router)
http://www.myopenrouter.c...-A-Serial-Cable-on-Linux/ (explains how to use this method on linux, you could use this to push the firmware from your RPi)

De vuurwerkbom

Door Gtoniser op dinsdag 4 december 2012 14:18 - Reacties (16)
Categorie: Raspberri Pi, Views: 5.569

Rond sinterklaas is het altijd weer tijd voor sinterklaas surprises. Het idee kwam me dit jaar eigenlijk een beetje aanwaaien: mijn broertje vroeg namelijk een vuurwerkbon als kado.
Door expres de laatste letter verkeerd te lezen was mijn idee van een surprise al ontstaan.
Het uiteindelijke doel: een soort van 'countdown' tijdbom (uiteraard nep) die onschadelijk te maken is met behulp van een code/wachtwoord.

Lees verder »