1+ #! /bin/bash
2+ # ----------------------------------------------------------------------
3+ # author : Android 轮子哥
4+ # github : https://github.com/getActivity/AndroidCmdTools
5+ # time : 2026/02/28
6+ # desc : 资源管理器脚本
7+ # ----------------------------------------------------------------------
8+ source " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /../common/SystemPlatform.sh" || source " ../common/SystemPlatform.sh"
9+ source " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /../common/FileTools.sh" || source " ../common/FileTools.sh"
10+
11+ getDexToJarShellDirPath () {
12+ local resourcesDirPath=$( getResourcesDirPath)
13+ echo " ${resourcesDirPath} $( getFileSeparator) dex2jar-2.4$( getFileSeparator) d2j-dex2jar.sh"
14+ }
15+
16+ getDexToJarShellFilePath () {
17+ local resourcesDirPath=$( getResourcesDirPath)
18+ echo " ${resourcesDirPath} $( getFileSeparator) dex2jar-2.4$( getFileSeparator) d2j-dex2jar.sh"
19+ }
20+
21+ getJarToDexShellDirPath () {
22+ local resourcesDirPath=$( getResourcesDirPath)
23+ echo " ${resourcesDirPath} $( getFileSeparator) dex2jar-2.4$( getFileSeparator) d2j-jar2dex.sh"
24+ }
25+
26+ getJarToDexShellFilePath () {
27+ local resourcesDirPath=$( getResourcesDirPath)
28+ echo " ${resourcesDirPath} $( getFileSeparator) dex2jar-2.4$( getFileSeparator) d2j-jar2dex.sh"
29+ }
30+ getJadxShellFilePath () {
31+ local resourcesDirPath=$( getResourcesDirPath)
32+ local fileSeparator=$( getFileSeparator)
33+ local jadxVersion=" 1.5.3"
34+ local jadxDirPath=" ${resourcesDirPath}${fileSeparator} jadx-${jadxVersion} "
35+
36+ local outputPrint
37+ local exitCode
38+ if [[ ! -d " ${jadxDirPath} " ]]; then
39+ zipFileName=" jadx-${jadxVersion} .zip"
40+ decompressedDirPath=" ${resourcesDirPath}${fileSeparator} jadx-${jadxVersion} "
41+ zipUrl=" https://github.com/skylot/jadx/releases/download/v${jadxVersion} /${zipFileName} "
42+ zipFilePath=" ${resourcesDirPath}${fileSeparator}${zipFileName} "
43+ expectedSha256=" 8280f3799c0273fe797a2bcd90258c943e451fd195f13d05400de5e6451d15ec"
44+ if [[ -f " ${zipFilePath} " ]]; then
45+ actualSha256=$( getFileSha256 " ${zipFilePath} " )
46+ if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
47+ rm -f " ${zipFilePath} "
48+ fi
49+ fi
50+ if [[ -f " ${zipFilePath} " ]]; then
51+ outputPrint=" $( unzip -q -o " ${zipFilePath} " -d " ${decompressedDirPath} " 2>&1 ) "
52+ exitCode=$?
53+ if (( exitCode != 0 )) ; then
54+ echo " ❌ ${zipFileName} 解压失败,原因如下:"
55+ echo " ${outputPrint} "
56+ kill -SIGTERM $$
57+ exit 1
58+ fi
59+ else
60+ echo " ⏳ 检测到本地还未下载 jadx,开始下载 ${zipFileName} 文件,体积较大请耐心等待..."
61+ curl -L --progress-bar -o " ${zipFilePath} " " ${zipUrl} "
62+ exitCode=$?
63+ if (( exitCode != 0 )) ; then
64+ echo " ❌ ${zipFileName} 下载失败,请检查网络或稍后重试"
65+ kill -SIGTERM $$
66+ exit 1
67+ fi
68+ actualSha256=$( getFileSha256 " ${zipFilePath} " )
69+ if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
70+ rm -f " ${zipFilePath} "
71+ echo " ❌ ${zipFileName} 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} "
72+ kill -SIGTERM $$
73+ exit 1
74+ fi
75+ outputPrint=" $( unzip -q -o " ${zipFilePath} " -d " ${decompressedDirPath} " 2>&1 ) "
76+ exitCode=$?
77+ if (( exitCode != 0 )) ; then
78+ echo " ❌ ${zipFileName} 解压失败,原因如下:"
79+ echo " ${outputPrint} "
80+ kill -SIGTERM $$
81+ exit 1
82+ fi
83+ fi
84+ rm -f " ${zipFilePath} "
85+ fi
86+
87+ local jadxGuiShellFilePath=" ${jadxDirPath}${fileSeparator} bin${fileSeparator} jadx-gui"
88+ if ! isWindows; then
89+ if [[ ! -x " ${jadxGuiShellFilePath} " ]]; then
90+ chmod +x " ${jadxGuiShellFilePath} "
91+ fi
92+ jadxShellFilePath=" ${jadxDirPath}${fileSeparator} bin${fileSeparator} jadx"
93+ if [[ ! -x " ${jadxShellFilePath} " ]]; then
94+ chmod +x " ${jadxShellFilePath} "
95+ fi
96+ fi
97+ echo " ${jadxGuiShellFilePath} "
98+ }
99+
100+ getJetifierStandaloneShellFilePath () {
101+ local resourcesDirPath=$( getResourcesDirPath)
102+ local fileSeparator=$( getFileSeparator)
103+ local jetifierDirPath=" ${resourcesDirPath}${fileSeparator} jetifier-standalone-20200827"
104+ local shellPath=" ${jetifierDirPath}${fileSeparator} bin${fileSeparator} jetifier-standalone"
105+ if isWindows; then
106+ echo " ${shellPath} .bat"
107+ return
108+ fi
109+ if [[ ! -x " ${shellPath} " ]]; then
110+ chmod +x " ${shellPath} "
111+ fi
112+ echo " ${shellPath} "
113+ }
114+
115+ getADBKeyBoardApkFilePath () {
116+ local resourcesDirPath=$( getResourcesDirPath)
117+ echo " ${resourcesDirPath} $( getFileSeparator) ADBKeyBoard-5.0.apk"
118+ }
119+
120+ getApksignerJarFilePath () {
121+ local resourcesDirPath=$( getResourcesDirPath)
122+ echo " ${resourcesDirPath} $( getFileSeparator) apksigner-36.0.0.jar"
123+ }
124+
125+ getDefaultStoreFilePath () {
126+ local resourcesDirPath=$( getResourcesDirPath)
127+ echo " ${resourcesDirPath} $( getFileSeparator) signatureFile$( getFileSeparator) AppSignature.jks"
128+ }
129+
130+ getApktoolJarFilePath () {
131+ local resourcesDirPath=$( getResourcesDirPath)
132+ echo " ${resourcesDirPath} $( getFileSeparator) apktool-2.12.1.jar"
133+ }
134+
135+ getBaksmaliJarFilePath () {
136+ local resourcesDirPath=$( getResourcesDirPath)
137+ echo " ${resourcesDirPath} $( getFileSeparator) baksmali-2.5.2.jar"
138+ }
139+
140+ getSmaliJarFilePath () {
141+ local resourcesDirPath=$( getResourcesDirPath)
142+ echo " ${resourcesDirPath} $( getFileSeparator) smali-2.5.2.jar"
143+ }
144+
145+ getDiffuserJarFilePath () {
146+ local resourcesDirPath=$( getResourcesDirPath)
147+ echo " ${resourcesDirPath} $( getFileSeparator) diffuse-0.1.0.jar"
148+ }
149+
150+ getJdGuiJarFilePath () {
151+ local resourcesDirPath=$( getResourcesDirPath)
152+ echo " ${resourcesDirPath} $( getFileSeparator) jd-gui-1.6.6.jar"
153+ }
0 commit comments