Data Recovery: SD, ddrescue and Android

All things come to an end at some point, so do uSD cards. And they tend to do that just about the time you normally LEAST expect them to.
Anyways, at my country house, away from the noise of the big city I had a cheap cellphone tethering internets over an OpenVPN connection. The operator does not offer proper external IP service, so I have to run an OpenVPN connection to have access to surveillance.
I have a bunch of cams here and there, mostly watching after these guys:

The cellphone itself runs a rooted android and a debian chroot with OpenVPN off an SD card. The SD card died this weekend and at some point I realised that I don’t have a recent backup. It was no big deal, just a debian rootfs + a bunch of config files for OpenVPN, but since I spent a while then and now perfecting configs and tuning OpenVPN for performance over the celluar network those weren’t backed up. Ooops.

Anyways, this note talks about data recovery from such an SD card and the common pitfalls.

(more…)

android and dnsmasq: making a better dnsmasq wrapper

A few posts ago, I wrote about making android’s dnsmasq more usable by turning on local hostname resolution. Since I use my android phone as a pocket server, dnsmasq plays a vital role here.
However, one thing was bad – whenever I used usb tether connection to my PC, the whole dns thingie did not work. Why?

So, a little theory. When I enable the wifi ap mode, an interface called ap0 is brought up with a static ip 192.168.43.1.
Whenever I turn on usb tethering, usb0 pops into the existence with ip 192.168.42.129.
(On other mobile phones these settings can differ)
Fine, so when we resolve our pocket server from within the usb0 network, we want to get 192.168.42.129, and when via a wireless network – 192.168.43.1
I started by adding two distinct entries in /etc/hosts

192.168.43.1 anomalia anomalia.portable git.anomalia p.anomalia
192.168.42.129 anomalia anomalia.portable git.anomalia p.anomalia

Did it work? No! Why?
(more…)

There’s a server in my pocket!

I’m not a psychopath, I’m just very creative.
(c) Harry Potter and the Methods of Rationality

Taking part in competitions like “eurobot”, where you have to do some coding in extreme conditions, on/under a table, on the floor, etc. and a few other trips like that convinced me that I should definitely make something more of my cell phone. Something, that will help me out in this case.

So, we have:

  • A dumb brick called ‘HD7 Pro’ from china, with android 2.3.5. One and a half years old.
  • /dev/brains
  • A few hours of free time

What we want to get:

  • A portable server with lighttpd, ssh, git, etc
  • WiFi AP with local dns, internet tethering (if we’re not roaming!)

2013-03-18-00-19-06

(more…)

Simple things that look complex: ping from android

Coding for a mobile platform has always been a frustrating experience ever since J2ME. Right now I really hope, that Jolla Mobile will succeed and roll their thingie to the market, since both iOS and android are smoking crap. But for now – I choose droid as a lesser evil.
So, a few days ago I needed to ping the internets from my app, to check if the connection is live. It’s been less than a week since a friend told me of all the ‘fun’ he had with SCNetworkCheckReachabilityByName on iOS for that purpose.

(more…)

utool for android: run a script once you insert a flash.

Looks like I’ve been kind of productive these days, making the third app this week. This time it’s a very weird one.
It is a small android app that allows you to run a custom script, once a device with a special markerfile in its root dir is mounted by the system.
That’s it. Too bad we don’t have anything similar to udev here, otherwise we’d only need to write one rule.
Create the script file with whatever you want to, place it somewhere in the device, create an .IOMARKER file in the root of the flash jump drive, or microsd (or change the filename in settings), fill in the path to the script, pick if you want to run as root.
Done.


(more…)

Another android app: FixNet

Okay. Android is not a perfect platform, but so far the best for me. Anyway, quite a few thingies are shitty. one is how dhcp hostname is handled. The default dhcp hostname is ‘android_’ + a huge device id. Not a big pain if you have a static mac address, and can therefore assign a readable hostname for the device on the home net.
However that was not the case for wired ethernet on my flytouch2 tablet that I’m turning into a standalone terminal. Due to teh fact that whoever made this was retarted enough the device was getting a random mac everytime it booted.
Just awesome. Just a nice anon’s tablet…
Anyway, I needed a way to fix that. The fast way was repack the ramdisk image and add some stuff to init.rc. I could fix the mac there, but still no way to fix the hostname, since it is set by java code after the init.rc.

(more…)

NetTTS 0.2 released!

Finally found a little bit of time, and here we go. NetTTS 0.2 release with most bugs I knew of fixed, maybe some new added.
For those who aren’t familiar – NetTTS is my app for android that allows you to use android’s TTS engines remotely with primitive tools like netcat or telnet around.
(more…)

MK802: First impressions, teardown and adding an uart.

I finally got it! For roughly 60 bucks an 1Ghz ARM CPU + 1GiB RAM is a deal. Anyways, since android is quite useless on such a device, the first thing I’ve done (after insuring that all came in working), I took the thing apart.
Some teardown photos can be found here.
Next was the surgical procedure of adding an UART header. I bet I’ll need that one pretty soon. The 4 pads near the CPU are Vcc(?), GND and RX&TX pair, so adding a header was simple and straightforward.

Vanilla firmware boot log follows.
(more…)