solved drum_machine

This commit is contained in:
2025-11-29 00:23:51 +01:00
parent 73fda3761e
commit 14c40e5b3a
8 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
Gemini-solve:
Real flag is: EPFL{dance_along_to_the_b34t_of_the_fl4g!}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,73 @@
# ---------------------------------------------------------
# STEP 1: SOLVE THE PATH (Generate the Sequence of Hits)
# ---------------------------------------------------------
# Memory dump from DrumMachine constructor
raw_data = {
6: 1, 16: 2, 28: 3, 34: 4, 44: 5, 47: 6, 56: 7, 68: 8, 72: 9, 81: 10,
92: 11, 94: 12, 103: 13, 113: 14, 122: 15, 131: 16, 140: 17, 144: 18,
155: 19, 164: 20, 176: 21, 179: 22, 188: 23, 191: 24, 200: 25, 209: 26,
219: 27, 228: 28, 230: 29, 239: 30, 251: 31, 260: 32, 262: 33, 272: 34,
283: 35, 292: 36, 294: 37, 303: 38, 312: 39, 321: 40, 330: 41, 340: 42,
342: 43, 355: 44, 364: 45, 368: 46, 377: 47, 387: 48, 396: 49, 398: 50,
407: 51, 416: 52, 425: 53, 435: 54, 444: 55, 447: 56, 456: 57, 465: 58,
475: 59, 484: 60, 486: 61, 495: 62, 504: 63, 515: 64, 524: 65, 526: 66,
535: 67, 544: 68, 553: 69, 562: 70, 572: 71, 576: 72, 586: 73, 595: 74,
604: 75, 606: 76, 615: 77, 624: 78, 633: 79, 643: 80, 652: 81, 654: 82,
663: 83, 672: 84, 681: 85, 690: 86, 700: 87, 704: 88, 714: 89, 723: 90,
732: 91, 737: 92, 747: 93, 756: 94, 758: 95, 768: 96, 779: 97, 788: 98,
790: 99, 799: 100, 808: 101, 817: 102, 826: 103, 836: 104, 839: 105,
851: 106, 860: 107, 862: 108, 871: 109, 882: 110, 891: 111, 896: 112,
906: 113, 915: 114, 920: 115, 930: 116, 939: 117, 948: 118, 950: 119,
959: 120, 968: 121, 977: 122, 986: 123, 996: 124, 998: 125, 1007: 126,
1016: 127, 1025: 128, 1035: 129, 1044: 130, 1047: 131, 1056: 132,
1067: 133, 1076: 134, 1078: 135, 1087: 136, 1096: 137, 1105: 138,
1114: 139, 1124: 140, 1128: 141, 1138: 142, 1147: 143, 1156: 144,
1161: 145, 1171: 146, 1180: 147, 1182: 148, 1192: 149, 1203: 150,
1212: 151, 1214: 152, 1223: 153, 1232: 154, 1241: 155, 1250: 156,
1260: 157, 1263: 158, 1272: 159, 1283: 160, 1292: 161, 1296: 162,
1305: 163, 1315: 164, 1324: 165, 1328: 166, 1338: 167, 1347: 168,
1350: 169, 1359: 170, 1368: 171, 1379: 172, 1388: 173, 1390: 174,
1403: 175, 1415: 176, 1416: 177, 1425: 178, 1434: 179, 1443: 180,
1452: 181
}
# Reconstruct the hit sequence
hit_sequence = []
TABLE_OFFSET = 6
for target_state in range(1, 182):
for index, next_val in raw_data.items():
if next_val == target_state:
prev_state = (index - TABLE_OFFSET) // 8
if prev_state == target_state - 1:
hit = (index - TABLE_OFFSET) % 8
hit_sequence.append(hit)
break
# ---------------------------------------------------------
# STEP 2: PACK INTO CHARACTERS (The Input)
# ---------------------------------------------------------
password_chars = []
current_byte_mask = 0
last_hit = -1
for hit in hit_sequence:
# If the sequence decreases or stays same, we must start a new byte
if hit <= last_hit:
password_chars.append(chr(current_byte_mask))
current_byte_mask = 0
last_hit = -1
# Set the bit at position 'hit'
current_byte_mask |= (1 << hit)
last_hit = hit
# Append the final byte
if current_byte_mask > 0:
password_chars.append(chr(current_byte_mask))
final_string = "".join(password_chars)
print(f"Length: {len(final_string)}")
print(f"Password: {final_string}")