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
a771d819
Commit
a771d819
authored
Nov 04, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
a22b00ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
python/help.py
+2
-2
python/tools/garble/manifest_grable.py
+4
-1
python/tools/garble/package_garble.py
+5
-2
No files found.
python/help.py
View file @
a771d819
...
@@ -23,9 +23,9 @@ config.update(properties)
...
@@ -23,9 +23,9 @@ config.update(properties)
print
(
" "
)
print
(
" "
)
print
(
"------------- 使用帮助(混淆完一定要全流程测试) -----------------"
)
print
(
"------------- 使用帮助(混淆完一定要全流程测试) -----------------"
)
print
(
"0、一条龙混淆"
)
print
(
"0、一条龙混淆"
)
print
(
"1、activity类名混淆(
只支持java
)"
)
print
(
"1、activity类名混淆(
支持kotlin,没测试过
)"
)
print
(
"2、api混淆(针对 Retrofit 注解)"
)
print
(
"2、api混淆(针对 Retrofit 注解)"
)
print
(
"3、manifest混淆 在包路径中随机插入Activity并注册
(支持kotlin 但是kotlin的源码必须在src/main/java下)
"
)
print
(
"3、manifest混淆 在包路径中随机插入Activity并注册"
)
print
(
"4、包路径混淆(支持kotlin 但是kotlin的源码必须在src/main/java下)"
)
print
(
"4、包路径混淆(支持kotlin 但是kotlin的源码必须在src/main/java下)"
)
print
(
"5、字符串插入/加密"
)
print
(
"5、字符串插入/加密"
)
print
(
"6、图片混淆(修改md5 & 创建随机图片,体积会增加1-2M)"
)
print
(
"6、图片混淆(修改md5 & 创建随机图片,体积会增加1-2M)"
)
...
...
python/tools/garble/manifest_grable.py
View file @
a771d819
...
@@ -22,6 +22,9 @@ class ManifestGarble:
...
@@ -22,6 +22,9 @@ class ManifestGarble:
act_name
=
self
.
__gen_rand_str
()
act_name
=
self
.
__gen_rand_str
()
act_path
=
"
%
s/
%
s.java"
%
(
root
,
act_name
)
act_path
=
"
%
s/
%
s.java"
%
(
root
,
act_name
)
pkg_name
=
root
.
split
(
"main/java/"
)[
1
]
.
replace
(
"/"
,
"."
)
pkg_name
=
root
.
split
(
"main/java/"
)[
1
]
.
replace
(
"/"
,
"."
)
if
"main/kotlin/"
in
root
:
pkg_name
=
root
.
split
(
"main/kotlin/"
)[
1
]
.
replace
(
"/"
,
"."
)
act_content
=
ClassBuilder
()
.
new_class
(
act_name
,
pkg_name
)
act_content
=
ClassBuilder
()
.
new_class
(
act_name
,
pkg_name
)
with
open
(
act_path
,
"w+"
,
encoding
=
"utf-8"
)
as
fout
:
with
open
(
act_path
,
"w+"
,
encoding
=
"utf-8"
)
as
fout
:
fout
.
write
(
act_content
)
fout
.
write
(
act_content
)
...
@@ -46,7 +49,7 @@ class ManifestGarble:
...
@@ -46,7 +49,7 @@ class ManifestGarble:
def
manifest_garble
(
self
,
config
):
def
manifest_garble
(
self
,
config
):
for
main_dir
in
config
[
'lib_main'
]:
for
main_dir
in
config
[
'lib_main'
]:
print
(
"activity generating ..."
)
print
(
"activity generating ..."
)
activities
=
self
.
__create_activities
(
"
%
s/
%
s
/java
"
%
(
config
[
"root"
],
main_dir
))
activities
=
self
.
__create_activities
(
"
%
s/
%
s"
%
(
config
[
"root"
],
main_dir
))
print
(
"inster activity to manifest ..."
)
print
(
"inster activity to manifest ..."
)
self
.
__insert_to_manifest
(
"
%
s/
%
s/AndroidManifest.xml"
%
(
config
[
"root"
],
main_dir
),
activities
)
self
.
__insert_to_manifest
(
"
%
s/
%
s/AndroidManifest.xml"
%
(
config
[
"root"
],
main_dir
),
activities
)
...
...
python/tools/garble/package_garble.py
View file @
a771d819
...
@@ -41,6 +41,9 @@ class PackageGarble:
...
@@ -41,6 +41,9 @@ class PackageGarble:
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
if
len
(
dirs
)
==
0
:
if
len
(
dirs
)
==
0
:
mp_path
=
root
.
split
(
"main/java/"
)[
1
]
.
replace
(
"/"
,
"."
)
mp_path
=
root
.
split
(
"main/java/"
)[
1
]
.
replace
(
"/"
,
"."
)
if
"main/kotlin"
in
root
:
mp_path
=
root
.
split
(
"main/kotlin/"
)[
1
]
.
replace
(
"/"
,
"."
)
if
mp_path
not
in
self
.
pkg_mapping
.
keys
():
if
mp_path
not
in
self
.
pkg_mapping
.
keys
():
random_str
=
""
random_str
=
""
# 按长度排序
# 按长度排序
...
@@ -114,7 +117,7 @@ class PackageGarble:
...
@@ -114,7 +117,7 @@ class PackageGarble:
print
(
"find pkgs..."
)
print
(
"find pkgs..."
)
#生成混淆字典
#生成混淆字典
for
main_dir
in
config
[
'lib_main'
]:
for
main_dir
in
config
[
'lib_main'
]:
self
.
__find_pkgs
(
"
%
s/
%
s
/java
"
%
(
config
[
'root'
],
main_dir
))
self
.
__find_pkgs
(
"
%
s/
%
s"
%
(
config
[
'root'
],
main_dir
))
# keys = sorted(self.pkg_mapping.keys(),
# keys = sorted(self.pkg_mapping.keys(),
# key=lambda i: len(i.split(".")), reverse=True)
# key=lambda i: len(i.split(".")), reverse=True)
...
@@ -123,7 +126,7 @@ class PackageGarble:
...
@@ -123,7 +126,7 @@ class PackageGarble:
#重命名路径
#重命名路径
for
main_dir
in
config
[
'lib_main'
]:
for
main_dir
in
config
[
'lib_main'
]:
self
.
__rename_pkg
(
"
%
s/
%
s
/java
"
%
(
config
[
'root'
],
main_dir
))
self
.
__rename_pkg
(
"
%
s/
%
s"
%
(
config
[
'root'
],
main_dir
))
for
(
key
,
value
)
in
self
.
pkg_mapping
.
items
():
for
(
key
,
value
)
in
self
.
pkg_mapping
.
items
():
...
...
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