【问题标题】:How to eliminate middle column fast from objdump command output? [closed]如何从 objdump 命令输出中快速消除中间列? [关闭]
【发布时间】:2017-06-25 07:43:21
【问题描述】:

从 linux 中的可执行文件中导出剪切信息时遇到问题。资料如下:

08048060 <__bss_start-0x100a>:
 8048060:   31 db                   xor    %ebx,%ebx
 8048062:   53                      push   %ebx
 8048063:   bb 75 a2 45 7e          mov    $0x7e45a275,%ebx
 8048068:   ff d3                   call   *%ebx

有没有什么方法可以更快地剪切数据“31 db 53 bb 75 a2 45 7e ff d3”而不复制单行然后删除每行中的命令?有时代码太长,需要多次剪切该列中的所有数据。

【问题讨论】:

  • 列选择模式。你的编辑支持吗? (你为什么还要复制指令字节??)
  • 我的作品只需要中间一栏,所以我只想剪掉它,没有最后一栏的任何说明,也没有第一栏的地址。
  • 如果是shellcode,可能是objdump -d ./progname |grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr '\t' ' '|sed 's/ $//g'|sed 's/ /\\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g'
  • 谢谢@MichaelPetch !!!在看到您回答之前,我刚刚解决了这个问题!顺便说一句,谢谢!

标签: assembly nasm objdump


【解决方案1】:

更简单的方法是使用相关工具objcopy

 gcc -c shellcode.s
 objcopy -O binary shellcode.o shellcode.bin

objcopy 可用于从目标文件中复制任意部分。

【讨论】:

    猜你喜欢
    • 2015-08-13
    • 2011-09-23
    • 1970-01-01
    • 2015-11-28
    • 2015-05-06
    • 2015-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多