- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一名计算机科学学生,正在学习 IA-32 汇编。对于一个项目,我们已经获得了程序的可执行文件。我们可以使用 objdump 等工具来检查二进制文件,但不允许查看原始源代码。该程序接收一个输入字符串并将其与另一个神秘字符串进行比较。如果两个字符串不相同,程序就会发出警报,我的作业就会不及格。这将是一项有趣的任务...如果助教愿意回答我的问题...呃...
所以,如果您不介意给我一些指示,我想向论坛询问我是否走在正确的道路上。当我在 CODE 可执行文件上运行 objdump -d CODE 时,我可以深入查看并在 main() 函数中看到这一点:
08048a44 <main>:
...
8048af6: e8 d0 08 00 00 call 80493cb <get_string>
8048afb: 89 04 24 mov %eax,(%esp)
8048afe: e8 ad 00 00 00 call 8048bb0 <test_string>
我相当确定 get_string()
从用户那里获取一个字符串 - 它可能是 fscanf()
或其他东西的包装函数 - 然后是指针该字符串被保存到寄存器%eax
中。下一行将指针移动到 %esp
,然后调用 test_string()
。这是代码:
08048bb0 <test_string>:
8048bb0: 83 ec 1c sub $0x1c,%esp
8048bb3: c7 44 24 04 6c a4 04 movl $0x804a46c,0x4(%esp)
8048bba: 08
8048bbb: 8b 44 24 20 mov 0x20(%esp),%eax
8048bbf: 89 04 24 mov %eax,(%esp)
8048bc2: e8 bd 04 00 00 call 8049084 <cmp_strings>
8048bc7: 85 c0 test %eax,%eax
8048bc9: 74 05 je 8048bd0 <test_string+0x20>
8048bcb: e8 bc 07 00 00 call 804938c <alarm>
8048bd0: 83 c4 1c add $0x1c,%esp
8048bd3: c3 ret
这就是我认为正在发生的事情......
08048bb0 <test_string>:
8048bb0: sub $0x1c,%esp // Adjusts %esp for new function
8048bb3: movl $0x804a46c,0x4(%esp) // test_string is stored at $0x804a46c; move that pointer into %esp
8048bba: // ???
8048bbb: mov 0x20(%esp),%eax // Moves test_string ptr to %eax
8048bbf: mov %eax,(%esp) // Moves test_string ptr to %esp - not sure why...?
8048bc2: call 8049084 <cmp_strings> // Calls cmp_strings(), probably with %eax and %esp as argument strings
8048bc7: test %eax,%eax // %eax is the returned value
8048bc9: je 8048bd0 <test_string+0x20> // Should we jump to alarm()?
8048bcb: call 804938c <alarm> // If we reach here, I flunk
8048bd0: add $0x1c,%esp // restores %esp to original value
8048bd3: ret // exits
所以...如果我是对的,那么第 2 行是这里最重要的一行。我怀疑神秘字符串存储在内存地址$0x804a46c
中。但我不确定。我还注意到,当我使用字符串工具时,我看到了这个:
[linux]$ strings -t x CODE | grep 46c
246c My dog has fleas.
[linux]$
这很有希望......但并不令人信服。内存地址 $0x804a46c
不是 246c
。
所以...对冗长的帖子表示歉意,但是人们可以告诉我我是否走在正确的道路上吗?任何见解或智慧都会受到热烈欢迎!
非常感谢!-RAO
最佳答案
除非存在一些反调试技巧,否则 cmp_strings()
只接受两个参数,这两个参数都在 test_string()
内给出。当然,它们都是字符串,第一个字符串是从常量位置 0x804a46c
获取的,而第二个字符串(指向它的指针,当然,不是字符串本身)是 的参数>test_string()
。在调用之前,堆栈如下所示:
|_______________|
ESP: | <your string> | <-- cmp_strings() 1st arg
+04: | 0x804a46c | <-- cmp_strings() 2nd arg
+08: | ... |
+0C: | ... |
+10: | ... |
+14: | ... |
+18: | ... |
+1C: | return adress | <-- ESP at the start of test_string()
+20: | <your string> | <-- test_string() 1st arg
+24: | ... |
您可以使用 GDB 在运行时直接检查“secret”字符串内容(这通常是必要的,因为此处未显示的代码可能会重写它)。只需break *0x8048bc2
,运行
,然后x/sb 0x804a46c
。
关于assembly - 阅读 IA32 汇编代码 - 确定隐藏字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40266882/
我正在尝试读取一个大型日志文件,该文件已使用不同的分隔符(遗留更改)进行了解析。 此代码有效 import os, subprocess, time, re import pandas as pd f
我试图理解在 Linux 下以 Turbo 模式(特别是 fpc -Mtp -vw)编译的 Free Pascal 中看到的有点神奇的行为。代码来自 Jack Crenshaw 的“让我们构建一个编译
我有一个具有以下结构的 txt 文件: NAME DATA1 DATA2 a 10 1,2,3 b 6 8,9 c 2
我试图理解在 Linux 下以 Turbo 模式(特别是 fpc -Mtp -vw)编译的 Free Pascal 中看到的有点神奇的行为。代码来自 Jack Crenshaw 的“让我们构建一个编译
public class Bug1 { private String s; public void Bug1(){ s = "hello"; } public Stri
我们有这样一种情况,我们的应用程序需要处理一系列文件,而不是同步执行此功能,我们希望采用多线程将工作负载分配给不同的线程。 每一项工作是: 1.以只读方式打开文件 2.处理文件中的数据 3.将处理后的
我正在尝试读取 .php 文件并替换十六进制字符。php文件格式如下: 问题是它弄乱了转义字符 (\") 到目前为止我的代码: while(i=48 && str[i+2]=97 && str[i+
我正在用 C# 开发一个程序,我需要一些帮助。我正在尝试创建一个数组或项目列表,显示在某个网站上。我想要做的是阅读 anchor 文本,它是 href。例如,这是 HTML:
我有一个偏好设置,它控制我的应用程序是否在用户单击按钮时播放声音(这种情况经常发生,想想计算器)。每次用户单击按钮时,都会调用以下方法: private void playButtonClickSou
我正在尝试在我的标签末尾创建一个阅读更多按钮。我希望它默认显示 3 行。我正在用 swift 而不是 objective c 编写代码。只有当用户点击标签的阅读更多部分时,标签才会展开。它的外观和工作
当您获得第三方库(c、c++)、开源(LGPL 说)但没有很好的文档时,了解它以便能够集成到您的应用程序中的最佳方法是什么? 该库通常有一些示例程序,我最终使用 gdb 浏览了代码。还有其他建议/最佳
同时从 2 个或更多不同线程对同一个文件描述符使用 pread 是否有问题? 最佳答案 pread 本身是线程安全的,因为它不在 list of unsafe functions 上.所以调用它是安全
当您使用命令 pd.read_csv 读取 csv 时,如何跳过连续包含特定值的行?如果在第 50、55 行,第一列的值为 100,那么我想在读取 csv 文件时跳过这些行。我如何将这些命令放入像 p
我迫切需要在 C# 中使用 T4 生成 HTML 输出。 我正在使用 Runtime-T4-Files 并选择“TextTemplatingFilePreprocessor”而不是“TextTempl
今年夏天我在实习期间一直在学习 ERP 应用程序。由于我是一名即将毕业的程序员,我希望有一个可靠的软件分支可以帮助我完成工作,直到我确定下一步该做什么(直到我对大局有一个很好的了解)。到现在为止,我刚
将包含列(例如“a”、“b”)的数据帧保存为 parquet,然后在稍后的时间点读取 parquet 不会提供相同的列顺序(可能是“b”、“a”fe)文件保存为。 不幸的是,我无法弄清楚订单是如何受到
我正在开发一个使用谷歌表格作为数据库的应用程序,但我不知道如何让 Swift 从谷歌表格中读取。我浏览了 API 网站和一些问题,但刚开始我需要一些帮助。到目前为止,我有; 私有(private)让范
我打算阅读swing concept,如果值得一读,请推荐一些学习 Material 最佳答案 自 AWT 崩溃以来,Java 的 GUI 工具包太多了。即使是 Swing 也被评论家严重低估,但他们
我已经使用 J 几个月了,我发现阅读不熟悉的代码(例如,不是我自己写的)是该语言最具挑战性的方面之一,尤其是在默认情况下。过了一会儿,我想出了这个策略: 1)将代码段复制到word文档中 2)从(1)
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我是一名优秀的程序员,十分优秀!