➜ ~ t=`mktemp -d -t adb-channel.XXXXXX | tee /dev/tty`
/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.VvAB3N
➜ ~ adb shell am start -W com.arachnoid.sshelper/.SSHelperActivity
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }
Status: ok
Activity: com.arachnoid.sshelper/.SSHelperActivity
ThisTime: 1083
TotalTime: 1083
WaitTime: 1123
Complete
➜ ~ adb forward localfilesystem:"${t}/sock" "tcp:2222"
➜ ~ socat -d -d -d -d stdio unix:"${t}/sock"
2017/04/09 23:18:30 socat[42517] D getpid()
2017/04/09 23:18:30 socat[42517] D getpid() -> 42517
2017/04/09 23:18:30 socat[42517] D setenv("SOCAT_PID", "42517", 1)
2017/04/09 23:18:30 socat[42517] D setenv() -> 0
2017/04/09 23:18:30 socat[42517] D setenv("SOCAT_PPID", "42517", 1)
2017/04/09 23:18:30 socat[42517] D setenv() -> 0
2017/04/09 23:18:30 socat[42517] I socat by Gerhard Rieger and contributors - see www.dest-unreach.org
2017/04/09 23:18:30 socat[42517] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2017/04/09 23:18:30 socat[42517] I This product includes software written by Tim Hudson ([email protected])
2017/04/09 23:18:30 socat[42517] D socat version 1.7.3.2 on Jan 28 2017 18:25:05
2017/04/09 23:18:30 socat[42517] D setenv("SOCAT_VERSION", "1.7.3.2", 1)
2017/04/09 23:18:30 socat[42517] D setenv() -> 0
2017/04/09 23:18:30 socat[42517] D running on Darwin version Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64, release 16.5.0, machine x86_64
2017/04/09 23:18:30 socat[42517] D argv[0]: "socat"
2017/04/09 23:18:30 socat[42517] D argv[1]: "-d"
2017/04/09 23:18:30 socat[42517] D argv[2]: "-d"
2017/04/09 23:18:30 socat[42517] D argv[3]: "-d"
2017/04/09 23:18:30 socat[42517] D argv[4]: "-d"
2017/04/09 23:18:30 socat[42517] D argv[5]: "stdio"
2017/04/09 23:18:30 socat[42517] D argv[6]: "unix:/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.VvAB3N/sock"
2017/04/09 23:18:30 socat[42517] D sigaction(1, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(2, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(3, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(4, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(6, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(10, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(8, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(11, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D sigaction(15, 0x7fff56113ea8, 0x0)
2017/04/09 23:18:30 socat[42517] D sigaction() -> 0
2017/04/09 23:18:30 socat[42517] D signal(13, 0x1)
2017/04/09 23:18:30 socat[42517] D signal() -> 0x0
2017/04/09 23:18:30 socat[42517] D atexit(0x109aee3da)
2017/04/09 23:18:30 socat[42517] D atexit() -> 0
2017/04/09 23:18:30 socat[42517] D calloc(1, 808)
2017/04/09 23:18:30 socat[42517] D calloc() -> 0x7fad63500400
2017/04/09 23:18:30 socat[42517] D malloc(1024)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad64001000
2017/04/09 23:18:30 socat[42517] D calloc(1, 808)
2017/04/09 23:18:30 socat[42517] D calloc() -> 0x7fad635009a0
2017/04/09 23:18:30 socat[42517] D calloc(1, 808)
2017/04/09 23:18:30 socat[42517] D calloc() -> 0x7fad63500cd0
2017/04/09 23:18:30 socat[42517] D isatty(0)
2017/04/09 23:18:30 socat[42517] D isatty() -> 1
2017/04/09 23:18:30 socat[42517] D tcgetattr(0, 0x7fad63500af8)
2017/04/09 23:18:30 socat[42517] D tcgetattr(, {00006b02,00000003,00004b00,200005cf,04,ff,ff,7f,17,15,12,00,03,1c,1a,19,11,13,16,0f,01,00,14,00}) -> 0
2017/04/09 23:18:30 socat[42517] D isatty(1)
2017/04/09 23:18:30 socat[42517] D isatty() -> 1
2017/04/09 23:18:30 socat[42517] D tcgetattr(1, 0x7fad63500e28)
2017/04/09 23:18:30 socat[42517] D tcgetattr(, {00006b02,00000003,00004b00,200005cf,04,ff,ff,7f,17,15,12,00,03,1c,1a,19,11,13,16,0f,01,00,14,00}) -> 0
2017/04/09 23:18:30 socat[42517] D malloc(128)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad63500730
2017/04/09 23:18:30 socat[42517] D malloc(128)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad635007b0
2017/04/09 23:18:30 socat[42517] N reading from and writing to stdio
2017/04/09 23:18:30 socat[42517] D calloc(1, 808)
2017/04/09 23:18:30 socat[42517] D calloc() -> 0x7fad63501000
2017/04/09 23:18:30 socat[42517] D malloc(1024)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad64001400
2017/04/09 23:18:30 socat[42517] D malloc(128)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad63500890
2017/04/09 23:18:30 socat[42517] D malloc(128)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad63500910
2017/04/09 23:18:30 socat[42517] N opening connection to LEN=74 AF=1 "/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.VvAB3N/sock"
2017/04/09 23:18:30 socat[42517] D socket(1, 1, 0)
2017/04/09 23:18:30 socat[42517] I socket(1, 1, 0) -> 5
2017/04/09 23:18:30 socat[42517] D fcntl(5, 2, 1)
2017/04/09 23:18:30 socat[42517] D fcntl() -> 0
2017/04/09 23:18:30 socat[42517] D connect(5, {1,LEN=74 AF=1 "/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.VvAB3N/sock"}, 74)
2017/04/09 23:18:30 socat[42517] D connect() -> 0
2017/04/09 23:18:30 socat[42517] D getsockname(5, 0x7fff561138f0, 0x7fff5611387c{108})
2017/04/09 23:18:30 socat[42517] D getsockname(, {LEN=16 AF=1 ""}, {16}) -> 0
2017/04/09 23:18:30 socat[42517] N successfully connected from local address LEN=16 AF=1 ""
2017/04/09 23:18:30 socat[42517] I resolved and opened all sock addresses
2017/04/09 23:18:30 socat[42517] D malloc(16385)
2017/04/09 23:18:30 socat[42517] D malloc() -> 0x7fad64001800
2017/04/09 23:18:30 socat[42517] N starting data transfer loop with FDs [0,1] and [5,5]
2017/04/09 23:18:30 socat[42517] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2017/04/09 23:18:30 socat[42517] D select(6, &0x21, &0x22, &0x0, NULL/0.000000)
2017/04/09 23:18:30 socat[42517] D select -> (, 0x0, 0x22, 0x0, NULL/0.000000), 2
2017/04/09 23:18:30 socat[42517] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2017/04/09 23:18:30 socat[42517] D select(6, &0x21, &0x0, &0x0, NULL/0.000000)
2017/04/09 23:18:30 socat[42517] D select -> (, 0x20, 0x0, 0x0, NULL/0.000000), 1
2017/04/09 23:18:30 socat[42517] D read(5, 0x7fad64001800, 8192)
2017/04/09 23:18:30 socat[42517] D read -> 21
2017/04/09 23:18:30 socat[42517] D write(1, 0x7fad64001800, 21)
SSH-2.0-OpenSSH_7.1
2017/04/09 23:18:30 socat[42517] D write -> 21
2017/04/09 23:18:30 socat[42517] I transferred 21 bytes from 5 to 1
2017/04/09 23:18:30 socat[42517] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2017/04/09 23:18:30 socat[42517] D select(6, &0x21, &0x2, &0x0, NULL/0.000000)
2017/04/09 23:18:30 socat[42517] D select -> (, 0x0, 0x2, 0x0, NULL/0.000000), 1
2017/04/09 23:18:30 socat[42517] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2017/04/09 23:18:30 socat[42517] D select(6, &0x21, &0x0, &0x0, NULL/0.000000)
^C2017/04/09 23:21:23 socat[42517] N socat_signal(): handling signal 2
2017/04/09 23:21:23 socat[42517] N exiting on signal 2
2017/04/09 23:21:23 socat[42517] N socat_signal(): finishing signal 2
2017/04/09 23:21:23 socat[42517] N exit(130)
2017/04/09 23:21:23 socat[42517] D starting xioexit()
2017/04/09 23:21:23 socat[42517] D tcsetattr(0, 0, {00006b02,00000003,00004b00,200005cf,04,ff,ff,7f,17,15,12,00,03,1c,1a,19,11,13,16,0f,01,00,14,00})
2017/04/09 23:21:23 socat[42517] D tcsetattr() -> 0
2017/04/09 23:21:23 socat[42517] D tcsetattr(1, 0, {00006b02,00000003,00004b00,200005cf,04,ff,ff,7f,17,15,12,00,03,1c,1a,19,11,13,16,0f,01,00,14,00})
2017/04/09 23:21:23 socat[42517] D tcsetattr() -> 0
2017/04/09 23:21:23 socat[42517] I shutdown(5, 2)
2017/04/09 23:21:23 socat[42517] D shutdown() -> 0
2017/04/09 23:21:23 socat[42517] D finished xioexit()
➜ ~ adb forward --remove-all
➜ ~ rm -rf "${t}"