[ale] ALE puzzler (or, BusyBox rocks)

JK jknapka at kneuro.net
Thu Feb 26 10:43:04 EST 2009


Hi folks,

I was happy with myself, not being a "senior" sysadmin, for
figuring this out; and I thought other folks might be
either amused by my naivete (did I miss some hugely obvious
approach?), or interested in learning a trick:

I have an embedded device to which I have only telnet access. The
device is running BusyBox and some proprietary applications, and
the proprietary code is acting "weird".  So I need to reboot the
machine, but before I do that I need to copy the whole filesystem
and make an image of RAM for postmortem analysis. (The code running
on the box is not mine, and I don't know what might be important
to the developer.) I can't do this on the box, since its flash FS
is over 85% utilized, so I somehow need to image it onto another
machine.

How to do this?  Remember I have only telnet to the box, so
rcp, scp, and rsync are out (I don't think rsync can use a telnet
connection as its transport; correct me if I'm wrong). Which
means I have to somehow push the data out from the embedded
device, rather than pulling it from my desktop machine.

BusyBox has ftpput, but transferring the entire FS one file at a
time, even with the assistance of "find", sounds like no fun at
all... Plus /dev/mem is a character device, so ftpput is not
going to be helpful there.  What to do, what to do?

Eventually I solved this with two of BusyBox's built-in utilities,
named below after spoiler space:






















































































   tar
   netcat


   tar cf - / | nc myServer myPort

combined with the opposite on myServer

   nc -l -p myPort > embeddedFS.tar

gave me the FS image I wanted. Similarly with /dev/mem, except
using dd instead of tar.  This was my first encounter with nc,
and boy what a helpful thing it is!


-- JK


-- 
I do not particularly want to go where the money is -
  it usually does not smell nice there. -- A. Stepanov


More information about the Ale mailing list