Go Back   xda-developers > HTC Dream: G1 > G1 Android Development


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 6th November 2008, 07:34 AM
jdhorvat jdhorvat is offline
Junior Member
 
Join Date: Nov 2008
Location: Lockport
Posts: 9
Lightbulb Run commands on G1 without 3rd party app

Is anyone aware of this? I found it by accident during a text conversation.

Step 1:
Reboot your phone.

Step 2:
Enter some commands.
When the system has completely rebooted there are several ways to enter commands. It seems like any app that came with the phone seems to double as a terminal. Try the following examples for running the reboot command

1. Open dialer, type reboot and press enter.
2. Create a search widget on your AndroidOS desktop... type reboot into it and press enter
3. Open a text message to yourself or someone else...in the message box type reboot and press enter.

You can also start telnetd this way, etc. Use your imagination.


Some open questions...

Questions:

- After a certain point it is no longer possible to enter commands this way. To enter commands again you have to reboot...which is the reason for Step 1. I don't know if it is a simple time limit at the beginning of boot, or if some hidden process is taking place and after its completion, the entering of commands using these methods is no longer possible. Does anyone know for sure why a reboot is eventually required to enter commands this way again?

- Copying and pasting commands into the various text boxes will not work. You must actually type the entire command and press enter immediately after in order for the command to be executed, or so it seems. Likewise you cannot for example enter a command in a search widget, then come back later with the text still there and press enter again to execute the command again. Does anyone have any insight into how these commands are being passed through to the system? I have never looked at any android src or anything like that, so I am absolutely clueless in this regard...and many others :-( It should also be noted that entering for example a "telnetd" command into a dialer will ALSO perform the function of dialing a phone number (it comes out as 8356383)..if entered into a text message it WILL pass with message to the recipient. One exception would be reboot, for obvious reasons.

- Does anyone have any additional insight into how this might be able to be used to compromise the security of the system? I used the search widget to start telnetd and ultimately get root. No pTerminal running. What other implications might this have?

- If someone has the spare time to look at the source and see why this is possible it would satisfy a great deal of my curiousity. Any takers? It would be interesting to see the code and know what the rules and limitations of entering commands this way really are.

- I am using RC29. Can anyone confirm whether or not this works on other versions?



Notes:


- Executing commands this way performs both the AndroidOS App function as well as executing the command. I.e. typing telnetd in a text message to your ex would be a pretty bad idea. This will both run telnetd AND send the text message to your ex.

- I would advise against entering long commands into the dialer as well. It will be really hard to explain to a Vietnamese Wal-Mart that you were just trying to mount your sdcard.

- Any commands that are entered WILL execute, but the results may not be obvious, as there is no output screen.

Last edited by jdhorvat; 6th November 2008 at 07:48 AM.. Reason: Added question about functionality on other RC's
Reply With Quote
Sponsored Links

  #2  
Old 6th November 2008, 07:38 AM
staulkor staulkor is offline
Senior Member
 
Join Date: Jan 2007
Location: Laurel, MD, USA
Posts: 192
Default

Good find. Sounds like a bug to me though. I say that because if it were a hidden feature, I would think it wouldn't be sending a text message and executing a command.
__________________
--too many phones to list--
Reply With Quote

  #3  
Old 6th November 2008, 07:46 AM
jdhorvat jdhorvat is offline
Junior Member
 
Join Date: Nov 2008
Location: Lockport
Posts: 9
Default Possible bug

Quote:
Originally Posted by staulkor View Post
Good find. Sounds like a bug to me though. I say that because if it were a hidden feature, I would think it wouldn't be sending a text message and executing a command.
My thought as well. The only reason I'm not certain is the time limit after boot..If it even is a time limit. The other reason is that it does not seem to work if you enter commands into apps other than those packaged with Android. (i.e. entering "reboot" as a high score name in some game from the app market will not restart the phone)
Reply With Quote

  #4  
Old 6th November 2008, 07:52 AM
neoobs neoobs is offline
Moderator
 
Join Date: Mar 2008
Posts: 1,235
Default

Quote:
Originally Posted by jdhorvat View Post
My thought as well. The only reason I'm not certain is the time limit after boot..If it even is a time limit. The other reason is that it does not seem to work if you enter commands into apps other than those packaged with Android. (i.e. entering "reboot" as a high score name in some game from the app market will not restart the phone)
That would mean there is a bug in the core.
Reply With Quote

  #5  
Old 6th November 2008, 11:30 PM
jimparis jimparis is offline
Junior Member
 
Join Date: Nov 2008
Posts: 3
Default

Quote:
That would mean there is a bug in the core.
I tracked it down -- they left a shell running on the console. See http://android.jim.sh/index.php/ConsoleShell
Reply With Quote

  #6  
Old 7th November 2008, 12:10 AM
jdhorvat jdhorvat is offline
Junior Member
 
Join Date: Nov 2008
Location: Lockport
Posts: 9
Thumbs up perfect!

Quote:
Originally Posted by jimparis View Post
I tracked it down -- they left a shell running on the console. See http://android.jim.sh/index.php/ConsoleShell
Thanks Jim! Excellent job tracking this down, this is precisely what I was hoping to see. I found your article very informative. It has certainly shed more light on the matter for me.
Reply With Quote

Reply

Tags
android commands, android terminal, g1 terminal, pterminal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 +1. The time now is 05:12 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.