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
66d929ef
Commit
66d929ef
authored
Oct 19, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
3abc4ae7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
python/main.py
+4
-0
python/tools/garble.py
+40
-8
No files found.
python/main.py
View file @
66d929ef
...
...
@@ -30,6 +30,7 @@ print("13、打印checklist")
print
(
"14、生成隐协议文件"
)
print
(
"15、刷新本地协议"
)
print
(
"16、api混淆"
)
print
(
"17、字符串混淆"
)
print
(
"21、reset project"
)
command
=
int
(
input
(
"请输入指令编号:"
))
...
...
@@ -84,5 +85,8 @@ elif command == 15:
elif
command
==
16
:
Garble
()
.
api_garble
(
config
)
elif
command
==
17
:
Garble
()
.
str_grable
(
config
)
elif
command
==
21
:
Shell
()
.
reset_project
(
config
)
python/tools/garble.py
View file @
66d929ef
#!/usr/bin/env python3
import
glob
,
os
import
string
import
random
import
base64
class
Garble
:
#api混淆
def
__rename_api
(
self
,
path
,
config
):
with
open
(
"
%
s/script/api_mapping"
%
config
[
'root'
],
"r"
,
encoding
=
"utf-8"
)
as
f
:
...
...
@@ -41,14 +42,45 @@ class Garble:
print
(
path
+
" done
\n
"
)
return
def
api_garble
(
self
,
config
):
#java目录的路径
for
root
,
dirs
,
files
in
os
.
walk
(
"
%
s/src/main"
%
config
[
'root'
]):
dir
=
os
.
path
.
join
(
os
.
getcwd
(),
root
)
for
root
,
dirs
,
files
in
os
.
walk
(
"
%
s/
lib_base/
src/main"
%
config
[
'root'
]):
dir
ectory
=
os
.
path
.
join
(
os
.
getcwd
(),
root
)
for
file
in
files
:
#要检索的文件名
if
file
.
endswith
(
"LoanApi.java"
)
or
file
.
endswith
(
"UploadApi.java"
)
or
file
.
endswith
(
"UserApi.java"
):
# get the path of the java file
path
=
os
.
path
.
join
(
dir
,
file
)
self
.
__rename_api
(
path
,
config
)
\ No newline at end of file
path
=
os
.
path
.
join
(
directory
,
file
)
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
)
+
"#-#"
line
=
str_name
+
randStr
+
base64
.
b64encode
(
randStr
+
str_value
)
+
"</string>
\n
"
f_w
.
write
(
line
)
# print("done\n")
return
def
str_grable
(
self
,
config
):
for
root
,
dirs
,
files
in
os
.
walk
(
"
%
s/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
)
\ 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