solved lake ctf
This commit is contained in:
@@ -96,27 +96,21 @@ def extract_logic(class_hash, method_hash, files_map):
|
||||
|
||||
def solve():
|
||||
files_map = load_files()
|
||||
if not files_map: return
|
||||
if not files_map:
|
||||
return
|
||||
|
||||
curr_class = START_CLASS_HASH
|
||||
curr_method = START_METHOD_HASH
|
||||
|
||||
step_count = 0
|
||||
visited = set()
|
||||
|
||||
print(f"[*] Starting traversal for exactly {MAX_STEPS} steps...")
|
||||
|
||||
# UPDATED: Loop exactly MAX_STEPS times
|
||||
for i in range(MAX_STEPS):
|
||||
if not curr_class:
|
||||
print("[!] Chain ended prematurely!")
|
||||
break
|
||||
|
||||
# Loop detection (just in case, though duplicates are mathematically fine)
|
||||
if (curr_class, curr_method) in visited:
|
||||
print(f"[i] Loop detected at step {i+1}. This is fine, just adding redundant constraints.")
|
||||
visited.add((curr_class, curr_method))
|
||||
|
||||
|
||||
step_count += 1
|
||||
|
||||
eq_str, next_class, next_method = extract_logic(curr_class, curr_method, files_map)
|
||||
@@ -126,6 +120,7 @@ def solve():
|
||||
|
||||
try:
|
||||
if "==" in eq_str:
|
||||
print(f"[*] Adding constraint {eq_str}")
|
||||
lhs, rhs = eq_str.split("==")
|
||||
ctx = {'str': MockString()}
|
||||
lhs_expr = eval(lhs.strip(), {}, ctx)
|
||||
@@ -133,7 +128,7 @@ def solve():
|
||||
solver.add(lhs_expr == rhs_val)
|
||||
else:
|
||||
print(f"[!] Warning: Equation format unknown: {eq_str}")
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print(f"[!] Error parsing equation: {eq_str}")
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user