VanDyke Software Forums

VanDyke Software Forums (
-   Secure Shell (
-   -   support for adb shell terminal (

Jackson1 05-18-2020 08:54 AM

support for adb shell terminal
hi there,

adb stands for Android Debug Bridge
and is a protocol to talk to an android phone in "USB debugging" mode
with "adb shell" you can access the android shell and do all sorts of stuff, it's running SElinux. adb does not require a rooted phone.

I would love to see SecureCRT support this protocol, since the terminal that you get from "adb shell" is really poor and buggy.

a user on a popular forum already patched PuTTY to make this work:

the patch is pretty straight-forward.

- Turn off line discipline in settings
- Use RAW mode to connect to localhost:5037
- Enter "0012transport-usb" (without quotes)
- Enter "0006shell:" (without quotes)

bgagnon 05-18-2020 09:21 AM

Hi Jackson1,

I have created a feature request on your behalf in our product enhancement database to add support for ADB (Android Debug Bridge) shell terminal. Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to and include Feature Request - Forum Thread #14183 in the subject line or use this form from the support page of our website.

bgagnon 05-18-2020 11:30 AM

Hi Jackson1,

Does this workaround succeed?
  • Create a new session with Raw protocol.

  • In the Connection / Logon Actions category, enable Automate Logon.

  • In the Expect/Send window, remove the two existing entries and add one new one:
Expect: {leave this empty}
Send: \p0012transport-usb\p0006shell:\p

Jackson1 05-20-2020 06:23 AM

this is a great idea. thanks alot.
i have been trying to make the Raw connection work for quite a while.
but was unsuccessful.

i ended up even recording all traffic with

my results:
SecureCRT is configured as suggested by Brenda.
the PCAP however shows, that the socket connection to was established (there is a SYN/ACK from 5037)
but nothing else happened after that.
it appears SecureCRT did not even attempt in sending the "Logon Actions"
i tried a bunch of things, also tried to disable "send initial carriage return" - but at no time, did I have a packet in my PCAP that send anything to 5037.

so i tested the same with

adb shell
from my CLI.
recorded a PCAP too. and there you can clearly see how the host and client establish a handshake, adb sends things like

and the adb daemon replies

happy to provide the PCAP files. but your devs can just plugin their android phone and install "adb", available here:

bgagnon 05-20-2020 07:58 AM

Hi Jackson1,

Well, it was worth a shot! :)

bgagnon 05-21-2020 07:09 AM

Hi Jackson1,

My manager came up with an alternate suggestion you can try.
  1. Configure a session with "Raw" protocol.
    --> hostname:
    --> port: 5037
    Suggested session name: ADB

  2. Disable Automate logon in the Connection / Logon Actions category of Session Options.

  3. In the same Logon Actions category, configure the session with a logon script named, for example, "adb_go.txt" (example script below).

  4. Connect to the session named "ADB".
Here's the contents of the logon script (adb_go.txt):

# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True

Jackson1 05-22-2020 12:50 PM

adb shell working with SecureCRT
thanks again brenda.
great idea to use a script.
i have been working on making a script for a while, and finally made it work!! the attached script certainly didn't work for me.

here is what finally worked:

# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True

the MENU_CLEAR_SCREEN_AND_SCROLLBACK isn't really required here.

one more change I did:
While the adb shell does generally work with the "Raw" connection type, the output of a command like "ls -la" will be "scrambled", meaning some lines are out of order and displayed together with another line, missing the new-line etc. I tried a few terminal emulation modes, but that didnt help

what helped: change the connection type from Raw to Telnet!
I had to also enable Force character at a time mode in the Telnet options of the session, otherwise sending the new-line character had some weird behavour.

So finally, it appears to work just fine!

Many thanks again

bgagnon 05-22-2020 01:31 PM

Hi Jackson1,

Thanks for posting of your success! I am glad to hear you were able to resolve the issue. Have a great weekend!

All times are GMT -6. The time now is 03:00 AM.