Mirror/Clone Packets to/from IP Address Using DD-WRT

Here’s a quick tip that is invaluable when debugging your communications with a web service from a device (in my case and Android phone) that is on you network.  This of course requires that you have root access on your routing device…I use a WRT54G running DD-WRT.

Here it is:

iptables -t mangle -A POSTROUTING -d -j ROUTE –tee –gw
iptables -t mangle -A PREROUTING -s -j ROUTE –tee –gw

…where is the address of my Android device and is the address of the computer I want the traffic mirrored to.  On my computer I’m running Wireshark which will now receive any traffic to or from my Android device.  Everything will work as normal except that now the gateway computer can sniff all the Android’s traffic!

Thanks to the original poster for a great tip!  (http://www.question-defense.com/2010/02/04/use-wireshark-and-dd-wrt-router-firmware-to-imitate-port-monitoring-on-a-router-switch-port)

Tags: , ,
Posted in Developement by kgmoney. 6 Comments

Q&A: Do I have to pay for an Android app twice?

I’ve had a couple of people recently asking me if it was necessary to pay for an Android app twice.  Meaning if they buy an app on their Android phone, do they have to pay again in order to download the same app onto one (or all) of their other Android devices.  The answer is, it depends.  It is possible to only pay once and install on multiple devices, but it requires that you use the same Gmail account on both devices.  This, of course, is no problem unless you want to keep the data (emails, contacts, etc) in that account private.

Solution?  Create a separate Gmail account just for use with the Google Play store and keep your personal Gmail account private.  Here are the steps…

  1. Create a new Gmail account.  This will be the one that is common to all your devices.  If privacy is not a concern then you can skip this step and use your existing Gmail account.
  2. On each device, add your Gmail account (new or existing) by going to the system Settings -> Accounts & Sync and clicking the Add Account button.
  3. On each device, launch the Google Play store app and choose Accounts from the menu.
  4. Select the account that you wish to use for all devices
Once you have all your devices using the same Gmail account for the Google Play store, anytime you purchase an app on one device, it will show up as purchased on all of your other Android devices as well where you can choose to install it, not having to pay for the app again.

Android ServerSocket Permission Denied

I was just trying to create a web server application and ran into this, so I thought I’d share it. I wanted to run my Android web server on port 80 (since that’s where web servers usually run), but I kept getting a BindException saying “Permission denied”. Note that ServerSocket, of course, requires android.permission.INTERNET in your manifest.  After a little digging, I’ve learned that ports 1-1024 are protected and only accessible by root (pretty much eliminating them for any app that you want to make widely available, since most people don’t have rooted phones. To get around this, of course, all you have to do is use a port greater than 1024…I was just hoping to cut down on the amount of typing when connecting to my web server from a browser…oh well.

How to Factory Reset Samsung Galaxy S II (Epic 4G)

I just recently upgraded to the new Samsung Galaxy S II (or Epic 4G in Sprint speak), and today I’m posting my first video about the phone.  I’m really liking the Galaxy S II, mostly because of it’s beautiful, large AMOLED screen—it truely is very pretty!

It’s not something you need to do everyday, but when you’re locked out of your phone, knowing how to do a hard reset is crucial.  So with that, here are the steps to perform a factory reset on the Samsung Galaxy S II Android phone.

Note:  Remove your SD card.  I know some people say this is optional and in my experience it is technically optional.  But here’s the thing, I’m not interested in taking any chances when it comes to my data.  I keep my contacts backed up on my SD card as well as store pictures, documents, etc, and I’m not going to take a chance on loosing them.

  1. Remove your SD card.  This done by removing the back of the phone case and pressing the SD card into it’s socket.  When you release pressure on the SD card it will pop out and you can remove it.
  2. Hold down the Volume Up and Power buttons simultaneously.
  3. Continue holding the Volume Up and Power buttons until the Samsung Galaxy S II logo screen is displayed.
  4. When the Galaxy S II logo screen is displayed, release the Power button but continue holding the Volume Up button until the Android System Recovery menu is displayed.
  5. Once you are on the Android System Recovery menu, select the wipe data/factory reset option.  Moving the selection up and down is done with the Volume Up and Volume Down buttons.  Once you have the wipe data/factory reset option highlighted, you select it by touching the Home button.
  6. Once you have chosen the factory reset option, you will see a confirmation screen.  Highlight the Yes — delete all user data option and touch the Home button to select it.
  7. The procees of wiping the phone should only take a few seconds and when it is finished, you will be returned to the Android System Recovery menu.
  8. Highlight and select the reboot system now option
  9. You phone will reboot back into normal operating mode (this first boot will take a little longer than usual)
  10. Reinsert your SD and put the back cover in place.

If any of that is unclear, hopefully this video will help clear things up…