Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openthos
linux-android-analysis
提交
f15956ff
L
linux-android-analysis
项目概览
openthos
/
linux-android-analysis
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux-android-analysis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f15956ff
编写于
4月 27, 2016
作者:
C
chenyizhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add deptool
上级
5d6bc896
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
140 addition
and
0 deletion
+140
-0
related_info/dep_tool/README
related_info/dep_tool/README
+3
-0
related_info/dep_tool/deptool.py
related_info/dep_tool/deptool.py
+137
-0
未找到文件。
related_info/dep_tool/README
0 → 100644
浏览文件 @
f15956ff
这是一个Linux依赖分析系统,通过他可以将Linux不用安装直接以在Android-x86中运行,使用方法
python deptool.py what-app-you-want-to-analysis
执行后会自动生成dep文件夹,也就是依赖包文件,将依赖包以特定的方式放入到目标系统中,可以使应用正常运行
related_info/dep_tool/deptool.py
0 → 100644
浏览文件 @
f15956ff
#! /usr/bin/python
import
sys
import
os
def
copy
(
name
):
os
.
system
(
'cp --parents -d '
+
name
+
' .'
)
def
ll
(
name
):
tmp
=
os
.
popen
(
'ls -l '
+
name
).
read
().
strip
()
return
tmp
allcopy
=
[]
cmd
=
''
print
"Start to analysis"
,
sys
.
argv
[
1
]
os
.
system
(
'mkdir dep'
)
os
.
chdir
(
'./dep'
)
for
i
in
range
(
1
,
len
(
sys
.
argv
)):
cmd
+=
' '
+
sys
.
argv
[
i
]
cmd_search
=
'which '
+
sys
.
argv
[
1
]
#print cmd_search
result
=
os
.
popen
(
cmd_search
).
read
().
strip
()
print
"cmd path is"
,
result
if
result
==
''
:
print
"The input is wrong ,please restart"
quit
()
os
.
system
(
'strace -e trace=open,execve '
+
cmd
+
' 2>log 1>/dev/null'
)
f
=
open
(
"log"
,
"r"
)
while
True
:
line
=
f
.
readline
()
if
line
.
startswith
(
"open"
)
or
line
.
startswith
(
"exec"
)
:
#print line
if
line
.
find
(
"/proc"
)
<
0
and
line
.
find
(
"/dev"
)
<
0
:
dep_file
=
line
.
split
(
'"'
)[
1
]
#print line
copy
(
dep_file
)
allcopy
.
append
(
dep_file
)
if_sym
=
ll
(
dep_file
).
split
(
' -> '
)
while
len
(
if_sym
)
>
1
:
if
if_sym
[
1
].
startswith
(
"/"
):
copy
(
if_sym
[
1
])
tmp_sym
=
if_sym
[
0
].
split
(
' '
)[
-
1
]
#print tmp_sym
#print if_sym[1]
relpath
=
os
.
path
.
relpath
(
if_sym
[
1
],
tmp_sym
)[
2
:]
#print relpath
os
.
system
(
'ln -s '
+
relpath
+
' .'
+
dep_file
)
allcopy
.
append
(
if_sym
[
1
])
if_sym
=
ll
(
if_sym
[
1
]).
split
(
' -> '
)
else
:
all_path
=
os
.
path
.
dirname
(
dep_file
)
+
'/'
+
if_sym
[
1
]
copy
(
all_path
)
allcopy
.
append
(
all_path
)
if_sym
=
ll
(
all_path
).
split
(
' -> '
)
else
:
break
f
.
close
()
copyname
=
[]
for
i
in
allcopy
:
tmp_name
=
i
.
split
(
'/'
)[
-
1
]
# print tmp_name
copyname
.
append
(
tmp_name
)
for
i
in
allcopy
:
ifelf
=
os
.
popen
(
'file '
+
i
).
read
().
strip
()
if
'ELF'
in
ifelf
:
# print i
filestrings
=
os
.
popen
(
'strings '
+
i
+
' | grep "\.so"'
).
read
().
strip
().
split
(
'
\n
'
)
for
j
in
filestrings
:
if
j
not
in
copyname
and
' '
not
in
j
and
'%'
not
in
j
:
if
j
.
startswith
(
"/"
):
name_j
=
j
.
split
(
'/'
)[
-
1
]
if
name_j
not
in
copyname
:
copyname
.
append
(
name_j
)
copy
(
j
)
if_sym
=
ll
(
j
).
split
(
' -> '
)
while
len
(
if_sym
)
>
1
:
if
if_sym
[
1
].
startswith
(
"/"
):
copy
(
if_sym
[
1
])
tmp_sym
=
if_sym
[
0
].
split
(
' '
)[
-
1
]
print
tmp_sym
print
if_sym
[
1
]
relpath
=
os
.
path
.
relpath
(
if_sym
[
1
],
tmp_sym
)[
2
:]
print
relpath
os
.
system
(
'ln -sf '
+
relpath
+
' .'
+
j
)
copyname
.
append
(
if_sym
[
1
].
split
(
'/'
)[
-
1
])
if_sym
=
ll
(
if_sym
[
1
]).
split
(
' -> '
)
else
:
all_path
=
os
.
path
.
dirname
(
j
)
+
'/'
+
if_sym
[
1
]
copy
(
all_path
)
copyname
.
append
(
if_sym
[
1
])
if_sym
=
ll
(
all_path
).
split
(
' -> '
)
# print name_j
else
:
copyname
.
append
(
j
)
nameabspath
=
os
.
popen
(
'locate '
+
j
+
'| grep -v home'
).
read
().
strip
()
#print j
print
nameabspath
copy
(
nameabspath
)
if_sym
=
ll
(
nameabspath
).
split
(
' -> '
)
while
len
(
if_sym
)
>
1
:
if
if_sym
[
1
].
startswith
(
"/"
):
copy
(
if_sym
[
1
])
tmp_sym
=
if_sym
[
0
].
split
(
' '
)[
-
1
]
print
tmp_sym
print
if_sym
[
1
]
relpath
=
os
.
path
.
relpath
(
if_sym
[
1
],
tmp_sym
)[
2
:]
print
relpath
os
.
system
(
'ln -sf '
+
relpath
+
' .'
+
nameabspath
)
copyname
.
append
(
if_sym
[
1
].
split
(
'/'
)[
-
1
])
if_sym
=
ll
(
if_sym
[
1
]).
split
(
' -> '
)
else
:
all_path
=
os
.
path
.
dirname
(
nameabspath
)
+
'/'
+
if_sym
[
1
]
copy
(
all_path
)
copyname
.
append
(
if_sym
[
1
])
if_sym
=
ll
(
all_path
).
split
(
' -> '
)
else
:
continue
print
copyname
print
allcopy
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录