简体   繁体   English

通过Android设备上的应用程序设置ifconfig eth0“ ipaddress”

[英]set ifconfig eth0 “ipaddress” via app on android device

I am currently working on a custom android platform with RJ45 Lan connection, the problem now, is that I would like to be able to set the ip address from my custom app.. 我目前正在使用RJ45 Lan连接在自定义android平台上工作,现在的问题是,我希望能够从自定义应用程序设置IP地址。

using 'ifconfig' works from shell directly in android kernel being root, but how do I use it from an app? 使用'ifconfig'可以直接在shell中以root身份在android内核中运行,但是如何从应用程序中使用它呢?

You could use the RootTools library by stericson: http://code.google.com/p/roottools/ 您可以使用stericson的RootTools库: http : //code.google.com/p/roottools/

You can very easily run root shell commands with it :) 您可以使用它非常容易地运行root shell命令 :)

Check its wiki for usage : http://code.google.com/p/roottools/wiki/Usage 检查其Wiki的使用情况http : //code.google.com/p/roottools/wiki/ 用法

In fact, any method that can execute root commands should be okay. 实际上,任何可以执行root命令的方法都可以。

My solution: 我的解决方案:

Since its my own kernel build I edited the source code of "su" and commented the security check away, so basically every user can become root.. 由于它是我自己的内核,因此我编辑了“ su”的源代码并注释掉了安全检查,因此基本上每个用户都可以成为root用户。

Not a very pretty or secure solution, but my device will not be used for "unauthorized" apps anyway, and the rom will not be made public, so that will be the solution so far. 这不是一个非常漂亮或安全的解决方案,但是无论如何我的设备都不会用于“未经授权”的应用程序,并且rom不会公开,因此到目前为止,这是解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM