如何用objdump反汇编并重新编译程序? [英] How to disassemble with objdump and recompile the program ?

查看:892
本文介绍了如何用objdump反汇编并重新编译程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都有关于我如何使用

objdump反汇编二进制文件的提示,做一些修改然后重新编译所有内容?


谢谢,

--Ben

Anyone have hints for me on how I can disassemble a binary file using
objdump, do some modifications and then recompile everything ?

thanks,
--Ben

推荐答案

Benoit Lefebvre写道:
Benoit Lefebvre wrote:

任何人都有关于我如何使用

objdump反汇编二进制文件的提示,做一些修改然后重新编译一切?
Anyone have hints for me on how I can disassemble a binary file using
objdump, do some modifications and then recompile everything ?



否。这不可能。反汇编为您提供汇编代码,C / $
编译器无法编译。另外经常拆卸非常困难,因为修改可能会导致错误。如果来源不是可以访问的,那么你必须修改二进制文件,然后在平台上询问

特定的组。例如,如果您正在拆卸x86机器代码

请在< news:comp.lang.asm.x86or< news:alt.lang.asm>中询问。

No. This cannot be done. Disassembly gives you assembler code which a C
compiler cannot compile. Also often disassembly is very difficult to
figure out and modifications might lead to errors. If source is not
accessible and you must modify the binary then ask in a platform
specific group. For example if you are disassembling x86 machine code
ask in <news:comp.lang.asm.x86or <news:alt.lang.asm>.


12月6日晚上9:51,Benoit Lefebvre< benoit.lefeb ... @ gmail.comwrote:
On Dec 6, 9:51 pm, Benoit Lefebvre <benoit.lefeb...@gmail.comwrote:

任何人都有关于我如何使用

objdump反汇编二进制文件,进行一些修改然后重新编译所有内容的提示?
Anyone have hints for me on how I can disassemble a binary file using
objdump, do some modifications and then recompile everything ?



这样的事情怎么样?您可以轻松地增强它以报告

发生的任何错误。


#include< stdio.h>


int main(无效)

{

FILE * fp,* fq;

int c;

if(fp = fopen(progname,rb)){

if(fq = fopen(" progname-new"," wb")){

while((c = fgetc(fp))!= EOF){

c ^ = 0x42; / *< ---在这里提供所需的修改* /

if(fputc(c,fq)== EOF)

break;

}

fclose(fq);

}

fclose(fp);

}

返回0;

}

How about something like this? You could easily enhance it to report
any errors that occur.

#include <stdio.h>

int main(void)
{
FILE *fp, *fq;
int c;
if(fp=fopen("progname", "rb")) {
if(fq=fopen("progname-new", "wb")) {
while((c=fgetc(fp))!=EOF) {
c ^= 0x42; /* <--- supply the desired modification here */
if(fputc(c, fq)==EOF)
break;
}
fclose(fq);
}
fclose(fp);
}
return 0;
}


>

谢谢,
>
thanks,



欢迎您。

You''re welcome.


--Ben
--Ben


12月6日下午4:55,santosh< santosh .... @ gmail.comwrote:
On Dec 6, 4:55 pm, santosh <santosh....@gmail.comwrote:

Benoit Lefebvre写道:
Benoit Lefebvre wrote:

任何人都有关于我如何使用

objdump反汇编二进制文件的提示,做一些修改然后重新编译一切?
Anyone have hints for me on how I can disassemble a binary file using
objdump, do some modifications and then recompile everything ?



否。这是无法做到的。反汇编为您提供汇编代码,C / $
编译器无法编译。另外经常拆卸非常困难,因为修改可能会导致错误。如果来源不是可以访问的,那么你必须修改二进制文件,然后在平台上询问

特定的组。例如,如果您要拆解x86机器代码

请在< news:comp.lang.asm.x86or< news:alt.lang.asm>中询问。


No. This cannot be done. Disassembly gives you assembler code which a C
compiler cannot compile. Also often disassembly is very difficult to
figure out and modifications might lead to errors. If source is not
accessible and you must modify the binary then ask in a platform
specific group. For example if you are disassembling x86 machine code
ask in <news:comp.lang.asm.x86or <news:alt.lang.asm>.



并且......不能让asm编译器重新编译代码吗?

And... can''t an asm compiler recompile the code ?


这篇关于如何用objdump反汇编并重新编译程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆