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
0b10e0b9
Commit
0b10e0b9
authored
Oct 25, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
f8965fef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
46 deletions
+70
-46
python/main.py
+16
-14
python/tools/garble/api_garble.py
+2
-32
python/tools/garble/string_garble.py
+52
-0
No files found.
python/main.py
View file @
0b10e0b9
# -*-coding:utf-8-*-
from
func
import
Function
from
shell
import
Shell
from
tools
.
garble
.
garble
import
Garble
from
tools
.
garble
.
api_garble
import
Api
Garble
from
tools
.
garble
.
activity_garble
import
ActivityGarble
from
tools.garble.string_garble
import
StringGarble
from
tools
.
garble
.
package_garble
import
PackageGarble
from
tools
.
garble
.
manifest_grable
import
ManifestGarble
from
tools.sdk_manager
import
SdkManager
...
...
@@ -14,7 +15,8 @@ config = Function().load_properties("../../gradle.properties")
config
[
'root'
]
=
"../.."
config
[
'jks_path'
]
=
"../../jks"
config
[
'properties'
]
=
"../../gradle.properties"
config
[
'apk_path'
]
=
"../../resGuardApks/
%
s_
%
s_release.apk"
%
(
config
[
"corp_id"
],
config
[
"app_name"
]
.
replace
(
" "
,
"_"
))
config
[
'apk_path'
]
=
"../../resGuardApks/
%
s_
%
s_release.apk"
%
(
config
[
"corp_id"
],
config
[
"app_name"
]
.
replace
(
" "
,
"_"
))
config
[
'jiagu_output'
]
=
"/Users/connor/Documents/apks"
config
[
'jiagu_account'
]
=
"15902141504"
config
[
'jiagu_pwd'
]
=
"qwqw10010"
...
...
@@ -51,30 +53,30 @@ command = int(input("请输入指令编号:"))
# 命令
if
command
==
1
:
#注释通话记录代码
#
注释通话记录代码
SdkManager
()
.
start_process
(
config
,
False
,
"NOLOG"
)
#注释/开启 通讯录代码
#
注释/开启 通讯录代码
if
config
[
'contact'
]
==
"true"
:
SdkManager
()
.
start_process
(
config
,
True
,
"CONTACT"
)
else
:
SdkManager
()
.
start_process
(
config
,
False
,
"CONTACT"
)
#api混淆
Garble
()
.
api_garble
(
config
)
#字符串混淆
Garble
()
.
str_grable
(
config
)
#四大组件类名混淆
#
api混淆
Api
Garble
()
.
api_garble
(
config
)
#
字符串混淆
String
Garble
()
.
str_grable
(
config
)
#
四大组件类名混淆
ActivityGarble
()
.
activity_garble
(
config
)
#包路径混淆
#
包路径混淆
PackageGarble
()
.
pkg_garble
(
config
)
#Manifest混淆
#
Manifest混淆
ManifestGarble
()
.
manifest_garble
(
config
)
#旧版脚本编译(待转移)
#
旧版脚本编译(待转移)
Shell
()
.
build_release
(
config
)
Shell
()
.
reset_project
(
config
)
elif
command
==
2
:
Function
()
.
new_appid
(
config
)
elif
command
==
3
:
Function
()
.
new_keystore
(
config
)
...
...
python/tools/garble/garble.py
→
python/tools/garble/
api_
garble.py
View file @
0b10e0b9
...
...
@@ -4,7 +4,7 @@ import string
import
random
import
base64
class
Garble
:
class
Api
Garble
:
#api混淆
def
__rename_api
(
self
,
path
,
config
):
with
open
(
"
%
s/script/api_mapping"
%
config
[
'root'
],
"r"
,
encoding
=
"utf-8"
)
as
f
:
...
...
@@ -58,35 +58,5 @@ class Garble:
self
.
__rename_api
(
path
,
config
)
#字符串混淆
def
__string_grable
(
self
,
path
):
with
open
(
path
,
"r"
)
as
f
:
lines
=
f
.
readlines
()
with
open
(
path
,
"w"
)
as
f_w
:
for
line
in
lines
:
if
"<string"
in
line
and
"</string>
\n
"
in
line
and
"<!"
not
in
line
:
if
"*keep*"
not
in
line
:
line
=
line
.
replace
(
"</string>
\n
"
,
""
)
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_value
=
line
.
split
(
">"
)[
1
]
number
=
""
for
i
in
range
(
0
,
random
.
randint
(
2
,
15
)):
number
+=
str
(
random
.
randint
(
0
,
9
))
randStr
=
str
(
number
)
+
"#-#"
grable_str
=
str
(
base64
.
b64encode
((
randStr
+
str_value
)
.
encode
(
"utf-8"
)),
"utf-8"
)
line
=
str_name
+
randStr
+
grable_str
+
"</string>
\n
"
f_w
.
write
(
line
)
print
(
"done
\n
"
)
return
def
str_grable
(
self
,
config
):
for
root
,
dirs
,
files
in
os
.
walk
(
"
%
s/lib_base/src/main/res"
%
config
[
'root'
]):
directory
=
os
.
path
.
join
(
os
.
getcwd
(),
root
)
for
file
in
files
:
if
file
.
endswith
(
"strings.xml"
):
# get the path of the java file
path
=
os
.
path
.
join
(
directory
,
file
)
self
.
__string_grable
(
path
)
python/tools/garble/string_garble.py
0 → 100644
View file @
0b10e0b9
# -*-coding:utf-8-*-
import
glob
,
os
import
string
import
random
import
base64
class
StringGarble
:
#字符串混淆
def
__string_garble
(
self
,
path
):
with
open
(
path
,
"r"
)
as
f
:
lines
=
f
.
readlines
()
with
open
(
path
,
"w"
)
as
f_w
:
for
line
in
lines
:
if
"<string"
in
line
and
"</string>
\n
"
in
line
and
"<!"
not
in
line
:
if
"*keep*"
not
in
line
:
line
=
line
.
replace
(
"</string>
\n
"
,
""
)
str_name
=
line
.
split
(
">"
)[
0
]
+
">"
str_value
=
line
.
split
(
">"
)[
1
]
number
=
""
for
i
in
range
(
0
,
random
.
randint
(
2
,
15
)):
number
+=
str
(
random
.
randint
(
0
,
9
))
randStr
=
str
(
number
)
+
"#-#"
grable_str
=
str
(
base64
.
b64encode
((
randStr
+
str_value
)
.
encode
(
"utf-8"
)),
"utf-8"
)
line
=
str_name
+
randStr
+
grable_str
+
"</string>
\n
"
f_w
.
write
(
line
)
return
#随机插入字符串
def
__insert_strings
(
self
,
path
):
with
open
(
path
,
"r"
)
as
f
:
fileContent
=
f
.
read
()
strings
=
""
for
i
in
range
(
0
,
random
.
randint
(
100
,
500
)):
strings
+=
"
%
s
\n
"
%
''
.
join
(
random
.
sample
(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
,
random
.
randint
(
5
,
100
)))
with
open
(
path
,
"w"
)
as
f_w
:
fileContent
=
fileContent
.
replace
(
"</resources>"
,
"
%
s
\n
</resources>"
%
strings
)
f_w
.
write
(
fileContent
)
def
str_grable
(
self
,
config
):
for
root
,
dirs
,
files
in
os
.
walk
(
"
%
s/lib_base/src/main/res"
%
config
[
'root'
]):
directory
=
os
.
path
.
join
(
os
.
getcwd
(),
root
)
for
file
in
files
:
if
file
.
endswith
(
"strings.xml"
):
# get the path of the java file
path
=
os
.
path
.
join
(
directory
,
file
)
self
.
__string_garble
(
path
)
self
.
__insert_strings
(
path
)
\ No newline at end of file
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