gdb - bin 文件上的 gdb 命令不适用于我的二进制文件
问题描述
我正在尝试使用 gdb 来修改工程.bin
文件。我试过遵循一堆指南,但我做的每一件事似乎都失败了。
首先我只是用 gdb 打开文件:
$ gdb impossible_password.bin
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from impossible_password.bin...
(No debugging symbols found in impossible_password.bin)
我尝试反汇编main:
(gdb) disassemble main
No symbol table is loaded. Use the "file" command.
好的,奇怪,这在我看到的视频中有效。我在这里做错了什么?
另外,我看到了另一个视频,其中一个人启动了文件,并且可以使用 ghidra 的位置 ID 设置断点。我也想试试这个:
$ gdb impossible_password.bin
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from impossible_password.bin...
(No debugging symbols found in impossible_password.bin)
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Temporary breakpoint 1 (-qualified main) pending.
Starting program: /home/ask/Notes/ethHack/wetransfer-85179d/Export/impossible_password.bin
* b *00400961
[b]
[Inferior 1 (process 29475) exited with code 01]
(gdb)
设置断点失败的地方。而且我可以在文件中看到绝对没有值。
我在做什么完全错了?我真的只是想开始看看这个文件中的一些值编辑:
以下是有关文件的信息:
$ file impossible_password.bin
impossible_password.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ba116ba1912a8c3779ddeb579404e2fdf34b1568, stripped
解决方案
您的.bin
文件已完全剥离。这意味着其中没有符号,并且每个需要符号的命令(例如break main
and start
)都会失败。
您只能在地址上设置断点。
假设0x0400961
确实是 的地址main
,这应该有效:
(gdb) break *0x0400961
(gdb) run
推荐阅读
- tailwind-css - 如何在tailwindcss中实现带有徽章的数据列表
- node.js - 房地产项目在 MongoDB 中存储数据的最佳方式
- google-apps-script - Google表格–当A列中的单元格包含字符串时删除行
- mysql - 如何删除 WITH ROLLUP 获取的不必要值并添加 TOTAL?
- html - 如何使特定元素可滚动,而不是整个页面?
- laravel - laravel 有效载荷在生产中太大
- intershop - 如何解码 BASKET 表上的 COMPUTEDITEMS 字段
- postgresql - Sqlalchemy 核心:重新格式化 select 内部的 select 查询
- javascript - 如何在单页应用程序中使用 Google adsense 广告?
- django - 根据帐户类型限制对 Django 中视图的访问