Step 1: Click on the green button to Start the Lab
Step 2: Hack the URL or IP of the lab
Step 3: Use your skills and logic to find the flags!
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-4e0df7801e02
3bd4af06c958c41815284e0df7801e02
3cf9b578dc844108a115f2e8040e602d
3cf9b578-dc84-4108-a115-f2e8040e602d
def 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:]}")
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.