solved lake ctf

This commit is contained in:
2025-12-15 20:03:09 +01:00
parent 77affbad71
commit a6ed5c6bb9
26 changed files with 2235 additions and 20 deletions

View File

@@ -9,8 +9,18 @@
"anothapk.apk"
],
[
"android",
"Source code",
"Resources",
"anothapk.apk"
],
[
"lib",
"Resources",
"anothapk.apk"
],
[
"x86_64",
"lib",
"Resources",
"anothapk.apk"
],
[
@@ -34,9 +44,14 @@
"anothapk.apk"
],
[
"com.lake.ctf.MainActivity",
"com.lake.ctf",
"Source code",
"lib",
"Resources",
"anothapk.apk"
],
[
"x86_64",
"lib",
"Resources",
"anothapk.apk"
]
],
@@ -49,12 +64,12 @@
"type": "class",
"tabPath": "com.lake.ctf.MainActivity",
"subPath": "java",
"caret": 4782,
"caret": 442,
"view": {
"x": 0,
"y": 1365
"y": 0
},
"active": true,
"active": false,
"pinned": false,
"bookmarked": false,
"hidden": false
@@ -136,7 +151,7 @@
"caret": 6022,
"view": {
"x": 0,
"y": 4155
"y": 1874
},
"active": false,
"pinned": false,
@@ -156,6 +171,20 @@
"pinned": false,
"bookmarked": false,
"hidden": false
},
{
"type": "class",
"tabPath": "com.lake.ctf.Check4ec9599fc203d176a301536c2e091a19bc852759b255bd6818810a42c5fed14a",
"subPath": "java",
"caret": 252,
"view": {
"x": 0,
"y": 4968
},
"active": true,
"pinned": false,
"bookmarked": false,
"hidden": false
}
],
"cacheDir": "/home/cato/.cache/jadx/projects/anothapk-a709dee63602e12ef9bab1f45e2a8b42",

View File

@@ -1,6 +0,0 @@
def main():
print("Hello from android!")
if __name__ == "__main__":
main()

View File

@@ -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