Start the machine, hack the system, and find the hidden flags to complete this challenge and earn points!
This walkthrough explains how to hack the lab and capture the flags. For help with Learning Mode questions, use the Request Hint button next to each question.
The Rail Fence cipher is a transposition cipher that writes the plaintext in a zigzag pattern along a number of rails, then reads off the ciphertext row by row.
3bd4af06-c958-c418-1528-4e0df7801e023bd4af06c958c41815284e0df7801e023cf9b578dc844108a115f2e8040e602d3cf9b578-dc84-4108-a115-f2e8040e602ddef rail_fence_decrypt(encrypted, rails):
# Calculate the pattern
pattern = []
row, col = 0, 0
direction = 1
for i in range(len(encrypted)):
pattern.append((row, col))
col += 1
if row == 0:
direction = 1
elif row == rails - 1:
direction = -1
row += direction
# Sort pattern by position
pattern.sort(key=lambda x: (x[0], x[1]))
# Create the fence
fence = [[''] * len(encrypted) for _ in range(rails)]
# Fill the fence with encrypted text
for i, (row, col) in enumerate(pattern):
fence[row][col] = encrypted[i]
# Read the decrypted text
decrypted = ''
row, col = 0, 0
direction = 1
for _ in range(len(encrypted)):
decrypted += fence[row][col]
col += 1
if row == 0:
direction = 1
elif row == rails - 1:
direction = -1
row += direction
return decrypted
# The encrypted message
encrypted = "3bd4af06c958c41815284e0df7801e02"
# Decrypt with 3 rails
flag = rail_fence_decrypt(encrypted, 3)
print(f"Flag: {flag[:8]}-{flag[8:12]}-{flag[12:16]}-{flag[16:20]}-{flag[20:]}")Choose how you want to get started
Choose a username to get started
We've sent a 9-character code to your email