-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathcmd_ag
More file actions
304 lines (298 loc) · 7.75 KB
/
cmd_ag
File metadata and controls
304 lines (298 loc) · 7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
NAME=agcj
FILE=bins/elf/hello_world
CMDS=<<EOF
aa 2> /dev/null
agcj
EOF
EXPECT=<<EOF
[{"name":"entry0","size":42,"imports":["reloc.__libc_start_main"]}]
EOF
RUN
NAME=agi
FILE=bins/elf/hello_world
CMDS=<<EOF
aa 2> /dev/null
agi*
EOF
EXPECT=<<EOF
'agn "sym.imp.free"
'agn "0x0000083f"
'agn "sym.imp.strcpy"
'agn "0x00000814"
'agn "sym.imp.puts"
'agn "0x00000833"
'agn "sym.imp.strlen"
'agn "0x000007cf"
'agn "0x000007de"
'agn "sym.imp.malloc"
'agn "0x000007f6"
'agn "sym.imp.strcat"
'agn "0x00000827"
'agn "sym.imp.__cxa_finalize"
'agn "0x0000077e"
'age "0x0000083f" "sym.imp.free"
'age "0x00000814" "sym.imp.strcpy"
'age "0x00000833" "sym.imp.puts"
'age "0x000007cf" "sym.imp.strlen"
'age "0x000007de" "sym.imp.strlen"
'age "0x000007f6" "sym.imp.malloc"
'age "0x00000827" "sym.imp.strcat"
'age "0x0000077e" "sym.imp.__cxa_finalize"
EOF
RUN
NAME=agx
FILE=bins/elf/hello_world
CMDS=<<EOF
aa 2> /dev/null
agx* @ main
EOF
EXPECT=<<EOF
'agn "sym.main"
'agn "0x000006bd"
'age "0x000006bd" "sym.main"
EOF
RUN
NAME=formats
FILE=bins/elf/hello_world
CMDS=<<EOF
aa 2> /dev/null
agx @ main
agid
agig
agij
agik
agit
EOF
EXPECT=<<EOF
.--------------------.
| 0x000006bd |
`--------------------'
v
|
|
.--------------------.
| sym.main |
`--------------------'
digraph code {
rankdir=LR;
outputorder=edgesfirst
graph [bgcolor=azure];
edge [arrowhead=normal, color="#3030c0" style=bold weight=2 ];
node [fillcolor=white, style=filled shape=box fontsize="8" fontname="Courier"];
0 [URL="sym.imp.free", color="lightgray", label="sym.imp.free"]
1 [URL="0x0000083f", color="lightgray", label="0x0000083f"]
1 -> 0
2 [URL="sym.imp.strcpy", color="lightgray", label="sym.imp.strcpy"]
3 [URL="0x00000814", color="lightgray", label="0x00000814"]
3 -> 2
4 [URL="sym.imp.puts", color="lightgray", label="sym.imp.puts"]
5 [URL="0x00000833", color="lightgray", label="0x00000833"]
5 -> 4
6 [URL="sym.imp.strlen", color="lightgray", label="sym.imp.strlen"]
7 [URL="0x000007de", color="lightgray", label="0x000007de"]
7 -> 6
8 [URL="0x000007cf", color="lightgray", label="0x000007cf"]
8 -> 6
9 [URL="sym.imp.malloc", color="lightgray", label="sym.imp.malloc"]
10 [URL="0x000007f6", color="lightgray", label="0x000007f6"]
10 -> 9
11 [URL="sym.imp.strcat", color="lightgray", label="sym.imp.strcat"]
12 [URL="0x00000827", color="lightgray", label="0x00000827"]
12 -> 11
13 [URL="sym.imp.__cxa_finalize", color="lightgray", label="sym.imp.__cxa_finalize"]
14 [URL="0x0000077e", color="lightgray", label="0x0000077e"]
14 -> 13
}
graph
[
hierarchic 1
label ""
directed 1
node [
id 0
label "sym.imp.free"
]
node [
id 1
label "0x0000083f"
]
node [
id 2
label "sym.imp.strcpy"
]
node [
id 3
label "0x00000814"
]
node [
id 4
label "sym.imp.puts"
]
node [
id 5
label "0x00000833"
]
node [
id 6
label "sym.imp.strlen"
]
node [
id 7
label "0x000007de"
]
node [
id 8
label "0x000007cf"
]
node [
id 9
label "sym.imp.malloc"
]
node [
id 10
label "0x000007f6"
]
node [
id 11
label "sym.imp.strcat"
]
node [
id 12
label "0x00000827"
]
node [
id 13
label "sym.imp.__cxa_finalize"
]
node [
id 14
label "0x0000077e"
]
edge [
source 1
target 0
]
edge [
source 3
target 2
]
edge [
source 5
target 4
]
edge [
source 7
target 6
]
edge [
source 8
target 6
]
edge [
source 10
target 9
]
edge [
source 12
target 11
]
edge [
source 14
target 13
]
]
{"nodes":[{"id":0,"title":"sym.imp.free","offset":1584,"out_nodes":[]},{"id":1,"title":"0x0000083f","offset":2111,"out_nodes":[0]},{"id":2,"title":"sym.imp.strcpy","offset":1600,"out_nodes":[]},{"id":3,"title":"0x00000814","offset":2068,"out_nodes":[2]},{"id":4,"title":"sym.imp.puts","offset":1616,"out_nodes":[]},{"id":5,"title":"0x00000833","offset":2099,"out_nodes":[4]},{"id":6,"title":"sym.imp.strlen","offset":1632,"out_nodes":[]},{"id":7,"title":"0x000007de","offset":2014,"out_nodes":[6]},{"id":8,"title":"0x000007cf","offset":1999,"out_nodes":[6]},{"id":9,"title":"sym.imp.malloc","offset":1648,"out_nodes":[]},{"id":10,"title":"0x000007f6","offset":2038,"out_nodes":[9]},{"id":11,"title":"sym.imp.strcat","offset":1664,"out_nodes":[]},{"id":12,"title":"0x00000827","offset":2087,"out_nodes":[11]},{"id":13,"title":"sym.imp.__cxa_finalize","offset":1680,"out_nodes":[]},{"id":14,"title":"0x0000077e","offset":1918,"out_nodes":[13]}]}
agraph.color_box=G1swbQ==
agraph.delta_x=0x4d
agraph.delta_y=0x1
agraph.h=0x10
agraph.is_callgraph=false
agraph.nodes=sym.imp.free,0x0000083f,sym.imp.strcpy,0x00000814,sym.imp.puts,0x00000833,sym.imp.strlen,0x000007de,0x000007cf,sym.imp.malloc,0x000007f6,sym.imp.strcat,0x00000827,sym.imp.__cxa_finalize,0x0000077e
agraph.nodes.0x0000077e.body=base64:
agraph.nodes.0x0000077e.h=0x3
agraph.nodes.0x0000077e.neighbours=sym.imp.__cxa_finalize
agraph.nodes.0x0000077e.w=0x16
agraph.nodes.0x0000077e.x=0xbd
agraph.nodes.0x0000077e.y=0x4d
agraph.nodes.0x000007cf.body=base64:
agraph.nodes.0x000007cf.h=0x3
agraph.nodes.0x000007cf.neighbours=sym.imp.strlen
agraph.nodes.0x000007cf.w=0x16
agraph.nodes.0x000007cf.x=0x68
agraph.nodes.0x000007cf.y=0x4d
agraph.nodes.0x000007de.body=base64:
agraph.nodes.0x000007de.h=0x3
agraph.nodes.0x000007de.neighbours=sym.imp.strlen
agraph.nodes.0x000007de.w=0x16
agraph.nodes.0x000007de.x=0x4e
agraph.nodes.0x000007de.y=0x4d
agraph.nodes.0x000007f6.body=base64:
agraph.nodes.0x000007f6.h=0x3
agraph.nodes.0x000007f6.neighbours=sym.imp.malloc
agraph.nodes.0x000007f6.w=0x16
agraph.nodes.0x000007f6.x=0x82
agraph.nodes.0x000007f6.y=0x4d
agraph.nodes.0x00000814.body=base64:
agraph.nodes.0x00000814.h=0x3
agraph.nodes.0x00000814.neighbours=sym.imp.strcpy
agraph.nodes.0x00000814.w=0x16
agraph.nodes.0x00000814.x=0x1a
agraph.nodes.0x00000814.y=0x4d
agraph.nodes.0x00000827.body=base64:
agraph.nodes.0x00000827.h=0x3
agraph.nodes.0x00000827.neighbours=sym.imp.strcat
agraph.nodes.0x00000827.w=0x16
agraph.nodes.0x00000827.x=0xa0
agraph.nodes.0x00000827.y=0x4d
agraph.nodes.0x00000833.body=base64:
agraph.nodes.0x00000833.h=0x3
agraph.nodes.0x00000833.neighbours=sym.imp.puts
agraph.nodes.0x00000833.w=0x16
agraph.nodes.0x00000833.x=0x34
agraph.nodes.0x00000833.y=0x4d
agraph.nodes.0x0000083f.body=base64:
agraph.nodes.0x0000083f.h=0x3
agraph.nodes.0x0000083f.neighbours=sym.imp.free
agraph.nodes.0x0000083f.w=0x16
agraph.nodes.0x0000083f.x=0
agraph.nodes.0x0000083f.y=0x4d
agraph.nodes.sym.imp.__cxa_finalize.body=base64:
agraph.nodes.sym.imp.__cxa_finalize.h=0x3
agraph.nodes.sym.imp.__cxa_finalize.w=0x1c
agraph.nodes.sym.imp.__cxa_finalize.x=0xba
agraph.nodes.sym.imp.__cxa_finalize.y=0x56
agraph.nodes.sym.imp.free.body=base64:
agraph.nodes.sym.imp.free.h=0x3
agraph.nodes.sym.imp.free.w=0x16
agraph.nodes.sym.imp.free.x=0
agraph.nodes.sym.imp.free.y=0x56
agraph.nodes.sym.imp.malloc.body=base64:
agraph.nodes.sym.imp.malloc.h=0x3
agraph.nodes.sym.imp.malloc.w=0x16
agraph.nodes.sym.imp.malloc.x=0x82
agraph.nodes.sym.imp.malloc.y=0x56
agraph.nodes.sym.imp.puts.body=base64:
agraph.nodes.sym.imp.puts.h=0x3
agraph.nodes.sym.imp.puts.w=0x16
agraph.nodes.sym.imp.puts.x=0x34
agraph.nodes.sym.imp.puts.y=0x56
agraph.nodes.sym.imp.strcat.body=base64:
agraph.nodes.sym.imp.strcat.h=0x3
agraph.nodes.sym.imp.strcat.w=0x16
agraph.nodes.sym.imp.strcat.x=0xa0
agraph.nodes.sym.imp.strcat.y=0x56
agraph.nodes.sym.imp.strcpy.body=base64:
agraph.nodes.sym.imp.strcpy.h=0x3
agraph.nodes.sym.imp.strcpy.w=0x16
agraph.nodes.sym.imp.strcpy.x=0x1a
agraph.nodes.sym.imp.strcpy.y=0x56
agraph.nodes.sym.imp.strlen.body=base64:
agraph.nodes.sym.imp.strlen.h=0x3
agraph.nodes.sym.imp.strlen.w=0x16
agraph.nodes.sym.imp.strlen.x=0x5b
agraph.nodes.sym.imp.strlen.y=0x56
agraph.w=0xd6
* * * * * * * *
* * * * * * *
EOF
RUN