4

编译了点 Android 的网络命令行工具

 3 years ago
source link: https://blog.lilydjwg.me/2013/4/30/some-networking-command-line-tools-for-android-platform.39085.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

编译了点 Android 的网络命令行工具

本文来自依云's Blog,转载请注明。

在 Android 这个奇怪的平台想弄点 Linux-style 的东西用真不容易。网上现成的东西也比较少,这里有 stunnel、redsocks 和 iptables 等。另外 GAEProxy 里有 redsocks、iptables 和 Python 2.7,在/data/data/org.gaeproxy目录下。但它的 Python 不支持 readline,redsocks 不支持 UDP。

下边是我自己编译的几个工具和其特点(全部没有第三方库依赖):

  • redsocks:取自 git 版本,支持 UDP。其中,支持 UDP 需要search.h头和相关库函数,但是 Android 的 C 库中没有。我使用了 musl 这个 C 库中的相关文件。
  • socat:支持 readline 和 OpenSSL。openssl 这个命令行工具也作为附加文件得到了,但是感觉用处不大。
  • tcpdump:著名的网络抓包工具。没什么特别的。

编译全部使用的是 Android NDK。编译命令基本上类似于:

CC='arm-linux-androideabi-gcc --sysroot=/opt/android-ndk/platforms/android-14/arch-arm' \
./configure --host=arm-linux-androideabi --prefix=/ldata/media/temp/android/installed_binaries

但是不同的软件通常都会需要一些修改。比如上边说到的 redsocks。最无痛编译成功的是 LuaJIT 了,但是我这里没找到什么实际用途。另外记得把生成的可执行文件用arm-linux-androideabi-strip处理下,减小体积。

以上三个工具打包下载请点击这里备用地址)。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK