Android Security
Development
PART 2 – Malicious Android App
Dynamic Analyzing System
SEAN
Sean
• Developer
• erinus.startup@gmail.com
• https://www.facebook.com/erinus
You Need...
• Hardware
• Phone
• Google Nexus 4
• Google Nexus 5
• Tablet
• Google Nexus 7
• Google Nexus 9
You Still Need...
• Software
• Virtual Machine
• VMware Workstation
• VirtualBox
• Operating System
• Ubuntu Desktop14.04
Build Nexus 5 Image
[1] Install Ubuntu 14.04
# create user named "user"
> sudo apt-get update
> sudo apt-get install vim less gcc g++ make build-
essential binutils wget ssh openssh-server openssh-
client zip unzip perl python rsync git openssl
> sudo apt-get upgrade
> sudo apt-get dist-upgrade
> sudo apt-get autoclean
> sudo apt-get autoremove
> sudo rm –f /var/cache/apt/archives/*.deb
[2] Build Environment for 4.x
> sudo apt-get install git gnupg flex bison gperf
build-essential zip curl libc6-dev libncurses5-
dev:i386 x11proto-core-dev libx11-dev:i386
libreadline6-dev:i386 libgl1-mesa-glx:i386
libgl1-mesa-dev gcc-multilib g++-multilib
mingw32 tofrodos python-markdown libxml2-utils
xsltproc zlib1g-dev:i386
> sudo ln -s /usr/lib/i386-linux-
gnu/mesa/libGL.so.1 /usr/lib/i386-linux-
gnu/libGL.so
> sudo apt-get install python-software-properties
> sudo add-apt-repository ppa:webupd8team/java
> sudo apt-get update
> sudo apt-get install oracle-java6-installer
[2] Build Environment for 5.x
> sudo apt-get install git gnupg flex bison gperf
build-essential zip curl libc6-dev libncurses5-
dev:i386 x11proto-core-dev libx11-dev:i386
libreadline6-dev:i386 libgl1-mesa-glx:i386
libgl1-mesa-dev gcc-multilib g++-multilib
mingw32 tofrodos python-markdown libxml2-utils
xsltproc zlib1g-dev:i386
> sudo ln -s /usr/lib/i386-linux-
gnu/mesa/libGL.so.1 /usr/lib/i386-linux-
gnu/libGL.so
> sudo apt-get install openjdk-7-jdk
[3] AOSP Environment
> cd ~
> mkdir ~/aosp
> mkdir ~/aosp/bin
> PATH=~/aosp/bin:$PATH
> curl https://storage.googleapis.com/git-repo-
downloads/repo > ~/aosp/bin/repo
> chmod a+x ~/aosp/bin/repo
> curl https://storage.googleapis.com/git-repo-
downloads/repo > ~/aosp/bin/repo
> chmod a+x ~/aosp/bin/repo
> git config --global user.email "user@USER"
> git config --global user.name "user"
[4] Download AOSP
> mkdir ~/aosp/src
> cd ~/aosp/src
> repo init -u
https://android.googlesource.com/platform/manifest
-b android-4.4.4_r2.0.1
> sudo sysctl -w net.ipv4.tcp_window_scaling=0
# -j(?) means amount of thread(cores) used
> repo sync -j1
[6] Download Nexus 5 Driver
> cd ~/aosp/src
> wget
https://dl.google.com/dl/android/aosp/broadcom-
hammerhead-ktu84p-5a5bf60e.tgz
> wget https://dl.google.com/dl/android/aosp/lge-
hammerhead-ktu84p-49419c39.tgz
> wget https://dl.google.com/dl/android/aosp/qcom-
hammerhead-ktu84p-f159eadf.tgz
> tar xzvf broadcom-hammerhead-ktu84p-5a5bf60e.tgz
> tar xzvf lge-hammerhead-ktu84p-49419c39.tgz
> tar xzvf qcom-hammerhead-ktu84p-f159eadf.tgz
[7] Import Nexus 5 Driver
> cd ~/aosp/src
> ./extract-broadcom-hammerhead.sh
> ./extract-lge-hammerhead.sh
> ./extract-qcom-hammerhead.sh
[5] Build AOSP
> cd ~/aosp/src
> source build/envsetup.sh
> lunch aosp_hammerhead-userdebug
> make –j1
[8] Download Android SDK
• Android SDK Platform-tools
• SDK Build-tools
[9] Flash Image Onto Device
> export
ANDROID_PRODUCT_OUT=/home/user/aosp/src/out/target
/product/hammerhead
> fastboot erase boot
> fastboot erase cache
> fastboot erase recovery
> fastboot erase system
> fastboot erase userdata
> fastboot flash boot boot.img
> fastboot flash cache cache.img
> fastboot flash recovery recovery.img
> fastboot flash system system.img
> fastboot flash userdata userdata.img
The Walking Deadveloper Orz...
Find Java Base Class Library
libcore/luni/src/main/java
Find Android Base Class Library
frameworks/base/core/java
Find Android ADB
system/core/adb
Android Image Modification
> source build/envsetup.sh
> lunch aosp_hammerhead-userdebug
> make update-api
> make –j1
Android ADB Modification
# Build for Windows
> sudo apt-get install mingw-w64
> cd ~/aosp/src
> make USE_MINGW=yes adb showcommands
# Build for Linux
> cd ~/aosp/src
> make adb showcommands
Customize Logcat
[1] Start...
1. Android developers use "Log.d / Log.e / ..." to
read messages.
http://developer.android.com/reference/android/
util/Log.html
2. So, monitor "Log.d / Log.e / ..."?
No, it's not enough!
Why?
[2] Base Knowledge
3. Android Architecture
Log.d
?
[3] View Source Code
4. Android Source Online
https://android.googlesource.com
5. Search Android Source Online
http://code.metager.de/source/xref/android/4.4/
http://grepcode.com/project/repository.grepcode
.com/java/ext/com.google.android/android
[4] Where?
6. Search Possible Occurrence
[4] Where?
7. System.java
[4] Where?
7. System.java
CLICK
[5] Got You!
8. System.java
[6] Java – JNI – C++
9. Java
/libcore/luni/src/main/java/java/
JNI
/libcore/luni/src/main/native/
[7] JNI – C++
10. java_lang_System.cpp
[8] Modify...
11. Patch java_lang_System.cpp
[8] Modify...
11. Patch java_lang_System.cpp
ADD
[8] Modify...
11. Patch java_lang_System.cpp
ADD
[8] Modify...
11. Patch java_lang_System.cpp
MODIFY
MODIFY
[8] Modify...
11. Patch java_lang_System.cpp
[9] Modify...
12. Patch System.java
[9] Modify...
12. Patch System.java
ADD
ADD
[9] Modify...
12. Patch System.java
Create Customized Function: appsandbox(String)
ADD
[10] Output
> adb logcat –v long appsandbox:V *:S > adb.log
# appsandbox:V means "Verbose for Tag:appsandbox“
# *:S means "Silence for Other Tags"
Dive Into Source
First
PID
[1] Why I Need PID?
1. When you try to get package, you get the
package name where your called.
It's not package name of app!
com.td.bookshelf.provider
com.td.bookshelf
[2] Get PID
2. import android.os.Process;
/frameworks/base/core/java/android/os/Process.j
ava
[2] Get PID
3. Process.myPid();
[2] Get PID
3. Process.myPid();
[3] Application
4. import android.app.Application;
/frameworks/base/core/java/android/app/Applicat
ion.java
[3] Inject Code
5. Monitor onCreate()
[3] Inject Code
6. Monitor onTerminate()
Second
IO Stream
[1] Find Base Class
1. import java.io.InputStream;
/libcore/luni/src/main/java/java/io/InputStream
.java
2. import java.io.OutputStream;
/libcore/luni/src/main/java/java/io/OutputStrea
m.java
[2] What Is Necessary?
3. Monitor InputStream
[2] What Is Necessary?
4. Monitor OutputStream
Third
Network
[1] Find Base Class
1. import java.net.URL;
/libcore/luni/src/main/java/java/net/URL.java
2. import java.net.URI;
/libcore/luni/src/main/java/java/net/URI.java
[2] What Is Necessary?
3. Monitor URL
Hook Constructor
[2] What Is Necessary?
3. Monitor URL
Hook Constructor
[2] What Is Necessary?
4. Monitor URI
Hook Constructor
Demo
Interested On This? Join Me!
Next Part
Malicious Android App
Static Analysis

More Related Content

PDF
Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...
PDF
Network Device Development - Part 5: Firewall 104 ~ Packet Splitter
PDF
2015.10.05 Updated > Network Device Development - Part 1: Switch
PDF
2015.10.05 Updated > Network Device Development - Part 2: Firewall 101
PDF
Securing the Socks Shop
PPTX
Kali net hunter
PPT
Learning AOSP - Android Linux Device Driver
PDF
Security of Windows 10 IoT Core(FFRI Monthly Research 201506)
Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload...
Network Device Development - Part 5: Firewall 104 ~ Packet Splitter
2015.10.05 Updated > Network Device Development - Part 1: Switch
2015.10.05 Updated > Network Device Development - Part 2: Firewall 101
Securing the Socks Shop
Kali net hunter
Learning AOSP - Android Linux Device Driver
Security of Windows 10 IoT Core(FFRI Monthly Research 201506)

What's hot (20)

PPTX
UEFI Firmware Rootkits: Myths and Reality
PPTX
Доставка зловредов через облака
PPT
Android booting sequece and setup and debugging
PPT
Bigger On The Inside
PPTX
Manage kernel vulnerabilities in the software development lifecycle
PDF
The Dark Side of PowerShell by George Dobrea
PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
PDF
How to Connect MQTT Broker on ESP8266 WiFi
PPTX
System hardening - OS and Application
PDF
Firmware hacking, slash the pineapple for fun
PPTX
Android Booting Sequence
PDF
How to Install nRF51 IPv6 over Bluetooth using MDK-ARM+IoT SDK
PDF
Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...
PPTX
IOS Security Basics - NULL/ OWASP/G4H Meet
PDF
install mosquitto-auth-plug - cheat sheet -
PPT
Learning AOSP - Android Booting Process
PDF
[ELCE] Activities of super long term support kernel workgroup in civil infras...
PDF
CentOS Linux Server Hardening
PDF
Learning notes on Open Source License
DOC
Taishaun_OwnensCNS-533_Lab
UEFI Firmware Rootkits: Myths and Reality
Доставка зловредов через облака
Android booting sequece and setup and debugging
Bigger On The Inside
Manage kernel vulnerabilities in the software development lifecycle
The Dark Side of PowerShell by George Dobrea
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
How to Connect MQTT Broker on ESP8266 WiFi
System hardening - OS and Application
Firmware hacking, slash the pineapple for fun
Android Booting Sequence
How to Install nRF51 IPv6 over Bluetooth using MDK-ARM+IoT SDK
Android Things Security Research in Developer Preview 2 (FFRI Monthly Researc...
IOS Security Basics - NULL/ OWASP/G4H Meet
install mosquitto-auth-plug - cheat sheet -
Learning AOSP - Android Booting Process
[ELCE] Activities of super long term support kernel workgroup in civil infras...
CentOS Linux Server Hardening
Learning notes on Open Source License
Taishaun_OwnensCNS-533_Lab
Ad

Viewers also liked (20)

PDF
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
PDF
2015.04.24 Updated > Android Security Development - Part 1: App Development
PDF
Deep Dive Into Android Security
PDF
Testing Android Security Codemotion Amsterdam edition
PDF
Brief Tour about Android Security
PDF
Android Security Development
PPTX
Understanding android security model
PPTX
Android security
PPTX
Owasp web security
PPTX
Web application Security
PDF
OWASP Top 10 Overview
PDF
Application Security around OWASP Top 10
PDF
Web application security (RIT 2014, rus)
PDF
End to end web security
PDF
Web security: OWASP project, CSRF threat and solutions
PDF
Secure Password Storage & Management
PDF
Threat Modeling for Web Applications (and other duties as assigned)
PPTX
[Wroclaw #1] Android Security Workshop
PPT
Owasp Top 10
PPTX
Security threats in Android OS + App Permissions
Consulthink @ GDG Meets U - L'Aquila2014 - Codelab: Android Security -Il ke...
2015.04.24 Updated > Android Security Development - Part 1: App Development
Deep Dive Into Android Security
Testing Android Security Codemotion Amsterdam edition
Brief Tour about Android Security
Android Security Development
Understanding android security model
Android security
Owasp web security
Web application Security
OWASP Top 10 Overview
Application Security around OWASP Top 10
Web application security (RIT 2014, rus)
End to end web security
Web security: OWASP project, CSRF threat and solutions
Secure Password Storage & Management
Threat Modeling for Web Applications (and other duties as assigned)
[Wroclaw #1] Android Security Workshop
Owasp Top 10
Security threats in Android OS + App Permissions
Ad

Similar to Android Security Development - Part 2: Malicious Android App Dynamic Analyzing System (20)

PDF
Working with the AOSP - Linaro Connect Asia 2013
PDF
An Introduction To Android
PPTX
Android build on windows
PDF
Discover System Facilities inside Your Android Phone
PDF
Android Platform Debugging & Development
PDF
Deep Dive into the AOSP
PDF
Inside Android's UI at AnDevCon IV
PDF
Core Android
PDF
Android 5.0 Lollipop platform change investigation report
PDF
Droidcon uk2012 androvm
PDF
Android Internals
PDF
Android Platform Debugging and Development
PDF
Android Platform Debugging and Development at ABS 2014
PDF
Building aosp
PDF
Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon S...
PDF
Android OS Porting: Introduction
PDF
Android Platform Debugging and Development at ELCE 2013
PDF
Android Platform Debugging and Development
PDF
Android Platform Debugging and Development
PDF
Lecture02web 140phpapp01
Working with the AOSP - Linaro Connect Asia 2013
An Introduction To Android
Android build on windows
Discover System Facilities inside Your Android Phone
Android Platform Debugging & Development
Deep Dive into the AOSP
Inside Android's UI at AnDevCon IV
Core Android
Android 5.0 Lollipop platform change investigation report
Droidcon uk2012 androvm
Android Internals
Android Platform Debugging and Development
Android Platform Debugging and Development at ABS 2014
Building aosp
Introduction to Android ROM cooking, part of my AnDevCon workshop (AnDevCon S...
Android OS Porting: Introduction
Android Platform Debugging and Development at ELCE 2013
Android Platform Debugging and Development
Android Platform Debugging and Development
Lecture02web 140phpapp01

Recently uploaded (20)

PPTX
CNN LeNet5 Architecture: Neural Networks
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Python is a high-level, interpreted programming language
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
Plex Media Server 1.28.2.6151 With Crac5 2022 Free .
PPTX
Airline CRS | Airline CRS Systems | CRS System
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
CNN LeNet5 Architecture: Neural Networks
Matchmaking for JVMs: How to Pick the Perfect GC Partner
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Tech Workshop Escape Room Tech Workshop
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Full-Stack Developer Courses That Actually Land You Jobs
How to Use SharePoint as an ISO-Compliant Document Management System
Python is a high-level, interpreted programming language
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
Plex Media Server 1.28.2.6151 With Crac5 2022 Free .
Airline CRS | Airline CRS Systems | CRS System
Computer Software - Technology and Livelihood Education
Cybersecurity: Protecting the Digital World
Trending Python Topics for Data Visualization in 2025
Download Adobe Photoshop Crack 2025 Free
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业

Android Security Development - Part 2: Malicious Android App Dynamic Analyzing System

  • 1. Android Security Development PART 2 – Malicious Android App Dynamic Analyzing System SEAN
  • 2. Sean • Developer • [email protected] https://www.facebook.com/erinus
  • 3. You Need... • Hardware • Phone • Google Nexus 4 • Google Nexus 5 • Tablet • Google Nexus 7 • Google Nexus 9
  • 4. You Still Need... • Software • Virtual Machine • VMware Workstation • VirtualBox • Operating System • Ubuntu Desktop14.04
  • 6. [1] Install Ubuntu 14.04 # create user named "user" > sudo apt-get update > sudo apt-get install vim less gcc g++ make build- essential binutils wget ssh openssh-server openssh- client zip unzip perl python rsync git openssl > sudo apt-get upgrade > sudo apt-get dist-upgrade > sudo apt-get autoclean > sudo apt-get autoremove > sudo rm –f /var/cache/apt/archives/*.deb
  • 7. [2] Build Environment for 4.x > sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5- dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev gcc-multilib g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 > sudo ln -s /usr/lib/i386-linux- gnu/mesa/libGL.so.1 /usr/lib/i386-linux- gnu/libGL.so > sudo apt-get install python-software-properties > sudo add-apt-repository ppa:webupd8team/java > sudo apt-get update > sudo apt-get install oracle-java6-installer
  • 8. [2] Build Environment for 5.x > sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5- dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev gcc-multilib g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 > sudo ln -s /usr/lib/i386-linux- gnu/mesa/libGL.so.1 /usr/lib/i386-linux- gnu/libGL.so > sudo apt-get install openjdk-7-jdk
  • 9. [3] AOSP Environment > cd ~ > mkdir ~/aosp > mkdir ~/aosp/bin > PATH=~/aosp/bin:$PATH > curl https://storage.googleapis.com/git-repo- downloads/repo > ~/aosp/bin/repo > chmod a+x ~/aosp/bin/repo > curl https://storage.googleapis.com/git-repo- downloads/repo > ~/aosp/bin/repo > chmod a+x ~/aosp/bin/repo > git config --global user.email "user@USER" > git config --global user.name "user"
  • 10. [4] Download AOSP > mkdir ~/aosp/src > cd ~/aosp/src > repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.4_r2.0.1 > sudo sysctl -w net.ipv4.tcp_window_scaling=0 # -j(?) means amount of thread(cores) used > repo sync -j1
  • 11. [6] Download Nexus 5 Driver > cd ~/aosp/src > wget https://dl.google.com/dl/android/aosp/broadcom- hammerhead-ktu84p-5a5bf60e.tgz > wget https://dl.google.com/dl/android/aosp/lge- hammerhead-ktu84p-49419c39.tgz > wget https://dl.google.com/dl/android/aosp/qcom- hammerhead-ktu84p-f159eadf.tgz > tar xzvf broadcom-hammerhead-ktu84p-5a5bf60e.tgz > tar xzvf lge-hammerhead-ktu84p-49419c39.tgz > tar xzvf qcom-hammerhead-ktu84p-f159eadf.tgz
  • 12. [7] Import Nexus 5 Driver > cd ~/aosp/src > ./extract-broadcom-hammerhead.sh > ./extract-lge-hammerhead.sh > ./extract-qcom-hammerhead.sh
  • 13. [5] Build AOSP > cd ~/aosp/src > source build/envsetup.sh > lunch aosp_hammerhead-userdebug > make –j1
  • 14. [8] Download Android SDK • Android SDK Platform-tools • SDK Build-tools
  • 15. [9] Flash Image Onto Device > export ANDROID_PRODUCT_OUT=/home/user/aosp/src/out/target /product/hammerhead > fastboot erase boot > fastboot erase cache > fastboot erase recovery > fastboot erase system > fastboot erase userdata > fastboot flash boot boot.img > fastboot flash cache cache.img > fastboot flash recovery recovery.img > fastboot flash system system.img > fastboot flash userdata userdata.img
  • 17. Find Java Base Class Library libcore/luni/src/main/java
  • 18. Find Android Base Class Library frameworks/base/core/java
  • 20. Android Image Modification > source build/envsetup.sh > lunch aosp_hammerhead-userdebug > make update-api > make –j1
  • 21. Android ADB Modification # Build for Windows > sudo apt-get install mingw-w64 > cd ~/aosp/src > make USE_MINGW=yes adb showcommands # Build for Linux > cd ~/aosp/src > make adb showcommands
  • 23. [1] Start... 1. Android developers use "Log.d / Log.e / ..." to read messages. http://developer.android.com/reference/android/ util/Log.html 2. So, monitor "Log.d / Log.e / ..."? No, it's not enough! Why?
  • 24. [2] Base Knowledge 3. Android Architecture Log.d ?
  • 25. [3] View Source Code 4. Android Source Online https://android.googlesource.com 5. Search Android Source Online http://code.metager.de/source/xref/android/4.4/ http://grepcode.com/project/repository.grepcode .com/java/ext/com.google.android/android
  • 26. [4] Where? 6. Search Possible Occurrence
  • 29. [5] Got You! 8. System.java
  • 30. [6] Java – JNI – C++ 9. Java /libcore/luni/src/main/java/java/ JNI /libcore/luni/src/main/native/
  • 31. [7] JNI – C++ 10. java_lang_System.cpp
  • 32. [8] Modify... 11. Patch java_lang_System.cpp
  • 33. [8] Modify... 11. Patch java_lang_System.cpp ADD
  • 34. [8] Modify... 11. Patch java_lang_System.cpp ADD
  • 35. [8] Modify... 11. Patch java_lang_System.cpp MODIFY MODIFY
  • 36. [8] Modify... 11. Patch java_lang_System.cpp
  • 37. [9] Modify... 12. Patch System.java
  • 38. [9] Modify... 12. Patch System.java ADD ADD
  • 39. [9] Modify... 12. Patch System.java Create Customized Function: appsandbox(String) ADD
  • 40. [10] Output > adb logcat –v long appsandbox:V *:S > adb.log # appsandbox:V means "Verbose for Tag:appsandbox“ # *:S means "Silence for Other Tags"
  • 42. First
  • 43. PID
  • 44. [1] Why I Need PID? 1. When you try to get package, you get the package name where your called. It's not package name of app! com.td.bookshelf.provider com.td.bookshelf
  • 45. [2] Get PID 2. import android.os.Process; /frameworks/base/core/java/android/os/Process.j ava
  • 46. [2] Get PID 3. Process.myPid();
  • 47. [2] Get PID 3. Process.myPid();
  • 48. [3] Application 4. import android.app.Application; /frameworks/base/core/java/android/app/Applicat ion.java
  • 49. [3] Inject Code 5. Monitor onCreate()
  • 50. [3] Inject Code 6. Monitor onTerminate()
  • 53. [1] Find Base Class 1. import java.io.InputStream; /libcore/luni/src/main/java/java/io/InputStream .java 2. import java.io.OutputStream; /libcore/luni/src/main/java/java/io/OutputStrea m.java
  • 54. [2] What Is Necessary? 3. Monitor InputStream
  • 55. [2] What Is Necessary? 4. Monitor OutputStream
  • 56. Third
  • 58. [1] Find Base Class 1. import java.net.URL; /libcore/luni/src/main/java/java/net/URL.java 2. import java.net.URI; /libcore/luni/src/main/java/java/net/URI.java
  • 59. [2] What Is Necessary? 3. Monitor URL Hook Constructor
  • 60. [2] What Is Necessary? 3. Monitor URL Hook Constructor
  • 61. [2] What Is Necessary? 4. Monitor URI Hook Constructor
  • 62. Demo