mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
Minor refactoring for an Issue #203
This commit is contained in:
parent
9aba690a60
commit
048e720f69
|
@ -1962,7 +1962,7 @@ def extractErrorMessage(page):
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def urldecode(value, encoding=None, onlyPrintable=True):
|
def urldecode(value, encoding=None, convall=False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
if value:
|
if value:
|
||||||
|
@ -1972,13 +1972,14 @@ def urldecode(value, encoding=None, onlyPrintable=True):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
if onlyPrintable:
|
if convall:
|
||||||
def _(match):
|
|
||||||
char = chr(ord(match.group(1).decode("hex")))
|
|
||||||
return char if char in string.printable.replace("&", "") else match.group(0)
|
|
||||||
result = re.sub("%([0-9a-fA-F]{2})", _, value)
|
|
||||||
else:
|
|
||||||
result = urllib.unquote_plus(value)
|
result = urllib.unquote_plus(value)
|
||||||
|
else:
|
||||||
|
def _(match):
|
||||||
|
charset = string.printable.replace("&", "")
|
||||||
|
char = chr(ord(match.group(1).decode("hex")))
|
||||||
|
return char if char in charset else match.group(0)
|
||||||
|
result = re.sub("%([0-9a-fA-F]{2})", _, value)
|
||||||
|
|
||||||
if isinstance(result, str):
|
if isinstance(result, str):
|
||||||
result = unicode(result, encoding or UNICODE_ENCODING, "replace")
|
result = unicode(result, encoding or UNICODE_ENCODING, "replace")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user