Skip to content

Commit

Permalink
1.设置新增Hook脱壳的开关
Browse files Browse the repository at this point in the history
  • Loading branch information
wukaicheng committed Jul 4, 2021
1 parent 5d03625 commit 35912dc
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "top.niunaijun.blackdex"
minSdkVersion 21
targetSdkVersion 30
versionCode 4
versionName "3.0.0"
versionCode 5
versionName "3.0.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/top/niunaijun/blackdex/app/BlackDexLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class BlackDexLoader {

private var mFixCodeItem by AppSharedPreferenceDelegate(App.getContext(),false)

private var mHookDump by AppSharedPreferenceDelegate(App.getContext(),true)

private var mDir = if (mSaveEnable) {
getDexDumpDir(App.getContext())
} else {
Expand All @@ -46,6 +48,10 @@ class BlackDexLoader {
override fun isFixCodeItem(): Boolean {
return mFixCodeItem
}

override fun isEnableHookDump(): Boolean {
return mHookDump
}
})
}

Expand Down Expand Up @@ -77,6 +83,15 @@ class BlackDexLoader {
return this.mFixCodeItem
}

fun setHookDump(enable: Boolean){
this.mHookDump = enable
}

fun isHookDump(): Boolean {

return this.mHookDump
}


companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class SettingFragment : PreferenceFragmentCompat() {

private lateinit var fixCodeItemPreference: SwitchPreferenceCompat

private lateinit var hookDumpPreference: SwitchPreferenceCompat

private val initialDirectory = AppManager.mBlackBoxLoader.getSavePath()

override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
Expand All @@ -44,6 +46,10 @@ class SettingFragment : PreferenceFragmentCompat() {
fixCodeItemPreference.onPreferenceChangeListener = mFixCodeItemChange
fixCodeItemPreference.isChecked = AppManager.mBlackBoxLoader.isFixCodeItem()

hookDumpPreference = findPreference("hook_dump")!!
hookDumpPreference.onPreferenceChangeListener = mHookDumpChange
hookDumpPreference.isChecked = AppManager.mBlackBoxLoader.isHookDump()

}

private val mSavedPathClick = Preference.OnPreferenceClickListener {
Expand Down Expand Up @@ -79,6 +85,11 @@ class SettingFragment : PreferenceFragmentCompat() {
return@OnPreferenceChangeListener true
}

private val mHookDumpChange = Preference.OnPreferenceChangeListener { _, newValue ->
AppManager.mBlackBoxLoader.saveEnable(newValue as Boolean)
return@OnPreferenceChangeListener true
}

private val mFixCodeItemChange = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean) {

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-zh/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<string name="fix_code_item_message">开启后将进行深度脱壳,深度脱壳会自主修复被抽取的指令,开启后请注意以下变化。\n\n1.脱壳时间会大幅度上升,预计几分钟都十几分钟不等\n2.脱壳期间有可能会出现应用闪退(遇到反检测等)\n3.会增加脱壳失败几率\n4.不一定能够100%还原
</string>


<string name="hook_dump">Hook脱壳</string>
<string name="hook_dump_desc">使用Hook提高脱壳成功率</string>
<string name="dumping">正在脱壳…</string>

</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@

<string name="classes_progress" translatable="false">classes.dex (%1d/%1d)</string>
<string name="dumping">Unpacking…</string>
<string name="hook_dump_desc">Use hook to improve the success rate of shelling</string>
<string name="hook_dump">Hook Dump</string>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/xml/setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
</PreferenceCategory>

<PreferenceCategory android:title="@string/advanced_setting">
<SwitchPreferenceCompat
android:key="hook_dump"
android:summary="@string/hook_dump_desc"
android:title="@string/hook_dump" />
<SwitchPreferenceCompat
android:key="fix_code_item"
android:summary="@string/fix_code_item_desc"
android:title="@string/fix_code_item" />


</PreferenceCategory>


</PreferenceScreen>

0 comments on commit 35912dc

Please sign in to comment.