English 中文(简体)
Adroid 赠与应用程序根入口,以便在 < 1025 端口打开套接字
原标题:Android grant application root access in order to open socket on port < 1025
  • 时间:2012-05-24 06:00:54
  •  标签:
  • java
  • android

为了在端口 & lt; 1025 上打开插座, 需要 root 存取 。 我到底要怎么给我的应用程序提供这种高级权限? 我知道我可以在 shell 中运行 su 命令以获得 root 存取权限, 但只要在 1025 端口打开插座即可吗? 或者我需要运行某种命令, 比如 su open socket 0.0. 0.0 0. 0. 0. 80 或其它东西? 我非常困惑, 因为有这么少的资源可用于此 。 谷歌的目的是什么?

以下是我为获得根接入所能做的 。 http://www.youtube.com/watch?v=jmfvX8zvsS0&list=Uk1SpNzOs4MYmr0UICENTg&index=4& feature=plcp

我刚写了这个:

public class RootTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            String cmds[] = {"su", "-c", "ls /system/app"};
            Shell shell = new Shell();
            String text = shell.sendShellCommand(cmds);
            TextView textView = (TextView)findViewById(R.id.textView);
            textView.setText(text);
            try {
                ServerSocket socket = new ServerSocket(80);
                Log.d("Root", "Opened socket on port 80!!!");
            }catch(Exception e) {
                Log.d("Root", "Failed to open socket on port 80!!!");
                e.printStackTrace();
            }
        }

    });
  }
}

这是它运行命令 su, -c, 然后是 / system/ app 当单击按钮时是 / system/ app 。 然后它获得输出并在文本视图上显示它( 它实际上有效 。 我得到了 su 快速和 选中的接受, 并在 / system/ apps / 中列出了所有内容 ) 。 但在此之后, 我试图在 80 号 端口打开插座, 它仍然说 允许 拒绝 。 应用程序有 根权限, 但仍然无法打开套座! 在对齐时, 它打印了“ 80 号端口没有打开套座!!!!!! ” 。 正如我告诉它的那样, 当例外被捕获时, 我能够做什么来打开 80 号端口插座而没有被允许?

最佳回答
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签