Git Product home page Git Product logo

Comments (19)

t-oster avatar t-oster commented on April 19, 2024 1

Hi. I am on ArchLinux and #13 is exactly the parameter to fix this for me. So it is not an OSX issue. Maybe it has to do with specific versions of ADB. However with #13 merged it works like a charm.

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

That's odd.

Does adding a "sleep 1" in various places of the script help?

from adb-sync.

CNG avatar CNG commented on April 19, 2024

@divVerent I couldn't get any different result. But can you enlighten me about my question regarding the login name and key? Following the basic directions on the readme, my computer would be trying to do an ssh login using my macOS username. I tried various things like the SSHelper app's name com.arachnoid.sshelper or the result of whoami upon login with adb shell, which was just the name shell. Wouldn't I also need to get the SSH key into the appropriate place for that user? I thought some hangup there was causing it to silently fail.

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

from adb-sync.

CNG avatar CNG commented on April 19, 2024

Since running the commands in adb-channel manually seems to work, I assumed the problem was with SSH and ProxyCommand. I am not sure how to log in (and ultimately run rsync) using just adb-channel but not in the context of ProxyCommand. I don't think I can somehow specify the local socket like I can a port?

For example, if I modify adb-channel to skip the socket creation and only do the following:

adb shell am start -W com.arachnoid.sshelper/.SSHelperActivity
adb forward tcp:2224 tcp:2222
sleep 100

I am then able to in a separate tab log in via ssh -p2224 localhost and I get this prompt (Apparently you're right the username doesn't matter.):

u0_a58@angler:/data/data/com.arachnoid.sshelper/home $

I don't fully understand the merits of the socket versus port, or how to properly use this with ProxyCommand even if using two ports is fine. The script simply exits after the sleep since I commented out the socat that normally kept running. Add an infinite loop and rely on the trap exit?

Here is the output of the verbose SSH command using the unmodified adb-connect and suggested ssh config:

➜  ~ ssh -v -v -v sshhelper
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: /Users/cgorichanaz/.ssh/config line 8: Applying options for sshhelper
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec adb-channel tcp:2222 com.arachnoid.sshelper/.SSHelperActivity 3
debug1: permanently_drop_suid: 501
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.zpfvgW
debug1: ssh_exchange_identification: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }

debug1: ssh_exchange_identification: Status: ok

debug1: ssh_exchange_identification: Activity: com.arachnoid.sshelper/.SSHelperActivity

debug1: ssh_exchange_identification: ThisTime: 1575

debug1: ssh_exchange_identification: TotalTime: 9977

debug1: ssh_exchange_identification: WaitTime: 1582

debug1: ssh_exchange_identification: Complete

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to sshhelper:2222 as 'cgorichanaz'
debug3: put_host_port: [sshhelper]:2222
debug3: hostkeys_foreach: reading file "/Users/cgorichanaz/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Bad packet length 1349676916.
debug3: send packet: type 1
ssh_dispatch_run_fatal: Connection to UNKNOWN port 65535: message authentication code incorrect

When I just run the adb-channel command, the last output is SSH-2.0-OpenSSH_7.1 and it does not return to a prompt:

➜  ~ adb-channel tcp:2222 com.arachnoid.sshelper/.SSHelperActivity 1
/var/folders/jk/3fltf9vx0n15p2qhkpjx2zk80000gn/T/adb-channel.a49eV8
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: 1611
TotalTime: 26374
WaitTime: 1621
Complete
SSH-2.0-OpenSSH_7.1

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

from adb-sync.

CNG avatar CNG commented on April 19, 2024

I appreciate your prompt help, so I'm posting this first before trying to understand better... I am a little unclear on what you're asking me to try. Running ssh ... sshelper would trigger my config that runs the existing ProxyCommand that uses my modified adb-channel... that didn't seem right. So maybe you just meant for me to first run adb forward tcp:2224 tcp:2222 and then your suggested ssh command? But maybe you meant localhost at the end instead of sshelper?

➜  ~ adb forward tcp:2224 tcp:2222
➜  ~ ssh -oProxyCommand='socat stdio tcp:connect:localhost:2224/' localhost
2017/04/11 15:50:12 socat[18725] E tcp: wrong number of parameters (3 instead of 2)
ssh_exchange_identification: Connection closed by remote host
➜  ~ ssh -oProxyCommand='socat stdio tcp:connect:localhost:2224/' sshelper
2017/04/11 15:50:30 socat[18995] E tcp: wrong number of parameters (3 instead of 2)
ssh_exchange_identification: Connection closed by remote host
➜  ~ adb forward --list
8XV7N15A28005026 tcp:2224 tcp:2222

➜  ~ ssh -v -v -v -oProxyCommand='socat stdio tcp:connect:localhost:2224/' localhost
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec socat stdio tcp:connect:localhost:2224/
debug1: permanently_drop_suid: 501
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
2017/04/11 15:52:36 socat[19290] E tcp: wrong number of parameters (3 instead of 2)
ssh_exchange_identification: Connection closed by remote host

from adb-sync.

CNG avatar CNG commented on April 19, 2024

The SSH command worked when I removed :connect and removed a previous fingerprint. One minute.

from adb-sync.

CNG avatar CNG commented on April 19, 2024
➜  ~ ssh -v -v -v -oProxyCommand='socat stdio tcp:localhost:2224/' localhost
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec socat stdio tcp:localhost:2224/
debug1: permanently_drop_suid: 501
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to localhost:22 as 'cgorichanaz'
debug3: hostkeys_foreach: reading file "/Users/cgorichanaz/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,ecdsa-sha2-nistp256
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:9Rrd0We/FWxFyUj7qZ9FXEbH+MCKQbCINey9ZUvfEaQ
debug3: hostkeys_foreach: reading file "/Users/cgorichanaz/.ssh/known_hosts"
The authenticity of host 'localhost (<no hostip for proxy command>)' can't be established.
ECDSA key fingerprint is SHA256:9Rrd0We/FWxFyUj7qZ9FXEbH+MCKQbCINey9ZUvfEaQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /Users/cgorichanaz/.ssh/cng1408 (0x7fa92aa00d20), explicit
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 53
debug3: input_userauth_banner
SSHelper Version 8.5 Copyright 2014, P. Lutus
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over, passed a different list publickey,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/cgorichanaz/.ssh/cng1408
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg ssh-rsa blen 1047
debug2: input_userauth_pk_ok: fp SHA256:ZrFRZT0JH/v70HI4RdT63Rl6uPf5jX/UOiMBOkHQPXw
debug3: sign_and_send_pubkey: RSA SHA256:ZrFRZT0JH/v70HI4RdT63Rl6uPf5jX/UOiMBOkHQPXw
debug3: Search for item with query: {
    acct = "/Users/cgorichanaz/.ssh/cng1408";
    agrp = "com.apple.ssh.passphrases";
    class = genp;
    labl = "SSH: /Users/cgorichanaz/.ssh/cng1408";
    nleg = 1;
    "r_Data" = 1;
    svce = OpenSSH;
}
debug2: using passphrase from keychain
debug3: no authentication agent, not adding key
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to localhost (via proxy).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: proc
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 91
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Environment:
  USER=u0_a58
  LOGNAME=u0_a58
  HOME=/data/data/com.arachnoid.sshelper/home
  PATH=/su/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/su/xbin:/system/xbin:/data/user/0/com.arachnoid.sshelper/bin
  MAIL=/var/mail/u0_a58
  SHELL=/system/bin/sh
  SSH_CLIENT=127.0.0.1 40367 2222
  SSH_CONNECTION=127.0.0.1 40367 127.0.0.1 2222
  SSH_TTY=/dev/pts/0
  TERM=xterm-256color
  ANDROID_ASSETS=/system/app
  ANDROID_BOOTLOGO=1
  ANDROID_DATA=/data
  ANDROID_ROOT=/system
  ANDROID_SOCKET_zygote=9
  ANDROID_STORAGE=/storage
  ASEC_MOUNTPOINT=/mnt/asec
  BOARD=angler
  BOOTCLASSPATH=/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycast
  DOWNLOAD_CACHE=/data/cache
  ENV=/data/user/0/com.arachnoid.sshelper/home/.profile
  EXTERNAL_STORAGE=/sdcard
  OSDATA=Nexus_6P:3.10.73-g4cd47b6
  SSHELPER=/data/user/0/com.arachnoid.sshelper
  SYSTEMSERVERCLASSPATH=/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar
  TZ=GMT8
Nexus_6P:3.10.73-g4cd47b6
u0_a58@angler:/data/data/com.arachnoid.sshelper/home $

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

from adb-sync.

CNG avatar CNG commented on April 19, 2024

All right, thank you!

from adb-sync.

CNG avatar CNG commented on April 19, 2024

I'm not sure if it helps, but I was trying to understand better what the difference was between the failed connection over the socket and the successful one over TCP port. My understanding of socat, etc., is still very limited, but I was at least able to determine Android is sending a "Protocol mismatch" message right before that "Bad packet length" error.

2017/04/12 13:19:32 socat[93280] I transferred 19 bytes from 5 to 1
2017/04/12 13:19:32 socat[93280] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
2017/04/12 13:19:32 socat[93280] D select(6, &0x21, &0x2, &0x0, NULL/0.000000)
2017/04/12 13:19:32 socat[93280] D select -> (, 0x0, 0x2, 0x0, NULL/0.000000), 1
2017/04/12 13:19:32 socat[93280] D data loop: sock1->eof=0, sock2->eof=0, closing=0, wasaction=1, total_to={0.000000}
Bad packet length 1349676916.

I was trying to see if there was some setting for socat that would help and looked at what calls adb was using to set up the socket, but it's all still over my head!

from adb-sync.

divVerent avatar divVerent commented on April 19, 2024

I pushed a change to a new branch "adb-channel-tcp" that adds an environment variable to force operation over TCP.

So try this:

$ git pull
$ git checkout adb-channel-tcp
$ EXPERIMENTAL_ADB_CHANNEL_TCP_PORT=2224 ssh sshelper

Does this fix the problem, compared to:

$ ssh sshelper

If so, that'd be an odd case of data corruption - your dump does not show any obvious signs of it though. It'd probably help to know what Android is seeing on its side - this will be hard to find out with SSHelper, though.

from adb-sync.

CNG avatar CNG commented on April 19, 2024

Sorry for delay, just FYI I won't be able to test till Friday. (Frustrations with hackintosh drove me to reformat.) Thank you!

from adb-sync.

CNG avatar CNG commented on April 19, 2024

Still no luck.

Starting from scratch on a new macOS 10.12.4 system, I authorized the computer on the Android screen and then tried connecting with and without the change, and with the suggested same port (%p) and a manual tcp:2224.

~/.ssh/config

Host *
    UseKeychain yes
    ServerAliveInterval 300
    ServerAliveCountMax 2
    IdentityFile ~/.ssh/cng1408

Host sshelper
  Port 2222
  ProxyCommand adb-channel tcp:%p com.arachnoid.sshelper/.SSHelperActivity 1

Results using tcp:%p

master:

$ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
$ sudo cp adb-sync adb-channel /usr/local/bin/
$ ssh -v -v -v sshelper
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: /Users/cgorichanaz/.ssh/config line 7: Applying options for sshelper
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec adb-channel tcp:2222 com.arachnoid.sshelper/.SSHelperActivity 1
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: permanently_drop_suid: 501
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: ssh_exchange_identification: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }

debug1: ssh_exchange_identification: Warning: Activity not started, its current task has been brought to the front

debug1: ssh_exchange_identification: Status: ok

debug1: ssh_exchange_identification: Activity: com.arachnoid.sshelper/.SSHelperActivity

debug1: ssh_exchange_identification: ThisTime: 0

debug1: ssh_exchange_identification: TotalTime: 0

debug1: ssh_exchange_identification: WaitTime: 4

debug1: ssh_exchange_identification: Complete

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to sshelper:2222 as 'cgorichanaz'
debug3: put_host_port: [sshelper]:2222
debug3: hostkeys_foreach: reading file "/Users/cgorichanaz/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Bad packet length 1349676916.
debug3: send packet: type 1
ssh_dispatch_run_fatal: Connection to UNKNOWN port 65535: message authentication code incorrect

Android SSHelper:

2017-04-22 01:43:03 execCom:executing: "/system/bin/id"
2017-04-22 01:43:03 execCom::stdout result: uid=10058(u0_a58) gid=10058(u0_a58) groups=10058(u0_a58),3002(net_bt),3003(inet),9997(everybody),50058(all_a58) context=u:r:untrusted_app:s0:c512,c768
2017-04-22 01:43:03 execCom::exit value: true
2017-04-22 01:43:03 generateNewKey:Check: dsa key is present.
2017-04-22 01:43:03 generateNewKey:Check: rsa key is present.
2017-04-22 01:43:03 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:43:03 execCom:executing: "bin/pidof","sshelper_sshd","ssh"
2017-04-22 01:43:03 execCom::exit value: false
2017-04-22 01:43:03 LogServer: restarting server on port: 8080
2017-04-22 01:43:03 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:04 LogServer: restarting server on port: 8080
2017-04-22 01:43:04 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:04 generateNewKey:Check: dsa key is present.
2017-04-22 01:43:04 generateNewKey:Check: rsa key is present.
2017-04-22 01:43:04 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:43:04 Starting/restarting SSH server on port 2222
2017-04-22 01:43:04 sshd::*** Warning: This is a special debug mode set by "select data
2017-04-22 01:43:04 sshd::***          logging mode", only one login allowed before restart.
2017-04-22 01:43:04 sshd::***          To end this special mode, make a logging selection
2017-04-22 01:43:04 sshd::***          outside the "SSH Server Debug 1-3" region.
2017-04-22 01:43:04 sshd: debug2: load_server_config: filename /data/user/0/com.arachnoid.sshelper/etc/sshd_config
2017-04-22 01:43:04 sshd: debug2: load_server_config: done config len = 698
2017-04-22 01:43:04 sshd: debug2: parse_server_config: config /data/user/0/com.arachnoid.sshelper/etc/sshd_config len 698
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:24 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_rsa
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:25 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_dsa
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:26 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_ecdsa
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:32 setting PubkeyAcceptedKeyTypes +ssh-dss
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:112 setting PrintLastLog no
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:115 setting UsePrivilegeSeparation no
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:116 setting PermitUserEnvironment yes
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:117 setting Compression yes
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:118 setting ClientAliveInterval 300
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:119 setting ClientAliveCountMax 5
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:120 setting UseDNS no
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:131 setting Subsystem sftp internal-sftp
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:134 setting AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:135 setting AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
2017-04-22 01:43:04 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:136 setting AcceptEnv LC_IDENTIFICATION LC_ALL
2017-04-22 01:43:04 sshd: debug1: sshd version OpenSSH_7.1, OpenSSL 1.0.2g  1 Mar 2016
2017-04-22 01:43:04 sshd: debug1: private host key #0: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:43:04 sshd: debug1: private host key #1: ssh-rsa SHA256:gESumGl+BL+0P7y7IXBDTnOOk634N76bHnjv/yI+E6k
2017-04-22 01:43:04 sshd: debug1: private host key #2: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:43:04 sshd: debug1: private host key #3: ecdsa-sha2-nistp256 SHA256:9Rrd0We/FWxFyUj7qZ9FXEbH+MCKQbCINey9ZUvfEaQ
2017-04-22 01:43:04 sshd: debug1: setgroups() failed: Operation not permitted
2017-04-22 01:43:04 sshd: debug1: rexec_argv[0]='/data/user/0/com.arachnoid.sshelper/bin/sshelper_sshd'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[1]='-D'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[2]='-p'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[3]='2222'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[4]='-h'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[5]='/data/user/0/com.arachnoid.sshelper/home/.ssh/id_dsa'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[6]='-o PidFile /data/user/0/com.arachnoid.sshelper/etc/sshd.pid'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[7]='-f'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[8]='/data/user/0/com.arachnoid.sshelper/etc/sshd_config'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[9]='-ddd'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[10]='-e'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[11]='-o PasswordAuthentication no'
2017-04-22 01:43:04 LogServer: restarting server on port: 8080
2017-04-22 01:43:04 sshd: debug1: rexec_argv[12]='-o PermitTunnel yes'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[13]='-o StrictModes yes'
2017-04-22 01:43:04 sshd: debug1: rexec_argv[14]='-o Banner /data/user/0/com.arachnoid.sshelper/etc/banner2.txt'
2017-04-22 01:43:04 sshd: debug2: fd 3 setting O_NONBLOCK
2017-04-22 01:43:04 sshd: debug1: Bind to port 2222 on 0.0.0.0.
2017-04-22 01:43:04 sshd: Server listening on 0.0.0.0 port 2222.
2017-04-22 01:43:04 sshd: debug2: fd 4 setting O_NONBLOCK
2017-04-22 01:43:04 sshd: debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
2017-04-22 01:43:04 sshd: debug1: Bind to port 2222 on ::.
2017-04-22 01:43:04 sshd: Server listening on :: port 2222.
2017-04-22 01:43:04 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:04 LogServer: restarting server on port: 8080
2017-04-22 01:43:04 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:11 JmDNS Zeroconf:register service: _workstation._tcp.local
2017-04-22 01:43:14 JmDNS Zeroconf:register service: _sftp-ssh._tcp.local.

adb-channel-tcp:

$ git checkout adb-channel-tcp
Switched to branch 'adb-channel-tcp'
Your branch is up-to-date with 'origin/adb-channel-tcp'.
$ sudo cp adb-sync adb-channel /usr/local/bin/
$ EXPERIMENTAL_ADB_CHANNEL_TCP_PORT=2222 ssh -v -v -v sshelper

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: /Users/cgorichanaz/.ssh/config line 7: Applying options for sshelper
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec adb-channel tcp:2222 com.arachnoid.sshelper/.SSHelperActivity 1
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: permanently_drop_suid: 501
WARNING: this ADB channel is open to everyone on this computer.
debug1: ssh_exchange_identification: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }

debug1: ssh_exchange_identification: Warning: Activity not started, its current task has been brought to the front

debug1: ssh_exchange_identification: Status: ok

debug1: ssh_exchange_identification: Activity: com.arachnoid.sshelper/.SSHelperActivity

debug1: ssh_exchange_identification: ThisTime: 579

debug1: ssh_exchange_identification: TotalTime: 579

debug1: ssh_exchange_identification: WaitTime: 607

debug1: ssh_exchange_identification: Complete

debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to sshelper:2222 as 'cgorichanaz'
debug3: put_host_port: [sshelper]:2222
debug3: hostkeys_foreach: reading file "/Users/cgorichanaz/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
Bad packet length 1349676916.
debug3: send packet: type 1
ssh_dispatch_run_fatal: Connection to UNKNOWN port 65535: message authentication code incorrect

Android SSHelper:

2017-04-22 01:43:16 LogServer: restarting server on port: 8080
2017-04-22 01:43:16 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:16 JmDNS Zeroconf:register service: _ssh._tcp.local.
2017-04-22 01:43:16 LogServer: restarting server on port: 8080
2017-04-22 01:43:16 ClipboardServer: restarting server on port: 8081
2017-04-22 01:43:19 JmDNS Zeroconf:register service: _rsync._tcp.local.
2017-04-22 01:43:22 JmDNS Zeroconf:register service: _http._tcp.local.
2017-04-22 01:44:36 LogServer: restarting server on port: 8080
2017-04-22 01:44:36 ClipboardServer: restarting server on port: 8081
2017-04-22 01:44:36 LogServer: restarting server on port: 8080
2017-04-22 01:44:36 ClipboardServer: restarting server on port: 8081
2017-04-22 01:44:37 sshd: debug3: fd 5 is not O_NONBLOCK
2017-04-22 01:44:37 sshd: debug1: Server will not fork when running in debugging mode.
2017-04-22 01:44:37 sshd: debug3: send_rexec_state: entering fd = 8 config len 698
2017-04-22 01:44:37 sshd: debug3: ssh_msg_send: type 0
2017-04-22 01:44:37 sshd: debug3: send_rexec_state: done
2017-04-22 01:44:37 sshd: debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
2017-04-22 01:44:37 sshd: debug3: recv_rexec_state: entering fd = 5
2017-04-22 01:44:37 sshd: debug3: ssh_msg_recv entering
2017-04-22 01:44:37 sshd: debug3: recv_rexec_state: done
2017-04-22 01:44:37 sshd: debug2: parse_server_config: config rexec len 698
2017-04-22 01:44:37 sshd: debug3: rexec:24 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_rsa
2017-04-22 01:44:37 sshd: debug3: rexec:25 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_dsa
2017-04-22 01:44:37 sshd: debug3: rexec:26 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_ecdsa
2017-04-22 01:44:37 sshd: debug3: rexec:32 setting PubkeyAcceptedKeyTypes +ssh-dss
2017-04-22 01:44:37 sshd: debug3: rexec:112 setting PrintLastLog no
2017-04-22 01:44:37 sshd: debug3: rexec:115 setting UsePrivilegeSeparation no
2017-04-22 01:44:37 sshd: debug3: rexec:116 setting PermitUserEnvironment yes
2017-04-22 01:44:37 sshd: debug3: rexec:117 setting Compression yes
2017-04-22 01:44:37 sshd: debug3: rexec:118 setting ClientAliveInterval 300
2017-04-22 01:44:37 sshd: debug3: rexec:119 setting ClientAliveCountMax 5
2017-04-22 01:44:37 sshd: debug3: rexec:120 setting UseDNS no
2017-04-22 01:44:37 sshd: debug3: rexec:131 setting Subsystem sftp internal-sftp
2017-04-22 01:44:37 sshd: debug3: rexec:134 setting AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
2017-04-22 01:44:37 sshd: debug3: rexec:135 setting AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
2017-04-22 01:44:37 sshd: debug3: rexec:136 setting AcceptEnv LC_IDENTIFICATION LC_ALL
2017-04-22 01:44:37 sshd: debug1: sshd version OpenSSH_7.1, OpenSSL 1.0.2g  1 Mar 2016
2017-04-22 01:44:37 sshd: debug1: private host key #0: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:44:37 sshd: debug1: private host key #1: ssh-rsa SHA256:gESumGl+BL+0P7y7IXBDTnOOk634N76bHnjv/yI+E6k
2017-04-22 01:44:37 sshd: debug1: private host key #2: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:44:37 sshd: debug1: private host key #3: ecdsa-sha2-nistp256 SHA256:9Rrd0We/FWxFyUj7qZ9FXEbH+MCKQbCINey9ZUvfEaQ
2017-04-22 01:44:37 sshd: debug1: setgroups() failed: Operation not permitted
2017-04-22 01:44:37 sshd: debug1: inetd sockets after dupping: 3, 3
2017-04-22 01:44:37 sshd: Connection from 127.0.0.1 port 37353 on 127.0.0.1 port 2222
2017-04-22 01:44:37 sshd: Bad protocol version identification '' from 127.0.0.1 port 37353

tcp:2224

~/.ssh/config:

Host *
    UseKeychain yes
    ServerAliveInterval 300
    ServerAliveCountMax 2
    IdentityFile ~/.ssh/cng1408

Host sshelper
  Port 2222
  ProxyCommand adb-channel tcp:2224 com.arachnoid.sshelper/.SSHelperActivity 1

master:

$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ sudo cp adb-sync adb-channel /usr/local/bin/
$ ssh -v -v -v sshelper
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: /Users/cgorichanaz/.ssh/config line 7: Applying options for sshelper
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec adb-channel tcp:2224 com.arachnoid.sshelper/.SSHelperActivity 1
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: permanently_drop_suid: 501
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: ssh_exchange_identification: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }

debug1: ssh_exchange_identification: Warning: Activity not started, its current task has been brought to the front

debug1: ssh_exchange_identification: Status: ok

debug1: ssh_exchange_identification: Activity: com.arachnoid.sshelper/.SSHelperActivity



debug1: ssh_exchange_identification: ThisTime: 0

debug1: ssh_exchange_identification: TotalTime: 0

debug1: ssh_exchange_identification: WaitTime: 3

debug1: ssh_exchange_identification: Complete

ssh_exchange_identification: Connection closed by remote host

Android SSHelper:

2017-04-22 01:46:18 execCom:executing: "/system/bin/id"
2017-04-22 01:46:18 execCom::stdout result: uid=10058(u0_a58) gid=10058(u0_a58) groups=10058(u0_a58),3002(net_bt),3003(inet),9997(everybody),50058(all_a58) context=u:r:untrusted_app:s0:c512,c768
2017-04-22 01:46:18 execCom::exit value: true
2017-04-22 01:46:18 generateNewKey:Check: dsa key is present.
2017-04-22 01:46:18 generateNewKey:Check: rsa key is present.
2017-04-22 01:46:18 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:46:18 execCom:executing: "bin/pidof","sshelper_sshd","ssh"
2017-04-22 01:46:18 execCom::exit value: false
2017-04-22 01:46:18 LogServer: restarting server on port: 8080
2017-04-22 01:46:18 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:18 LogServer: restarting server on port: 8080
2017-04-22 01:46:18 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:18 generateNewKey:Check: dsa key is present.
2017-04-22 01:46:18 generateNewKey:Check: rsa key is present.
2017-04-22 01:46:18 generateNewKey:Check: ecdsa key is present.
2017-04-22 01:46:18 Starting/restarting SSH server on port 2222
2017-04-22 01:46:18 sshd::*** Warning: This is a special debug mode set by "select data
2017-04-22 01:46:18 sshd::***          logging mode", only one login allowed before restart.
2017-04-22 01:46:18 sshd::***          To end this special mode, make a logging selection
2017-04-22 01:46:18 sshd::***          outside the "SSH Server Debug 1-3" region.
2017-04-22 01:46:18 sshd: debug2: load_server_config: filename /data/user/0/com.arachnoid.sshelper/etc/sshd_config
2017-04-22 01:46:18 sshd: debug2: load_server_config: done config len = 698
2017-04-22 01:46:18 sshd: debug2: parse_server_config: config /data/user/0/com.arachnoid.sshelper/etc/sshd_config len 698
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:24 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_rsa
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:25 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_dsa
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:26 setting HostKey /data/data/com.arachnoid.sshelper/home/.ssh/id_ecdsa
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:32 setting PubkeyAcceptedKeyTypes +ssh-dss
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:112 setting PrintLastLog no
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:115 setting UsePrivilegeSeparation no
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:116 setting PermitUserEnvironment yes
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:117 setting Compression yes
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:118 setting ClientAliveInterval 300
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:119 setting ClientAliveCountMax 5
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:120 setting UseDNS no
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:131 setting Subsystem sftp internal-sftp
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:134 setting AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:135 setting AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
2017-04-22 01:46:18 sshd: debug3: /data/user/0/com.arachnoid.sshelper/etc/sshd_config:136 setting AcceptEnv LC_IDENTIFICATION LC_ALL
2017-04-22 01:46:18 sshd: debug1: sshd version OpenSSH_7.1, OpenSSL 1.0.2g  1 Mar 2016
2017-04-22 01:46:18 sshd: debug1: private host key #0: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:46:18 sshd: debug1: private host key #1: ssh-rsa SHA256:gESumGl+BL+0P7y7IXBDTnOOk634N76bHnjv/yI+E6k
2017-04-22 01:46:18 sshd: debug1: private host key #2: ssh-dss SHA256:JBC6t8tcBcgs6/CIHxGVS+tARoHbvKbO0vYqDst1azc
2017-04-22 01:46:18 sshd: debug1: private host key #3: ecdsa-sha2-nistp256 SHA256:9Rrd0We/FWxFyUj7qZ9FXEbH+MCKQbCINey9ZUvfEaQ
2017-04-22 01:46:18 sshd: debug1: setgroups() failed: Operation not permitted
2017-04-22 01:46:18 sshd: debug1: rexec_argv[0]='/data/user/0/com.arachnoid.sshelper/bin/sshelper_sshd'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[1]='-D'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[2]='-p'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[3]='2222'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[4]='-h'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[5]='/data/user/0/com.arachnoid.sshelper/home/.ssh/id_dsa'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[6]='-o PidFile /data/user/0/com.arachnoid.sshelper/etc/sshd.pid'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[7]='-f'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[8]='/data/user/0/com.arachnoid.sshelper/etc/sshd_config'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[9]='-ddd'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[10]='-e'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[11]='-o PasswordAuthentication no'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[12]='-o PermitTunnel yes'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[13]='-o StrictModes yes'
2017-04-22 01:46:18 sshd: debug1: rexec_argv[14]='-o Banner /data/user/0/com.arachnoid.sshelper/etc/banner2.txt'
2017-04-22 01:46:18 sshd: debug2: fd 3 setting O_NONBLOCK
2017-04-22 01:46:18 sshd: debug1: Bind to port 2222 on 0.0.0.0.
2017-04-22 01:46:18 sshd: Server listening on 0.0.0.0 port 2222.
2017-04-22 01:46:18 sshd: debug2: fd 4 setting O_NONBLOCK
2017-04-22 01:46:18 sshd: debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY
2017-04-22 01:46:18 sshd: debug1: Bind to port 2222 on ::.
2017-04-22 01:46:18 sshd: Server listening on :: port 2222.
2017-04-22 01:46:18 LogServer: restarting server on port: 8080
2017-04-22 01:46:18 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:18 LogServer: restarting server on port: 8080
2017-04-22 01:46:18 ClipboardServer: restarting server on port: 8081

adb-channel-tcp:

$ git checkout adb-channel-tcp
Switched to branch 'adb-channel-tcp'
Your branch is up-to-date with 'origin/adb-channel-tcp'.
$ sudo cp adb-sync adb-channel /usr/local/bin/
$ EXPERIMENTAL_ADB_CHANNEL_TCP_PORT=2224 ssh -v -v -v sshelper

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/cgorichanaz/.ssh/config
debug1: /Users/cgorichanaz/.ssh/config line 1: Applying options for *
debug1: /Users/cgorichanaz/.ssh/config line 7: Applying options for sshelper
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec adb-channel tcp:2224 com.arachnoid.sshelper/.SSHelperActivity 1
debug1: identity file /Users/cgorichanaz/.ssh/cng1408 type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/cgorichanaz/.ssh/cng1408-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: permanently_drop_suid: 501
WARNING: this ADB channel is open to everyone on this computer.
debug1: ssh_exchange_identification: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.arachnoid.sshelper/.SSHelperActivity }

debug1: ssh_exchange_identification: Warning: Activity not started, its current task has been brought to the front

debug1: ssh_exchange_identification: Status: ok

debug1: ssh_exchange_identification: Activity: com.arachnoid.sshelper/.SSHelperActivity

debug1: ssh_exchange_identification: ThisTime: 0

debug1: ssh_exchange_identification: TotalTime: 0

debug1: ssh_exchange_identification: WaitTime: 4

debug1: ssh_exchange_identification: Complete

ssh_exchange_identification: Connection closed by remote host

Android SSHelper:

2017-04-22 01:46:25 LogServer: restarting server on port: 8080
2017-04-22 01:46:25 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:25 LogServer: restarting server on port: 8080
2017-04-22 01:46:25 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:25 JmDNS Zeroconf:register service: _workstation._tcp.local
2017-04-22 01:46:28 JmDNS Zeroconf:register service: _sftp-ssh._tcp.local.
2017-04-22 01:46:31 JmDNS Zeroconf:register service: _ssh._tcp.local.
2017-04-22 01:46:33 JmDNS Zeroconf:register service: _rsync._tcp.local.
2017-04-22 01:46:34 LogServer: restarting server on port: 8080
2017-04-22 01:46:34 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:34 LogServer: restarting server on port: 8080
2017-04-22 01:46:34 ClipboardServer: restarting server on port: 8081
2017-04-22 01:46:36 JmDNS Zeroconf:register service: _http._tcp.local.
2017-04-22 01:47:16 LogServer: restarting server on port: 8080
2017-04-22 01:47:16 ClipboardServer: restarting server on port: 8081
2017-04-22 01:47:17 LogServer: restarting server on port: 8080
2017-04-22 01:47:17 ClipboardServer: restarting server on port: 8081

from adb-sync.

CNG avatar CNG commented on April 19, 2024

I'll need to review the code and retrace this tomorrow, but in case you're faster than me, my results are above. I modified the above comment so as to keep only the relevant info but preserve the first just in case. Please see the web page in case it doesn't email the modification.

from adb-sync.

CNG avatar CNG commented on April 19, 2024

This actually works fine on the socket when I manually run the commands. The problem seems to lie in ProxyCommand?

This works:

t=`mktemp -d -t adb-channel.XXXXXX`
adb forward --remove-all; adb shell am start -W com.arachnoid.sshelper/.SSHelperActivity; sleep 3; adb forward localfilesystem:${t}/sock tcp:2222;
ssh -v -v -v -oProxyCommand="sh -c 'socat stdio unix:${t}/sock'" localhost

This fails:

t=`mktemp -d -t adb-channel.XXXXXX`
ssh -v -v -v -oProxyCommand="sh -c 'adb forward --remove-all; adb shell am start -W com.arachnoid.sshelper/.SSHelperActivity; sleep 3; adb forward localfilesystem:${t}/sock tcp:2222; socat stdio unix:${t}/sock'" localhost

from adb-sync.

CNG avatar CNG commented on April 19, 2024

OK, the problem was with adb shell interfering with stdin. I was able to resolve the issue by using the flag -n, in #13

I did not think it was necessary to branch by operating system, but it would be good to confirm this still works as expected in Linux (and I would be interested to know if it really worked there without this change!).

from adb-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.