Skip to content

Commit 80ddf71

Browse files
committed
add LAB8
1 parent f0eea71 commit 80ddf71

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

lab8/solve.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
#!/usr/bin/env python3
2-
32
import sys
43
import os
5-
6-
# --- 開始:診斷訊息 ---
7-
print(f"solve.py DEBUG: 正在使用 Python 解譯器: {sys.executable}", file=sys.stderr)
8-
print(f"solve.py DEBUG: Python 版本: {sys.version.splitlines()[0]}", file=sys.stderr)
9-
print(f"solve.py DEBUG: 當前工作目錄: {os.getcwd()}", file=sys.stderr)
10-
# --- 結束:診斷訊息 ---
11-
124
import angr
135
import claripy
14-
# import sys # sys 已經在上面導入過了
15-
# import angr.options as so # <--- 移除或註解掉這一行
166

177
def main():
18-
# 1. 載入目標二進制檔案 'chal'
8+
199
try:
2010
proj = angr.Project("./chal", auto_load_libs=False)
2111
except angr.errors.AngrLoadError as e:
@@ -29,11 +19,6 @@ def main():
2919
sym_input = claripy.BVS("sym_input_stdin", input_len * 8)
3020
state = proj.factory.entry_state(stdin=sym_input)
3121

32-
# --- 移除或註解掉以下關於 state.options 的程式碼 ---
33-
# state.options.add(so.ZERO_FILL_UNCONSTRAINED_MEMORY)
34-
# state.options.add(so.ZERO_FILL_UNCONSTRAINED_REGISTERS)
35-
# --- --- --- --- --- --- --- --- --- --- --- ---
36-
3722
# 3. 創建模擬管理器 (Simulation Manager)
3823
simgr = proj.factory.simgr(state)
3924

@@ -49,7 +34,6 @@ def main():
4934
found_solution = False
5035
final_key = b"angr_did_not_find_solution_no_options"
5136

52-
# 5. 檢查 'deadended' stash 中的狀態尋找解決方案
5337
if simgr.deadended:
5438
print(f"solve.py: 發現 {len(simgr.deadended)} 個 deadended 狀態。正在檢查...", file=sys.stderr)
5539
for s in simgr.deadended:

0 commit comments

Comments
 (0)