Android如何实现自毁
来源:互联网 发布:淘宝网大码女装胖胖 编辑:程序博客网 时间:2024/05/02 21:52
有时候为了安全性,我们可以实现机器自毁,比如,我要实现一个APP,运行之后能够使Android系统损害,无法重新开机,除非重新刷写系统。
第一步破解手机开启root权限。标志是在system/app文件夹下放入一个可以供调用的su命令。
adb push su /system/binadb push SuperUser.apk /system/appadb shell chmod 4755 /system/bin/su
第二步是获取root
原理是修改本身的APK的权限为777
public static boolean isRoot(String pkgCodePath) { Process process = null; DataOutputStream os = null; try { String cmd = "chmod 777 " + pkgCodePath; process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(cmd + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { } } return true; }
假如手机有安装superuser.apk,就会有提示说有应用申请超级权限,这时候点击确定就可以了。
第三步,使用强制重启
public static boolean reboot() { Process process = null; DataOutputStream os = null; try { String cmd = "reboot"; process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(cmd + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { } } return true; }
假如设置一个服务,然后开机启动,执行上面的语句,就是无限开机重启了。可以执行shutdown,就是关机。
最后我们来个狠招,就是使Android无法开机
public static boolean destroyMachine() { Process process = null; DataOutputStream os = null; try { String cmd = "rm system/lib/*.jar"; process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(cmd + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { } } return true; }
执行这个命令,把系统库都删除,然后执行重启命令,机子就变砖头了。除非刷机。
那么怎样实现整个业务呢?可以这么干:做一个开机启动的系统服务运行在后台,并且能在后台联网。当我们的手机丢失时,我们通过网络发送一个指令,手机后台服务接收到指令就自毁。当然,我们也可以利用短信业务来实现,但是,一般手机被盗后,SIM卡也自然被替换掉了,手机还可能被恢复为出厂设置,因此,走网络是比较靠谱的。
1 0
- Android如何实现自毁
- Android如何实现自毁
- 如何在免费的试用版里实现自毁的功能
- 一代音频传奇Winamp如何自毁长城
- vfp程序自毁代码
- 一个自毁程序
- MSP430自毁功能设计
- Android如何实现全屏
- 如何实现Android SurfaceView
- Android如何实现国际化
- Android如何实现全屏
- Android如何实现侧拉栏
- android如何实现国际化
- 【Android】如何实现ButterKnife
- 【Android】如何实现ButterKnife
- android如何实现特效
- 文件加密与自毁长城
- CMMB手机电视自毁长城?
- HibernateTemplate 的常见用法
- left join
- LINUX下去除文件中重复的行
- NoClassDefFoundError: org/apache/commons/lang3/StringUtils.....
- How to migrate a SQL Server database to a lower version
- Android如何实现自毁
- 使用Autolayout xib实现动态高度的TableViewCell
- HttpClient学习笔记
- myeclipse10 的破解问题
- java:--l;l--;l-1
- Unity3D游戏引擎实战开发视频教程
- 彩色图像--彩色变换 补色处理
- Android中Video的三种播放方式的实现
- 有向图强连通分量的Tarjan算法