|
39 | 39 | from lib.core.data import paths |
40 | 40 | from lib.core.data import queries |
41 | 41 | from lib.core.data import temp |
| 42 | +from lib.core.convert import urlencode |
42 | 43 | from lib.core.exception import sqlmapFilePathException |
43 | 44 | from lib.core.settings import IS_WIN |
44 | 45 | from lib.core.settings import SQL_STATEMENTS |
@@ -810,24 +811,24 @@ def searchEnvPath(fileName): |
810 | 811 |
|
811 | 812 | return result |
812 | 813 |
|
813 | | -def sanitizeCookie(cookieStr, warn=False): |
| 814 | +def urlEncodeCookieValues(cookieStr, warn=False): |
814 | 815 | if cookieStr: |
815 | 816 | result = "" |
816 | 817 | changed = False |
817 | 818 | for part in cookieStr.split(';'): |
818 | 819 | index = part.find('=') + 1 |
819 | 820 | if index > 0: |
820 | 821 | name = part[:index - 1].strip() |
821 | | - value = part[index:].replace(",","%2C").replace(";","%3B").replace(" ","%20") |
| 822 | + value = urlencode(part[index:], convall=True) |
822 | 823 | if value != part[index:]: |
823 | 824 | changed = True |
824 | | - result += ";%s=%s" % (name, value) |
| 825 | + result += "; %s=%s" % (name, value) |
825 | 826 | elif part.strip().lower() != "secure": |
826 | | - result += "%s%s" % ("%3B", part.replace(",","%2C").replace(";","%3B").replace(" ","%20")) |
| 827 | + result += "%s%s" % ("%3B", urlencode(part, convall=True)) |
827 | 828 | else: |
828 | | - result += ";secure" |
829 | | - if result.startswith(';'): |
830 | | - result = result[1:] |
| 829 | + result += "; secure" |
| 830 | + if result.startswith('; '): |
| 831 | + result = result[2:] |
831 | 832 | elif result.startswith('%3B'): |
832 | 833 | result = result[3:] |
833 | 834 | if changed and warn: |
|
0 commit comments