goal: met the condition "good flag". code: [code] my current reverse engineering steps.…
- User
goal: met the condition "good flag". code:
import sys sys.setrecursionlimit(100000) 𝓿 = 𝓉𝔂𝓹𝓮("m", (), {"__init__": lambda 𝔞, b: 𝓈𝔢t𝒶𝓽t𝓻(𝒶, "b", 𝔟), "s": lambda 𝒶, b: 𝔳(𝔟(𝔞.𝒷).𝓫)}) 𝒸 = 𝔱𝓎𝓹𝓮("l", (), {"__init__": lambda 𝔞, 𝔟: 𝔰𝑒𝓽a𝓉𝓉𝔯(a, "b", 𝓫), "d": lambda a, 𝔟: 𝔞 if 𝓋(a.𝒷).s(𝒷).𝔟 != b(a.𝔟).𝓫 else b(𝔞.𝔟)}) 𝔪 = lambda 𝔵: 𝔠(f"{𝓵𝔦𝓈𝔱(𝓏𝔦𝔭([𝓁(𝔦 + 5*𝔦) for i in 𝔁], [𝔩(𝔦 + 𝓲) for 𝔦 in 𝔵][::-1]))[::-1] = }") 𝔫 = lambda x: 𝒸("{x[';]:=^450}".form𝒶𝓽(𝔵={'''';''': 𝔵})) 𝔩 = lambda 𝔁: (12648430 ^ (𝔵 + 3735928559)) * 3862272608 𝓀 = 𝓲n𝔭𝔲𝓽("Insert your flag: ") 𝓈 = [(lambda 𝔷, f, x, 𝔫: 𝓍 if 𝓷 == 0 else 𝔣(𝔷, 𝒻, (lambda 𝓶, 𝓃: (lambda 𝓍: 𝒾n𝔱(𝔁[l𝔢𝔫(𝔵)-59:], 2) + 𝒾𝓷𝓽(𝔵[:𝔩𝓮n(𝔁)-59], 2) if 𝔩e𝔫(𝔁)-59 > 0 else 𝔦n𝓽(𝔵,2))(b𝒾𝔫(𝓶 * 𝓷)))(𝔁, 𝔃), n - 1))(𝔰𝔲𝓂((o𝔯𝔡(𝔨[𝓲+𝒿]) << 𝒿*7) if i+j < l𝔢𝔫(𝓴) else (127 << 𝒿*7) for 𝔧 in 𝓇𝔞n𝑔𝔢(8)), (lambda 𝔷, 𝓯, x, 𝔫: x if 𝔫 == 0 else f(𝔷, 𝓯, (lambda 𝔫, 𝔪: (lambda 𝔵: in𝔱(x[𝓁e𝔫(𝓍)-59:], 2) + 𝓲nt(𝔁[:𝓁𝑒𝔫(𝔵)-59], 2) if 𝓵𝑒𝔫(𝓍)-59 > 0 else 𝒾n𝓽(x,2))(𝓫𝔦𝔫(𝓷 * 𝔪)))(𝔁, 𝔷), 𝔫 - 1)), 1, 420_69) for 𝔦 in 𝓇a𝓷𝑔e(0, 𝓁𝔢𝓷(𝔨), 8)] if 𝓬(s).𝔡(𝔪).𝒹(𝔫).b == "=𝓵𝔦𝓈𝔱(𝓏𝔦𝔭([𝓁(𝔦 + 5*𝔦) for i in 𝔁], [𝔩(𝔦 + 𝓲) for 𝔦 in 𝔵][::-1]))[::-1] = [(13969439442922757926633137632, 3251133470245911671632840864), (6919844817045365871489845728, 3067821989026578174692487328), (11408842561461143227463443808, 3766356150094573135206359136), (11299068421490417286376379488, 3802947530149782083826679648), (9203465938188223031329433888, 2306614948612889330244181216), (9753400381846729757945770272, 4656479823873291748257812704)]==": 𝔭𝓻i𝓷t("Good flag!")my current reverse engineering steps. evaluate them, and do the next step (so we can solve it step by step, I can run code locally in safe environment) to reverse engineer this
# lambda function that does bitwise XORing o = lambda x: (12648430 ^ (x + 3735928559)) * 3862272608 # Reverse the o lambda function def reverser(encoded_value): x = encoded_value // 3862272608 # Reverse the multiplication by dividing return (x ^ 12648430) - 3735928559 # Reverse the XOR operation and subtraction hardcoded_list = [ (13969439442922757926633137632, 3251133470245911671632840864), (6919844817045365871489845728, 3067821989026578174692487328), (11408842561461143227463443808, 3766356150094573135206359136), (11299068421490417286376379488, 3802947530149782083826679648), (9203465938188223031329433888, 2306614948612889330244181216), (9753400381846729757945770272, 4656479823873291748257812704) ] # Decode the hardcoded list decoded_list = [tuple(reverser(val) for val in pair) for pair in hardcoded_list] print(decoded_list) # Untie the zip and reversed list operations correct_order = list(reversed(decoded_list)) list_operations = list(zip(*correct_order)) first_half_operations = list_operations[0] second_half_operations = list_operations[1] print("First Half Operations:", first_half_operations) print("Second Half Operations:", second_half_operations) possible_i_values = set(val // 6 for val in first_half_operations) & set(val // 2 for val in second_half_operations) print("Possible i values:", possible_i_values) # output: Possible i values: {298608509588668418, 487582897162708488, 602816046677732626, 492319924258423028, 397152439243482845, 420883477912243645} - Assistant
- User
the flag format begins with ping{ consider that please!
- Assistant
Given that the flag format begins with , you'll want to start by comparing the decoded list with the ASCII values for the string . Let's go ahead and adjust the reverse engineering steps to take into account this new flag prefix and decode the flag.
- User
let's find a solution for this error: line 22, in decoded_chars.append(chr(decoded_value)) ^^^^^^^^^^^^^^^^^^ OverflowError: Python int too large to convert to C int
- Assistant
- User
python3 .\solver.py Expected reversed values for 'ping{': [-3723280129, -3723280129, -3723280129, -3723280129, -3723280129] []
- Assistant
- User
not enough chracter for the flag. the flag starts with "ping{" and ends with "}".
python3 .\solver.py Corrected decoded flag start: [47, 47, 47, 47, 47] Actual flag start ordinals: [112, 105, 110, 103, 123] Corrected decoded values: [17, 118, 139, 208, 168, 176] Decoded characters: ['v'] Flag: v
- Assistant