Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Slyrith authored Sep 7, 2022
0 parents commit 9a40009
Show file tree
Hide file tree
Showing 66 changed files with 1,788 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# PAD (Process Android Dumper)
This dumper is made for il2cpp game but you can use it in any app you want

## How To Use
- Run the process
- Open PADumper
- Put process name manually or you can click `Select Apps` to select running apps
- Put the ELF Name or you can leave it with default name `libil2cpp.so`
- Check `global-metadata.dat` if you want dump unity metadata from memory
- Dump and wait process to finish
- Result will be in `/sdcard/PADumper/[Process]/[startAddress-nameFile]`

## Credits
- [libsu](https://github.com/topjohnwu/libsu)
77 changes: 77 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
}

android {
compileSdk 32
namespace "com.dumper.android"

defaultConfig {
applicationId "com.dumper.android"
minSdk 21
targetSdk 32
versionCode 2
versionName "2.0.6"
}

signingConfigs {
debug {
storeFile file("keystore.jks")
keyAlias "PADumper"
storePassword "012345"
keyPassword "012345"
}
release {
storeFile file("keystore.jks")
keyAlias "PADumper"
storePassword "012345"
keyPassword "012345"
}
}

buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
viewBinding true
}

kotlinOptions {
jvmTarget = '1.8'
}

}

dependencies {
//Ui
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
implementation "com.google.android.material:material:1.6.1"
implementation "com.afollestad.material-dialogs:core:3.3.0"

//Root
def libsuVersion = '5.0.2'
implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:service:${libsuVersion}"
}
Binary file added app/keystore.jks
Binary file not shown.
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
23 changes: 23 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".core.App"
android:roundIcon="@mipmap/ic_launcher_round"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:theme="@style/Theme.PADumper.NoActionBar">
<activity
android:name=".core.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".core.MainActivity" />
</application>

</manifest>
Binary file added app/src/main/assets/SoFixer/SoFixer32
Binary file not shown.
Binary file added app/src/main/assets/SoFixer/SoFixer64
Binary file not shown.
18 changes: 18 additions & 0 deletions app/src/main/java/com/dumper/android/core/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.dumper.android.core

import android.app.Application
import android.content.Context
import com.dumper.android.BuildConfig
import com.topjohnwu.superuser.Shell

class App : Application() {
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)

Shell.enableVerboseLogging = BuildConfig.DEBUG
Shell.setDefaultBuilder(
Shell.Builder.create().setFlags(Shell.FLAG_MOUNT_MASTER)
)
}

}
128 changes: 128 additions & 0 deletions app/src/main/java/com/dumper/android/core/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package com.dumper.android.core

import android.content.Intent
import android.content.Intent.ACTION_VIEW
import android.net.Uri
import android.os.*
import android.view.Menu
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.commit
import com.dumper.android.R
import com.dumper.android.core.RootServices.Companion.IS_FIX_NAME
import com.dumper.android.core.RootServices.Companion.IS_FLAG_CHECK
import com.dumper.android.core.RootServices.Companion.LIBRARY_DIR_NAME
import com.dumper.android.core.RootServices.Companion.LIST_FILE
import com.dumper.android.core.RootServices.Companion.MSG_DUMP_PROCESS
import com.dumper.android.core.RootServices.Companion.MSG_GET_PROCESS_LIST
import com.dumper.android.core.RootServices.Companion.PROCESS_NAME
import com.dumper.android.databinding.ActivityMainBinding
import com.dumper.android.dumper.Fixer
import com.dumper.android.messager.MSGConnection
import com.dumper.android.messager.MSGReceiver
import com.dumper.android.ui.ConsoleFragment
import com.dumper.android.ui.MemoryFragment
import com.dumper.android.ui.viewmodel.ConsoleViewModel
import com.dumper.android.ui.viewmodel.MainViewModel
import com.topjohnwu.superuser.ipc.RootService

class MainActivity : AppCompatActivity() {
private lateinit var mainBind: ActivityMainBinding
val mainVm: MainViewModel by viewModels()
val console: ConsoleViewModel by viewModels()

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
super.onCreateOptionsMenu(menu)
menuInflater.inflate(R.menu.appbar_menu, menu)
return true
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mainBind = ActivityMainBinding.inflate(layoutInflater)
initService()

with(mainBind) {
setContentView(root)
setSupportActionBar(toolbar)

if (savedInstanceState == null) {
supportFragmentManager
.beginTransaction()
.add(R.id.contentContainer, MemoryFragment.instance)
.commit()
}


bottomBar.setOnItemSelectedListener {
supportFragmentManager.commit {
setCustomAnimations(
R.anim.fade_in,
R.anim.fade_out,
R.anim.fade_in,
R.anim.fade_out
)
replace(
R.id.contentContainer,
when (it.itemId) {
R.id.action_memory -> MemoryFragment.instance
R.id.action_console -> ConsoleFragment.instance
else -> throw IllegalArgumentException("Unknown item selected")
}, null
)
}
true
}

toolbar.setOnMenuItemClickListener {
if (it.itemId == R.id.github) {
startActivity(
Intent(
ACTION_VIEW,
Uri.parse("https://github.com/BryanGIG/PADumper")
)
)
}
true
}
}
}

private fun initService() {
Fixer.extractLibs(this)
if (mainVm.remoteMessenger == null) {
mainVm.dumperConnection = MSGConnection(this)
val intent = Intent(this, RootServices::class.java)
RootService.bind(intent, mainVm.dumperConnection)
mainVm.receiver = Messenger(Looper.myLooper()?.let { Handler(it, MSGReceiver(this)) })
}
}

fun sendRequestAllProcess() {
val message = Message.obtain(null, MSG_GET_PROCESS_LIST)
message.replyTo = mainVm.receiver
mainVm.remoteMessenger?.send(message)
}

fun sendRequestDump(process: String, dump_file: Array<String>, autoFix: Boolean, flagCheck: Boolean) {
val message = Message.obtain(null, MSG_DUMP_PROCESS)

message.data.apply {
putString(PROCESS_NAME, process)
putStringArray(LIST_FILE, dump_file)
putBoolean(IS_FLAG_CHECK, flagCheck)
if (autoFix) {
putBoolean(IS_FIX_NAME, true)
putString(LIBRARY_DIR_NAME, "${filesDir.path}/SoFixer")
}
}

message.replyTo = mainVm.receiver
mainVm.remoteMessenger?.send(message)
}

override fun onDestroy() {
super.onDestroy()
RootService.unbind(mainVm.dumperConnection)
}
}
78 changes: 78 additions & 0 deletions app/src/main/java/com/dumper/android/core/RootServices.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.dumper.android.core

import android.content.Intent
import android.os.*
import android.util.Log
import com.dumper.android.dumper.Dumper
import com.dumper.android.dumper.process.Process
import com.dumper.android.utils.TAG
import com.topjohnwu.superuser.ipc.RootService


class RootServices : RootService(), Handler.Callback {
override fun onBind(intent: Intent): IBinder {
val h = Handler(Looper.getMainLooper(), this)
val m = Messenger(h)
return m.binder
}

override fun handleMessage(msg: Message): Boolean {
val reply = Message.obtain()
val data = Bundle()

when (msg.what) {
MSG_GET_PROCESS_LIST -> {
val process = Process(this).getAllProcess()
reply.what = MSG_GET_PROCESS_LIST
data.putParcelableArrayList(LIST_ALL_PROCESS, process)
}

MSG_DUMP_PROCESS -> {
val requestData = msg.data
reply.what = MSG_DUMP_PROCESS
val logOutput = StringBuilder()
val process = requestData.getString(PROCESS_NAME)
val listFile = requestData.getStringArray(LIST_FILE)
val isFlagCheck = requestData.getBoolean(IS_FLAG_CHECK)
val isAutoFix = requestData.getBoolean(IS_FIX_NAME, false)
if (process != null && listFile != null) {
val dumper = Dumper(process)
for (file in listFile) {
dumper.file = file
logOutput.appendLine(dumper.dumpFile(isAutoFix, isFlagCheck))
}
data.putString(DUMP_LOG, logOutput.toString())
} else {
data.putString(DUMP_LOG, "[ERROR] Data Error!")
}
}
else -> {
data.putString(DUMP_LOG, "[ERROR] Unknown command")
}
}

reply.data = data
try {
msg.replyTo.send(reply)
} catch (e: RemoteException) {
Log.e(TAG, "Remote error", e)
}
return false
}

override fun onUnbind(intent: Intent): Boolean {
return false
}

companion object {
const val MSG_DUMP_PROCESS = 1
const val MSG_GET_PROCESS_LIST = 2
const val DUMP_LOG = "DUMP_LOG"
const val LIBRARY_DIR_NAME = "NATIVE_DIR"
const val LIST_ALL_PROCESS = "LIST_ALL_PROCESS"
const val PROCESS_NAME = "PROCESS"
const val LIST_FILE = "LIST_FILE"
const val IS_FLAG_CHECK = "IS_FLAG_CHECK"
const val IS_FIX_NAME = "FIX_ELF"
}
}
Loading

0 comments on commit 9a40009

Please sign in to comment.