“黑客:剥削的艺术";-书籍范例中的汇编不一致与我系统的gcc不一致 [英] "Hacking: The Art of Exploitation" - Assembly Inconsistencies in book examples vs. my system's gcc

查看:44
本文介绍了“黑客:剥削的艺术";-书籍范例中的汇编不一致与我系统的gcc不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究>黑客:剥削的艺术" .我试图按照代码示例进行操作,但是由于某些原因,汇编代码根本与实际Linux上的代码不匹配(在Virtual Box上以Guest身份运行).我已确保已安装32位Linux操作系统.有什么我可以传递给gcc的参数,可以让我将代码编译成与本书中所给出的程序集紧密匹配的程序集?

I am studying "Hacking: The Art of Exploitation". I am trying to follow the code examples, but for some reason the assembly codes simply does not match the one on my actual Linux (running on Virtual Box as Guest). I have made sure that I have installed 32 bit Linux OS. Is there any args that I can pass to gcc that lets me compile the code into an assembly that matches closely with the ones given in the book?

我会很好地调和这本书与&我看到它们是否很小,但我看到的区别是明显的.我以某种方式不喜欢从预先配置的培养箱环境"中运行代码.因为这阻碍了我的技能发展.

I would be fine reconciling the code differences between the book & what I see if they were minor, but the difference I see is stark. I somehow don't like to run the code from the "Preconfigured incubator environment" as this inhibits my skill development.

推荐答案

由于某种原因,汇编代码与我实际的linux上的汇编代码根本不匹配

for some reason the assembly codes simply does not match the one on my actual linux

最可能的原因是该书于2008年出版,并使用了当时稳定的GCC(您可以在

The most likely reason is that the book was published in 2008, and used then-stable GCC (you can see GCC release history here).

您现在使用的GCC可能要更新得多,因此会生成明显不同(并且希望更好)的代码.

GCC that you are using now is likely much newer, and so generates significantly different (and one hopes better) code.

我可以传递给gcc的任何args,让我将代码编译成与本书中所给出的程序集紧密匹配的程序集吗?

Is there any args that I can pass to gcc that lets me compile the code into an assembly that matches closely with the ones given in the book?

不.您可以尝试编译并安装2008年以来的版本,可能是4.2.3或4.3.0,然后检查是否可以提供更紧密的输出.

No. You can try to compile and install a version from 2008, perhaps 4.2.3 or 4.3.0, and check whether that gives you closer output.

P.S.看来这本书的第一版是2003年出版的,作者不太可能在2008年为第二版重新构建所有示例,所以也许可以尝试使用GCC 3.3?

P.S. It looks like the first revision of the book is from 2003, and it's unlikely that the authors rebuilt all of their examples for the second edition in 2008, so perhaps try GCC 3.3 instead?

这篇关于“黑客:剥削的艺术";-书籍范例中的汇编不一致与我系统的gcc不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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