mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-04 05:39:02 +00:00
StringIO is bad m'kay (python3 this and that)
This commit is contained in:
@@ -7,9 +7,9 @@ See the file 'LICENSE' for copying permission
|
||||
|
||||
import codecs
|
||||
import gzip
|
||||
import io
|
||||
import logging
|
||||
import re
|
||||
import StringIO
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
@@ -273,9 +273,9 @@ def decodePage(page, contentEncoding, contentType):
|
||||
|
||||
try:
|
||||
if contentEncoding == "deflate":
|
||||
data = StringIO.StringIO(zlib.decompress(page, -15)) # Reference: http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
|
||||
data = io.BytesIO(zlib.decompress(page, -15)) # Reference: http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
|
||||
else:
|
||||
data = gzip.GzipFile("", "rb", 9, StringIO.StringIO(page))
|
||||
data = gzip.GzipFile("", "rb", 9, io.BytesIO(page))
|
||||
size = struct.unpack("<l", page[-4:])[0] # Reference: http://pydoc.org/get.cgi/usr/local/lib/python2.5/gzip.py
|
||||
if size > MAX_CONNECTION_TOTAL_SIZE:
|
||||
raise Exception("size too large")
|
||||
|
||||
@@ -5,13 +5,12 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
import io
|
||||
import time
|
||||
import types
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
from StringIO import StringIO
|
||||
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
@@ -165,7 +164,7 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
|
||||
except:
|
||||
redurl = None
|
||||
result = fp
|
||||
fp.read = StringIO("").read
|
||||
fp.read = io.BytesIO("").read
|
||||
else:
|
||||
result = fp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user