Skip to content

Commit 940d398

Browse files
committed
tried solving it, still failed using validate script
1 parent 04b26b8 commit 940d398

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lab8/solve.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ def main():
99

1010
input_len = 8
1111
input_chars = [claripy.BVS('', 8) for _ in range(input_len)]
12-
sym_input = claripy.Concat(*input_chars)
12+
sym_input = claripy.Concat(*input_chars, claripy.BVV(0, 8))
1313

1414
# Explicitly use SimFileStream with has_end=False
1515
stdin_stream = angr.SimFileStream(name='stdin', content=sym_input, has_end=False)
1616

17-
state = project.factory.full_init_state(stdin=stdin_stream)
17+
state = project.factory.entry_state(stdin=stdin_stream)
1818

1919

2020
for c in input_chars:
@@ -29,9 +29,10 @@ def is_successful(state):
2929
simgr.explore(find=is_successful)
3030

3131
if simgr.found:
32-
found = simgr.found[0]
33-
result = found.solver.eval(sym_input, cast_to=bytes)
34-
sys.stdout.buffer.write(result)
32+
sol = simgr.found[0].solver.eval(claripy.Concat(*input_chars), cast_to=bytes)
33+
print(sol.decode(), end='')
34+
else:
35+
print("[-] No solution found.", end='')
3536

3637

3738
if __name__ == '__main__':

0 commit comments

Comments
 (0)