robbi5 / android-dropbear

Build script and configuration to cross-compile Dropbear for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android Dropbear Builds

Build status

Build script and configuration to cross-compile Dropbear for Android.

I've tested the built dropbearkey binary and use the dbclient binary regularly. The dropbear server binary builds successfully but is untested and I suspect would benefit from some adjustment of server related options to tune it for the Android environment - pull requests welcomed.

Precompiled Binaries

armv7a, aarch64, i686 and x86_64 Android binaries compiled under GitHub Actions are available as release assets from this repository.

There is a JAR release asset containing all of the binaries (renamed to libname.so to allow them to be executed from within an Android app). This is also available as a package for ease of use as a dependency in Android Studio.

Manual Build

  • Ensure that the Android NDK is located at $ANDROID_NDK_HOME or $ANDROID_HOME/ndk-bundle.
  • Run ./build

Example Usage

From an Android app with the published package added as a dependency:

val libDir = context.applicationInfo.nativeLibraryDir

val args = ArrayList<String>()
args.add("$libDir/libdbclient.so")
args.add("test@example.com")

val builder = ProcessBuilder(args)
val dbclient = builder.start()

val result = dbclient.waitFor()
val stdout = dbclient.inputStream.bufferedReader().use(BufferedReader::readText)
val stderr = dbclient.errorStream.bufferedReader().use(BufferedReader::readText)

Log.d(TAG, "Exit code: $result")
Log.d(TAG, "Standard out: $stdout")
Log.d(TAG, "Standard error: $stderr")

For a full example, you can check out the source of my Rsync for Tasker app.

About

Build script and configuration to cross-compile Dropbear for Android.

License:MIT License


Languages

Language:Ruby 71.0%Language:Shell 22.8%Language:C 6.3%