I am not responsible if your devices send you back in time, explodes, implodes, bricks or flies into space from the use of any software I put up.


Saturday, July 16, 2011

Hacking TP-Link WR1043ND Part 3

I will only be posting HOW-TO not found in OpenWRT Pages, if you need to config a particular setting please refer to the Well-Documented OpenWRT HOW-TOs here.
Useful Wiki on OpenWRT include
  • Getting 3G Modem working
  • VPN (not complete)
  • Files and Settings
  • NFS Network FileSharing
It is troublesome/pointless to rewrite well-documented resources.
Reading the How-To is a must have for all OpenWRT newbies!

First you need to set a Router Config Page Login Password.
Otherwise the SSH ports will not be open for you to configure and upload files to it.
Open Web Browser, Enter "" in URL Bar.
Then follow the picture below:

From here onward is to demostrate how to login and use the Router like a Linux Terminal Computer.
It makes little sense not to leverage on the Compute Capabilities of Linux after using a more powerful third party firmware.
OpenWRT assumes users know Linux Terminal KungFu hence it is intimidating to those who don't.
Hopefully after reading this you will pick up some Terminal KungFu.
Upload Files to Router using SCP

SSH (Login) into Router

Basic Linux Commands in OpenWRT
  • "ls" - List Files in Existing Folder
  • "dmesg" - Display System(Router) diagnostic message 
  • "pwd" - Display Present Working Directory
  • "opkg" - OpenWRT Package Installer 
    • "opkg install package" to install a software call "package"
    • "opkg remove package" to uninstall a software call "package"
    • "opkg list-install" to list all installed software"
    • "opkg update" to update list of package available in the OpenWRT Repository the router needs to be connected to the internet before you can update
    • "opkg" to display all possible commands
  • "wifi" to restart Wireless Radio
  • "ifup/down" to start or stop a Particular Interface
    • "ifup wan" to start WAN interface
    • "ifdown wan" to stop WAN interface
    • "ifup lan" to start LAN interface
    • "ifdown lan" to stop LAN interface
  • "cd" to change directory
    • "cd .." to go up 1 level (Exit the folder)
    • "cd /" to go to Root Directory 
    • "cd /tmp/ to go to tmp directory (If you want to go to a specific directory type "cd /tm" then press Tab to auto complete the name of the folder useful if the name of the folder is very very long
  • "vi" Text Editor
    • eg. to Edit a file call "network" in folder "/etc/config/" type "vi /etc/config/network"
    • The default mode in VI is view mode to display text files
    • To enter/delete Text in vi press "i" to Enter insert mode and type to enter backspace to delete
    • To delete a particular line of text in vi Press "Esc" go to the line using arrow then enter "dd" twice and the line disappears
    • To save a file press "Esc" then ":w" (w stands for write)
    • To exit VI press "Esc" then ":q" (q stands for quit)
    • To exit without saving  press "Esc" then ":q!" (! stands for "I don't care just do it !)
    • To exit with saving  press "Esc" then ":wq"
  • "reboot" to restart Router
  • "cp" - copy eg to copy a file called "network" from inside /tmp/ to /etc/config"      
"cp /tmp/network /etc/config/network"
    • Syntax as follows: cp <source> <destination>
  • "rm" - Delete a particular file
  • "wget" -Download file from Internet (Must be connected to Internet first, make sure the file size doesn't exceed the the total memory of the router)

The list of commands is actually quite a chunk, you should read up on Linux Shell if you are interested.

No comments: