Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Secure Shell

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2020, 08:54 AM
Jackson1 Jackson1 is offline
Registered User
 
Join Date: Nov 2017
Posts: 13
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:
https://forum.xda-developers.com/sho...d.php?t=803225

the patch is pretty straight-forward.
Code:
- Turn off line discipline in settings
- Use RAW mode to connect to localhost:5037
- Enter "0012transport-usb" (without quotes)
- Enter "0006shell:" (without quotes)
Reply With Quote
  #2  
Old 05-18-2020, 09:21 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
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 support@vandyke.com and include Feature Request - Forum Thread #14183 in the subject line or use this form from the support page of our website.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-18-2020, 11:30 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
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
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 05-20-2020, 06:23 AM
Jackson1 Jackson1 is offline
Registered User
 
Join Date: Nov 2017
Posts: 13
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 127.0.0.1 traffic with
Code:
RawCap.exe 127.0.0.1
my results:
SecureCRT is configured as suggested by Brenda.
the PCAP however shows, that the socket connection to 127.0.0.1:5037 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
Code:
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
Code:
000chost:version
and the adb daemon replies
Code:
0004OKAY
happy to provide the PCAP files. but your devs can just plugin their android phone and install "adb", available here: https://developer.android.com/studio...platform-tools
Reply With Quote
  #5  
Old 05-20-2020, 07:58 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hi Jackson1,

Well, it was worth a shot!
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 05-21-2020 at 07:09 AM.
Reply With Quote
  #6  
Old 05-21-2020, 07:09 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hi Jackson1,

My manager came up with an alternate suggestion you can try.
  1. Configure a session with "Raw" protocol.
    --> hostname: 127.0.0.1
    --> 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):
Code:
# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True
crt.Screen.Send("000ehost:tport:any")
crt.Screen.WaitForString("OKAY")
crt.Screen.WaitForString("\002")
crt.Screen.Send("0021shell,v2.TERM=xterm-256color,pty:")
crt.Screen.WaitForString("OKAY")
crt.Screen.SendSpecial("MENU_CLEAR_SCREEN_AND_SCROLLBACK")
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 05-22-2020, 12:50 PM
Jackson1 Jackson1 is offline
Registered User
 
Join Date: Nov 2017
Posts: 13
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:
Code:
# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True
crt.Screen.Send("0012host:transport-usb")
crt.Screen.WaitForString("OKAY")
crt.Screen.Send("0006shell:")
crt.Screen.WaitForString("OKAY")
crt.Screen.SendSpecial("MENU_CLEAR_SCREEN_AND_SCROLLBACK")
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
Reply With Quote
  #8  
Old 05-22-2020, 01:31 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hi Jackson1,

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

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 04:29 PM.