readelf --symbols
,我在Vis
列中获得了Symbol Visibility:Symbol 43s79q,DEFAULT
,INTERNAL
,HIDDEN
。 br /> 这些符号的编码方式如下:
第一个字符:
PROTECTED
表示它们是g
(NASM),它们都是。中间字符:
GLOBAL
表示它们是“函数”,f
表示它们是数据最后一个字符:
d
efault,d
内部,i
idden,h
旋转了。了解如何查看p
显示的可见性。使用readelf --symbols
Symbol table '.symtab' contains 16 entries:
Num: Value Size Type Bind Vis Ndx Name
4: 000000000040007e 0 OBJECT GLOBAL PROTECTED 1 gdp
5: 0000000000400082 0 FUNC GLOBAL HIDDEN 2 gfh
6: 000000000040007a 0 OBJECT GLOBAL INTERNAL 1 gdi
8: 000000000040007c 0 OBJECT GLOBAL HIDDEN 1 gdh
9: 0000000000400083 0 FUNC GLOBAL PROTECTED 2 gfp
11: 0000000000400078 0 OBJECT GLOBAL DEFAULT 1 gdd
14: 0000000000400081 0 FUNC GLOBAL INTERNAL 2 gfi
15: 0000000000400080 0 FUNC GLOBAL DEFAULT 2 gfd
很显然,
fs symbols; f
是函数,而sym
是数据。但是如何获得雷达以显示可见性?#1 楼
afaik,radera2中不提供“符号可见性”。与之最接近的是符号绑定和类型。您可以使用负责显示符号的
is
命令来执行此操作。$ r2 /bin/echo
-- What do you want to debug today?
[0x00401800]> is
[Symbols]
050 0x00007228 0x00607228 GLOBAL OBJ 8 stdout
051 0x00007220 0x00607220 GLOBAL OBJ 8 program_invocation_short_name
052 0x00007230 0x00607230 WEAK OBJ 8 __progname_full
053 0x00007230 0x00607230 GLOBAL OBJ 8 __progname_full
054 0x00007220 0x00607220 WEAK OBJ 8 program_invocation_short_name
055 0x00007240 0x00607240 GLOBAL OBJ 8 stderr
001 0x00001070 0x00401070 GLOBAL FUNC 16 imp.__uflow
002 0x00001080 0x00401080 GLOBAL FUNC 16 imp.getenv
003 0x00001090 0x00401090 GLOBAL FUNC 16 imp.free
...
026 0x00001200 0x00401200 GLOBAL FUNC 16 imp.calloc
027 0x00001210 0x00401210 GLOBAL FUNC 16 imp.strcmp
028 0x00000000 0x00400000 WEAK NOTYPE 16 imp.__gmon_start__
029 0x00001220 0x00401220 GLOBAL FUNC 16 imp.memcpy
...
还可以通过将
j~{}
附加到命令来以格式化的Json格式打印它:[0x00401800]> isj~{}
[
{
"name": "stdout",
"demname": "",
"flagname": "obj.stdout",
"ordinal": 50,
"bind": "GLOBAL",
"size": 8,
"type": "OBJ",
"vaddr": 6320680,
"paddr": 29224
},
{
"name": "program_invocation_short_name",
"demname": "",
"flagname": "obj.program_invocation_short_name",
"ordinal": 51,
"bind": "GLOBAL",
"size": 8,
"type": "OBJ",
"vaddr": 6320672,
"paddr": 29216
},
{
"name": "__progname_full",
"demname": "",
"flagname": "obj.__progname_full",
"ordinal": 52,
"bind": "WEAK",
"size": 8,
"type": "OBJ",
"vaddr": 6320688,
"paddr": 29232
},
评论
您为什么认为r2会有此信息?可见性对编译器很重要,而对RE则不那么重要(任何符号都不错,越好越好)