Monday, January 23, 2012

Android Kismet progress

Android process management sucks.  It's almost as if they don't want you to exec a native binary sanely (hint - they don't.)  This made it impossible to clean up a Kismet server process if a new apk was deployed, or the thread crashed, or whatever.

Ended up porting Kismet to run as a NDK shared library by adding a small wrapper that turns a jstring into an argc/argv[] pair and wraps main(), then runs the whole show in a java thread as a JNI call.

Tossed together a ridiculously basic Kismet client in java to get a display back on the main window; previously it scraped stdout from a kismet_server binary running via Runtime.exec.  All the client does right now is turn off *TIME and turn on *STATUS


(full-size)

Everything but the UI runs in a service which stays running in the background.  Because currently kismet runs in a sharedlib with effectively no mods (added an ifdef to not build tuntap), it isn't killable as a thread.  A future mod would be to add a jni call that clobbers globalreg->fatal-condition to cause a kismet shutdown.

Right now Kismet throws some spurious errors because it isn't configured  to have any writeable directories to store tags, etc.  I don't care right now.

Thanks to Laen and Dorkbot, got some USB power injector boards being made as well:



Super simple board to pull 5v from a battery pack, and prevent VCC from the phone from being connected to the radio.

3 comments:

  1. Hey dragorn, thanks for the post. I'm currently in the process of doing the same thing with the Cyanogenmod 9 nightly source as my build. I was wondering if you can maybe disclose in a little more detail how you set up the build environment for cross-compiling kismet? You mentioned NDK...so you're not using the prebuilt toolchain that comes with the ROM source? What alterations did you make in either the configure or the Makefile.inc?

    ReplyDelete
  2. Yes, I'm using the NDK to compile it. It doesn't need root and doesn't need to be a system app, so you don't need to compile it with the ROM toolchain.

    I'll post the SVN code in a bit once I clean it up more; the ndk doesn't use the base makefile. Other than making a ndk-compatible android.mk and application.mk there are no changes to kismet.

    ReplyDelete
  3. Any news ? where to suscribe your newsletter ?

    Thanks ;) and good luck

    ReplyDelete