HELP: Linux ansi terminal capabilities on WinXP through adb - Epic 4G General

I'm a Linux/UNIX hack, so I play around a lot with shell scripts on my Epic, as well as just doing many things from ConnectBot and adb.
Everything's great from ConnectBot -- the emulator supports ANSI escape sequences, so it works perfectly with vi, command-line editing, etc. Great on the go!
However, I'd like to do the same thing when connect via 'adb shell' from my PC, and that's where it all goes to crap. The DOS command prompt window doesn't seem to support ANSI, window size is not passed through adb, so vi is unusable. Oddly, command-line editing seems to work. Also, I seem to be getting every command echoed, creating a spurious line.
Bottom line: I want to adb a local shell on my Epic from my PC and be able to use it the same way as I do on the phone itself via connectbot, yet with the obvious advantage of a big screen and normal keyboard. Anyone have any solution to this?
Thanks!!

QuickSSHd with PuTTy would probably get you what you're looking for, with the added benefit of being wireless.

I'm not sure where the limitation lies, but cygwin + adb might work.

Setup adb to use telnet and forward a local port, then you can use PuTTY to telnet into the local port. Details in this thread:
http://forum.xda-developers.com/showthread.php?t=535014

curvatura99 said:
Setup adb to use telnet and forward a local port, then you can use PuTTY to telnet into the local port. Details in this thread:
http://forum.xda-developers.com/showthread.php?t=535014
Click to expand...
Click to collapse
Oh, so close!! The thread above has the answer. In short, have adb listen to a local port on the Windows machine and forward it to the device, start the telnet server, and then use PuTTY to telnet into the device (from a Windows cmd prompt):
> adb forward tcp:9999 tcp:23
> adb shell telnetd
adb must be running as root.
Then, use PuTTY to telnet to localhost:9999 (the Windows machine @ 127.0.0.1, port 9999).
Almost works, except the telnet daemon on my Epic is refusing to connect! Looks like a security thing or something. Basically, I get the age-old UNIX telnet daemon message,
Entering character mode
Escape character is '^]'​but instead of a "login:" prompt, the connection is immediately closed with the message,
Connection closed by foreign host​This happens if I try to telnet locally to 127.0.0.1:23 on the Epic itself!!
Without telnetd running, there's no response (as expected). So clearly telnetd is running, listening to the port, responding to it, but just refusing to allow a login.
Any suggestions as to what's wrong? Is interactive login disabled or something?
BTW, this works wirelessly too -- don't need adb at all. Just get a shell prompt on the Epic and start telnetd. Then, you can use PuTTY (or any telnet client) to connect via wifi to <EpicIP>:23.
I tried this too, connected, but have the same instant disconnect problem.

I know this thread is old, but the solution might help someone. You need to start telnetd like this so it will invoke the shell when you telnet in:
I had to adb shell into the phone then run:
# busybox telnetd -l /system/bin/ash

As I'm new here I cannot post links, but if you google for 'Better cmd.exe terminal and ANSI color codes support' you will find another option then port forwarding etc.
Essentially using an alternative cmd.exe (Console) together with an ANSI helper program (ANSICON).
Did the trick for me at least.
Cheers,
Remco

http://forum.xda-developers.com/showthread.php?t=803223

Related

Looking for help with telnet mainframe emulator

I am looking for someone who is very experienced with telnet clients.
I use a mainframe emulator for work to see schedules and estimates of when I will be called to work. I'm on call 24/7 and it is so much better to be able to view the mainframe emulator rather than call the number and go through several prompts and have the computer speak out the info for each area.
I'm quite certain that it is possible to pull up this emulator on a ppc, but I don't know enough about telnet and mainframe emulation to configure it properly. The desktop version uses a java applet to pull up the window, and requires java, and java scripting. I've tried configuring several telnet clients to get it working with no success.
would someone be willing to help me get this going on my Mogul?
Telnet is incredibly simple.
You connect to a server address on a certain port -- it opens up a TCP data stream. You then have a two way communication channel to a remote server. You can type data, server will get the data, and can do what it wishes. It can also send output to you.
So essentially, if it is indeed running a basic telnet service if you know the server and port, there's nothing more to know. (Well, not entirely true, if the server has any sort of authentication it's likely going to want a user/pass.)
Try downloading PuTTy on your desktop at home and connecting using protocol telnet to see if you can get in from there.
In all likelihood the java program does some smoke and mirrors, and it's not just raw telnet. Otherwise, why would they require the application? They'd give everyone a telnet client. The IT dept for your company, will know more about how to telnet directly in, though they probably won't share such "secrets" with you.

Device security

If keeping your Android free from software that spies on you and your data is important to you, you might want to consider an occasional check.
Get a terminal emulator from the market an load it on your phone.
Open the terminal app and become super user:
Code:
su
Then enter
Code:
netstat -taupe
What follows will be a list of open net connections with IP addresses, both local and foreign. Sometime the process controlling the connection is also given - but not always.
Look over the foreign addresses. Any you are suspicious or unsure of, you can check on your PC.
In Linux open a terminal; in Windoze run cmd -w from the start menu to get a terminal window. Then issue a whois [IP ADDRESS] command. For example...
Code:
whois 209.85.229.102
The result will show information about the host for that IP address - in this example it turns out to be Google... probably one of the good guys... (but until the net neutrality issue is sorted the jury is still out).
So if you find a link to some unknown host belonging to a Internet Provider, in, say Brazil or China, that really has no business being connected to your phone, you may want to think about removing the app that added it, or asking its developer some serious questions.
It might be an idea to run this kind of check fairly often and especially after loading hacks of proprietary applications.

[REF] PPP over USB with adb (without hacking)

My development environment has a collection of native tools that blend with the target (the Galaxy) using X11 and NFS. For that I need a cabled network connection. adb hints that it supports PPP, and adb also uses the USB cable making it a perfect solution.
Sadly, "adb ppp" did not work, help hints are cryptic and useless and documentation is missing. Digging through the source reveals that it is possible, even without applying patches or other nasties.
A little understanding of PPP aids in explaining how this works.
PPP is basically a IPv4/IPv6 tunnel over anything that behaves like a serial line.
PTY/TTY is basically a serial line tunnel using file handles. Just like sockets, the PTY is the server side and the TTY the client.
adb basically transports multiple file handles over USB. You can have more than one "adb shell".
adbd is a good actor in opening remote resources and connecting them to file handles.
PPP is usually the initiator. It assumes that stdin/stdout are pre-opened handles to a device driver. If not, it wraps a user supplied script such a way in a PTY/TTY pair that the script can behave as a device driver.
When two ends of a network tunnel are set up in such a way, and the drivers/scripts make contact, PPP will start negotiating with it's peer until both agree to start transport. When that happens a new network interface "pppN" will appear.
On a different level: "abd shell" is usually the initiator and when invoked, it will contact the remote adbd through some custom protocol. When contacted, adb will function as a data pump and translator.
Now to mix these two worlds...
Connection setup - who invokes who
adb contacts the remote adbd, requesting it to setup the other end
adb creates a PTY/TTY pair
adb invokes pppd with the created TTY as its stdin/stdout
pppd creates a new network interface
the remote adbd creates a PTY/TTY pair
adbd invokes pppd with the created TTY as its stdin/stdout
pppd creates a new network interface
Data transport - who plays what role:
adb's pppd acts as a data pump between TTY and the local interface
adb acts as a data pump between PTY and the remote adbd
adbd acts as a data pump between PTY and the remote pppd
adbd's pppd acts as a data pump between TTY and the remote interface
Iniatives:
adb's pppd starts negotiating and generates output
adb will detach the sub-process tree
you can "adb shell" and access the Galaxy at the same time
How does this translate to something workable.
Code:
adb ppp "shell:pppd nodetach noipdefault" nodetach noipdefault <local-ip>:<remote-ip>
But this will not work because both pppd's will start authenticating, so both need the noauth option. Also the local pppd needs an extra notty to stop it complaining about /dev/tty not being a terminal, and the remote pppd needs an explicit ttyname as it complains about an unimplemented ttyname().
The follwing should work:
Code:
adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" nodetach noauth noipdefault notty <local-ip>:<remote-ip>
Note: local-ip and remote-ip should not be existing IP addresses.
Note: do not use dev: instead of shell: as the help suggests. Doing so will cause the USB data transport between adb and adbd to corrupt resulting in all open shell connections to terminate.
streaming data from adb to Internet
I suppose this question might be a bit naive, but here goes.
I want to transmit a stream of data from my adb to the Internet by way of the USB cord and the wifi or GSM of the android.
Can your technique help?
Have you any other recommendatations?
Thanks in advance.
Error: "Couldn't set tty to PPP discipline: Invalid argument"
First of all, thank you for the great explanation!
Unfortunately, on my system this does not work. When I enter this command, adb immediately quits silently, and 'logcat' on the device reveals a message like:
E/pppd (24409): Couldn't set tty to PPP discipline: Invalid argument
I have read about this problem also from other users. Do you have any hints
how to trace or solve the problem?
I am using a Samsung Galaxy Tab 2 (P3110) device running CyanogenMod 11 and Debian Linux with ADB 1.0.31 on the host.

[Q] Looking for ssh client for Android (Real client, not ConnectBot)

Dear all,
I am looking for an SSH client for Android to run from the command line.
I connect to the Android device over adb shell. I am using this for testing over a VPN on the device, and for this use a real keyboard and monitor. This is why ConnectBot SSH type client are of no use in this case (unless I really want to type hundreds of lines on a virtual keyboard
Does anyone know of a client. I looked at busybox and dropbear, but neither of these have an SSH client.
Best wishes, f.
Better Terminal Emulator Pro comes with a command line SSH client I believe
Andrwmorph said:
Better Terminal Emulator Pro comes with a command line SSH client I believe
Click to expand...
Click to collapse
+1
Better Terminal Emulator is very nice, and I can confirm does include an ssh client.

Shell command for checkin

Is there a shell command for *#*#2432546#*#* (*#*#checkin#*#*)?
instead of going to the phone menu all the time, i want to have my phone connected to the computer and to be able to just type the command in the terminal and have it check for updates...
Hasn't it been pretty firmly established at this point that checking in doesn't give you update access any quicker than you would get it anyway?
i understand that. i was just curious if there was an actual command for that or wether that was just built into the dialer app.
all check in does is re-associate your phone with the network and let the mothership know you are alive and well

Categories

Resources