-
08-08-2012, 08:49 PM #1Security Researcher


- Join Date
- Jul 2010
- Posts
- 245
- Blog Entries
- 2
- Thanks
- 178
- Thanked 140 Times in 72 Posts
Develop on device android console(shell) app
Namaste
An android device with development environment is a great weapon for hacking. In this thread we'll develop our own console application to execute the shell commands provided by android os
Search for AIDE app in google app store and install it. It is an ondevice IDE/compiler for android app development
Create a new project and into its MainActivity.java file paste the following code
Code:package com.mycompany.myapp; import android.app.*; import android.os.*; import android.view.View; import android.widget.*; import android.widget.TextView; import android.util.Log; import android.widget.Button; import android.widget.EditText; import java.io.*; import java.lang.Process; import android.text.method.*; import java.io.BufferedReader.*; import java.io.BufferedWriter.*; public class MainActivity extends Activity implements View.OnClickListener { public String ver = "Android Console v0.01\nDeveloper: \"vinnu\"\nTeam:\"Legion Of Xtremers\" & secfence\nUrl:www.secfence.com\n"; private TextView tvp; private EditText et; private TextView tvout; private Process rprocc; private BufferedReader br; private BufferedWriter bw; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView)findViewById(R.id.tver); tv.setText(ver); Button bt = (Button)findViewById(R.id.hello); bt.setOnClickListener(this); tvp = (TextView)findViewById(R.id.prompt); et = (EditText)findViewById(R.id.texf); et.setText(""); tvout = (TextView)findViewById(R.id.out); tvout.setMovementMethod(new ScrollingMovementMethod()); } public void onClick(View view) { sheller(); } public void sheller() { StringBuffer output = new StringBuffer(); int read = 0; char[] buffer = new char[4096]; String [] cmd = {"/system/bin/sh","-c", "\""+et.getText()+"\"\n"}; try{ rprocc = Runtime.getRuntime().exec(cmd); br = new BufferedReader(new InputStreamReader(rprocc.getInputStream())); // bw = new BufferedWriter(new OutputStreamWriter(rproc.getOutputStream())); while((read = br.read(buffer)) > 0) { Log.d("DEBUGTAG","Reading output of command."); output.append(buffer, 0, read); } tvout.setText(tvp.getText()+""+et.getText()+"\n"+output+tvout.getText()); } catch(IOException e) { throw new RuntimeException(); } et.setText(""); } }Last edited by "vinnu"; 08-08-2012 at 09:19 PM.
-
08-08-2012, 08:56 PM #2Security Researcher


- Join Date
- Jul 2010
- Posts
- 245
- Blog Entries
- 2
- Thanks
- 178
- Thanked 140 Times in 72 Posts
Save the file and now in ....../projectname/res/layout/main.xml file type in the folowing xml code:
Code:<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:stretchColumns="1" android:shrinkColumns="0" > <TableRow> <TextView android:id="@+id/tver" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:id="@+id/prompt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="127.0.0.1:~$" /> <EditText android:id="@+id/texf" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_span="3" /> <Button android:id="@+id/hello" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Exec" /> </TableRow> <TableRow> <TextView android:id="@+id/out" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:maxLines="30" android:layout_span="4" /> </TableRow> </TableLayout>
-
08-08-2012, 09:00 PM #3Security Researcher


- Join Date
- Jul 2010
- Posts
- 245
- Blog Entries
- 2
- Thanks
- 178
- Thanked 140 Times in 72 Posts
You need to select the "Install apps from unknown source" [like that] setting from ur device's settings menu before rrunning this app. Select Save and then Run from AIDE menu to install ur app and execute it.
..."vinnu"
-
08-08-2012, 10:50 PM #4Security Researcher

- Join Date
- May 2011
- Location
- Pune, Maharashtra, India
- Posts
- 226
- Blog Entries
- 1
- Thanks
- 75
- Thanked 91 Times in 50 Posts
Website :
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Blog :
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
-
08-09-2012, 10:24 AM #5Security Researcher


- Join Date
- Jul 2010
- Posts
- 245
- Blog Entries
- 2
- Thanks
- 178
- Thanked 140 Times in 72 Posts
Namaste
Yes, there are several, but there is always a charm of deveoping own tools, this gives us more power and control as we can do whatever we wish. And the bliss comes when our tool works, but not when other's app did stuff for us...."vinnu"



LinkBack URL
About LinkBacks



Reply With Quote

i am a secret hacker with all...
05-22-2013, 09:35 PM in Noobs Corner