├── .gitattributes ├── .gitignore ├── EnulatorCache ├── ReadMe.md ├── jni │ ├── Android.mk │ └── EnulatorCache.cpp └── src │ └── com │ └── example │ └── enulatorcache │ └── MainActivity.java ├── FileObserver ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── demo │ │ │ └── asus │ │ │ └── fileobserver │ │ │ ├── MainActivity.java │ │ │ ├── MonitorActivity.java │ │ │ └── RecursiveFileObserver.java │ │ └── res │ │ ├── layout │ │ ├── activity_main.xml │ │ └── activity_monitor.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── ProtectFunc ├── App │ └── ProtectFunc │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-web.png │ │ ├── libs │ │ └── armeabi │ │ │ └── libProtectFunc.so │ │ ├── res │ │ ├── layout │ │ │ └── activity_main.xml │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── src │ │ └── com │ │ └── example │ │ └── protectfunc │ │ └── MainActivity.java ├── crypto code │ └── main.c └── jni │ ├── Android.mk │ ├── Application.mk │ └── ProtectFunc.cpp ├── ProtectSection ├── APP │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── libs │ │ └── armeabi │ │ │ └── libprotect_section.so │ ├── res │ │ ├── layout │ │ │ └── activity_main.xml │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── src │ │ └── com │ │ └── example │ │ └── protectsection │ │ └── MainActivity.java ├── crypto code │ └── main.c └── jni │ ├── Android.mk │ ├── Application.mk │ └── protect_section.cpp ├── android_inlinehook ├── Android.mk ├── Application.mk ├── README.md ├── asm.S ├── backtrace.c ├── backtrace.h ├── inlineHook.c ├── inlineHook.h ├── list.h ├── log.h ├── utils.c └── utils.h └── dex_parser ├── classes.dex ├── dex_class.py ├── dex_class.pyc ├── leb128.py ├── leb128.pyc ├── method_code_class.py ├── parse_dex.py ├── parse_dex.pyc └── readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.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 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /EnulatorCache/ReadMe.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Android-demo/dd39d5866867511ff0703c938ec794ba7e215065/EnulatorCache/ReadMe.md -------------------------------------------------------------------------------- /EnulatorCache/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := EnulatorCache 6 | LOCAL_SRC_FILES := EnulatorCache.cpp 7 | 8 | include $(BUILD_SHARED_LIBRARY) 9 | -------------------------------------------------------------------------------- /EnulatorCache/jni/EnulatorCache.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Android-demo/dd39d5866867511ff0703c938ec794ba7e215065/EnulatorCache/jni/EnulatorCache.cpp -------------------------------------------------------------------------------- /EnulatorCache/src/com/example/enulatorcache/MainActivity.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Android-demo/dd39d5866867511ff0703c938ec794ba7e215065/EnulatorCache/src/com/example/enulatorcache/MainActivity.java -------------------------------------------------------------------------------- /FileObserver/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /FileObserver/.idea/.name: -------------------------------------------------------------------------------- 1 | FileObserver -------------------------------------------------------------------------------- /FileObserver/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /FileObserver/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /FileObserver/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /FileObserver/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | -------------------------------------------------------------------------------- /FileObserver/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /FileObserver/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FileObserver/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /FileObserver/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /FileObserver/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "22.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.demo.asus.fileobserver" 9 | minSdkVersion 19 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.+' 26 | } 27 | -------------------------------------------------------------------------------- /FileObserver/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /FileObserver/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /FileObserver/app/src/main/java/com/demo/asus/fileobserver/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo.asus.fileobserver; 2 | 3 | 4 | import android.app.Activity; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.os.Process; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | import android.widget.Toast; 12 | 13 | import java.io.File; 14 | 15 | public class MainActivity extends Activity { 16 | 17 | public static String EXTAR_PATH = "path_to_monitor"; 18 | 19 | private Button btnStart = null; 20 | private EditText editPath = null; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_main); 26 | 27 | btnStart = (Button) findViewById(R.id.btn_start); 28 | editPath = (EditText) findViewById(R.id.text_path); 29 | 30 | if (editPath != null){ 31 | /*一次将/proc 目录下全加上会崩溃,文件太多*/ 32 | // editPath.setText("/proc/"+getPid()); 33 | // editPath.setText("/tmp/1"); //test 34 | editPath.setText("/proc/"+getPid()+"/status"); 35 | } 36 | if (btnStart!=null){ 37 | btnStart.setOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View view) { 40 | String path = editPath.getText().toString(); 41 | handlePath(path); 42 | } 43 | }); 44 | } 45 | 46 | } 47 | 48 | 49 | public void handlePath(String path){ 50 | if (path.isEmpty()){ 51 | Toast.makeText(this,"the path is empty",Toast.LENGTH_SHORT).show(); 52 | return; 53 | } 54 | try{ 55 | File f = new File(path); 56 | if (f.exists()){ 57 | int requestCode = 0; 58 | Intent i = new Intent("android.intent.action.MONITOR"); 59 | i.putExtra(EXTAR_PATH,path); 60 | startActivityForResult(i,requestCode); 61 | } 62 | }catch (RuntimeException e){ 63 | Toast.makeText(this,"the file is not exist",Toast.LENGTH_SHORT).show(); 64 | return; 65 | } 66 | } 67 | 68 | 69 | private static String getPid() { 70 | return String.format("%d",Process.myPid()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /FileObserver/app/src/main/java/com/demo/asus/fileobserver/MonitorActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo.asus.fileobserver; 2 | 3 | import android.app.Activity; 4 | 5 | import android.os.Bundle; 6 | 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.widget.Button; 10 | 11 | 12 | /** 13 | * Created by ASUS on 2016/5/23. 14 | */ 15 | public class MonitorActivity extends Activity { 16 | 17 | //public static String MONITOR_TAG = "monitor_debug"; 18 | private String path = null; 19 | private Button btn_stop = null; 20 | private RecursiveFileObserver observer = null; 21 | 22 | ; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | 27 | Bundle extras = getIntent().getExtras(); 28 | if (extras != null){ 29 | path = extras.getString(MainActivity.EXTAR_PATH); 30 | }else { 31 | Log.d("C&C","observer path is null"); 32 | } 33 | 34 | btn_stop = (Button)findViewById(R.id.btn_stop); 35 | if (btn_stop==null){ 36 | 37 | } 38 | 39 | btn_stop.setOnClickListener(new View.OnClickListener() { 40 | @Override 41 | public void onClick(View view) { 42 | observer.stopWatching(); 43 | } 44 | }); 45 | 46 | 47 | observer = new RecursiveFileObserver(path); 48 | observer.startWatching(); 49 | 50 | } 51 | 52 | /* 53 | public void log(String msg) { 54 | Log.d(MONITOR_TAG, msg); 55 | if (Environment.getExternalStorageState() 56 | .equals(Environment.MEDIA_MOUNTED)) { 57 | //存在sd卡 58 | String sd_path = Environment.getExternalStorageDirectory().getPath(); 59 | Calendar c = Calendar.getInstance(); 60 | SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd"); 61 | String strDay = time.format(c.getTime()); 62 | String logFileName = sd_path + "/FileObserverDemo/log/"+strDay+".txt"; 63 | MyLog log = new MyLog(logFileName); 64 | /* 65 | try { 66 | File f = new File(logFileName); 67 | if (f.exists()) { 68 | 69 | 70 | } else {//文件不存在 71 | if (f.getParentFile().mkdir()) { 72 | //创建父目录 73 | if (f.createNewFile()) { 74 | Log.d(MONITOR_TAG, "CCCC"); 75 | } 76 | } else { 77 | Log.d(MONITOR_TAG, "CCCC"); 78 | } 79 | 80 | } 81 | 82 | } catch (Exception e) { 83 | e.printStackTrace(); 84 | } 85 | 86 | } else { 87 | 88 | } 89 | } 90 | */ 91 | 92 | } 93 | -------------------------------------------------------------------------------- /FileObserver/app/src/main/java/com/demo/asus/fileobserver/RecursiveFileObserver.java: -------------------------------------------------------------------------------- 1 | package com.demo.asus.fileobserver; 2 | 3 | import android.os.FileObserver; 4 | import android.util.Log; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.File; 8 | 9 | import java.io.FileReader; 10 | 11 | 12 | import java.util.ArrayList; 13 | 14 | import java.util.Stack; 15 | 16 | 17 | public class RecursiveFileObserver{ 18 | 19 | private ArrayList mSingleObservers = new ArrayList(); 20 | 21 | 22 | public RecursiveFileObserver(String path){ 23 | 24 | //解析子目录 25 | Stack pathStack = new Stack(); 26 | pathStack.push(path); 27 | while (!pathStack.isEmpty()){ 28 | String parentPath = pathStack.pop(); 29 | if (mSingleObservers.add(new SingleFileObserver(parentPath))){ 30 | Log.d("C&C","add observer success"+parentPath); 31 | } 32 | 33 | File parent = new File(parentPath); 34 | 35 | if (parent.isDirectory()){ 36 | File[] files = parent.listFiles(); 37 | for (int i =0;i 2 | 11 | 12 | 16 | 17 |