Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
0ee499af
Commit
0ee499af
authored
Oct 25, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c4a19aa1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
22 deletions
+33
-22
python/config.json
+9
-5
python/help.py
+9
-2
python/tools/garble/package_garble.py
+15
-14
src/main/AndroidManifest.xml
+0
-1
No files found.
python/config.json
View file @
0ee499af
...
...
@@ -5,17 +5,21 @@
"//properties"
:
"gradle.properties路径"
,
"properties"
:
"../../gradle.properties"
,
"//lib_main"
:
"所有加入混淆的library main目录
,
'root' 下的相对路径"
,
"//lib_main"
:
"所有加入混淆的library main目录
.
'root' 下的相对路径"
,
"lib_main"
:[
"app/src/main"
,
"lib_base/src/main"
"lib_base/src/main"
,
"cash_plugin_toolbox/src/main"
],
"//api_mapping"
:
"api混淆文件的路径
:
'root' 下的相对路径"
,
"//api_mapping"
:
"api混淆文件的路径
.
'root' 下的相对路径"
,
"api_mapping"
:
"script/api_mapping"
,
"//"
:
""
,
""
:
""
,
"//proguard"
:
"所有用到的proguard-rules.pro 路径"
,
"proguard"
:[
"app/proguard-rules.pro"
,
"lib_base/proguard-rules.pro"
],
"//"
:
""
,
""
:
""
,
...
...
python/help.py
View file @
0ee499af
...
...
@@ -2,6 +2,7 @@ import json
from
tools.garble.activity_garble
import
ActivityGarble
from
tools.garble.api_garble
import
ApiGarble
from
tools.garble.manifest_grable
import
ManifestGarble
from
tools.garble.package_garble
import
PackageGarble
from
func
import
Function
...
...
@@ -20,6 +21,7 @@ print("使用帮助")
print
(
"1、activity类名混淆"
)
print
(
"2、api混淆(针对 Retrofit 注解)"
)
print
(
"3、manifest混淆 在包路径中随机插入Activity并注册"
)
print
(
"4、包路径混淆"
)
print
(
" "
)
command
=
int
(
input
(
"请输入指令编号:"
))
...
...
@@ -33,4 +35,10 @@ elif command == 2:
elif
command
==
3
:
#注意: src/main/java 目录下,只能是目录,不可以有文件
ManifestGarble
()
.
manifest_garble
(
config
)
\ No newline at end of file
# 如果使用了 cash_plugin_toolbox ,需要更新一下,确保 Manifest 中有 <application> 标签
ManifestGarble
()
.
manifest_garble
(
config
)
elif
command
==
4
:
#所有library src/main/java 下的包名混淆
PackageGarble
()
.
pkg_garble
(
config
)
python/tools/garble/package_garble.py
View file @
0ee499af
...
...
@@ -109,13 +109,12 @@ class PackageGarble:
self
.
__process_file_content
(
os
.
path
.
join
(
directory
,
file
),
file
)
#
四大组件
混淆
#
包路径
混淆
def
pkg_garble
(
self
,
config
):
print
(
"find pkgs..."
)
#生成混淆字典
self
.
__find_pkgs
(
"
%
s/app/src/main/java"
%
config
[
'root'
])
self
.
__find_pkgs
(
"
%
s/lib_base/src/main/java"
%
config
[
'root'
])
self
.
__find_pkgs
(
"
%
s/cash_plugin_toolbox/src/main/java"
%
config
[
'root'
])
for
main_dir
in
config
[
'lib_main'
]:
self
.
__find_pkgs
(
"
%
s/
%
s/java"
%
(
config
[
'root'
],
main_dir
))
# keys = sorted(self.pkg_mapping.keys(),
# key=lambda i: len(i.split(".")), reverse=True)
...
...
@@ -123,23 +122,25 @@ class PackageGarble:
# print(key+" -> " + self.pkg_mapping[key])
#重命名路径
self
.
__rename_pkg
(
"
%
s/app/src/main/java"
%
config
[
'root'
])
self
.
__rename_pkg
(
"
%
s/lib_base/src/main/java"
%
config
[
'root'
])
self
.
__rename_pkg
(
"
%
s/cash_plugin_toolbox/src/main/java"
%
config
[
'root'
])
for
main_dir
in
config
[
'lib_main'
]:
self
.
__rename_pkg
(
"
%
s/
%
s/java"
%
(
config
[
'root'
],
main_dir
))
#忽略3级以下路径(例如com com.common),避免干扰到三方SDK
for
(
key
,
value
)
in
self
.
pkg_mapping
.
items
():
path_level
=
len
(
key
.
split
(
"."
))
if
path_level
<
3
and
not
key
.
startswith
(
"tech.starwin"
):
#com. cn. 开头的二级包名不混淆,避免干扰到三方SDK
if
path_level
<=
2
and
(
key
.
startswith
(
"com."
)
or
key
.
startswith
(
"cn."
)):
self
.
pkg_mapping
[
key
]
=
key
#单个一级包名,干扰太多,不混淆
elif
path_level
<=
1
:
self
.
pkg_mapping
[
key
]
=
key
#全局替换
self
.
__process_files
(
"
%
s/app/proguard-rules.pro"
%
config
[
'root'
])
self
.
__process_files
(
"
%
s/lib_base/proguard-rules.pro"
%
config
[
'root'
]
)
self
.
__process_files
(
"
%
s/app/src/main"
%
config
[
'root'
])
self
.
__process_files
(
"
%
s/lib_base/src/main"
%
config
[
'root'
])
self
.
__process_files
(
"
%
s/cash_plugin_toolbox/src/main"
%
config
[
'root'
]
)
for
proguard
in
config
[
'proguard'
]:
self
.
__process_files
(
"
%
s/
%
s"
%
(
config
[
'root'
],
proguard
)
)
for
main_dir
in
config
[
'lib_main'
]:
self
.
__process_files
(
"
%
s/
%
s/main"
%
(
config
[
'root'
],
main_dir
)
)
print
(
"done"
)
...
...
src/main/AndroidManifest.xml
View file @
0ee499af
...
...
@@ -77,7 +77,6 @@
android:name=
"design_height_in_dp"
android:value=
"640"
/>
Facebook AccountKit
<meta-data
android:name=
"com.facebook.accountkit.ApplicationName"
android:value=
"@string/app_name_str"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment