|
15 | 15 | import hashlib |
16 | 16 | import httplib |
17 | 17 | import inspect |
| 18 | +import io |
18 | 19 | import json |
19 | 20 | import keyword |
20 | 21 | import locale |
|
40 | 41 |
|
41 | 42 | from ConfigParser import DEFAULTSECT |
42 | 43 | from ConfigParser import RawConfigParser |
43 | | -from StringIO import StringIO |
44 | 44 | from difflib import SequenceMatcher |
45 | 45 | from math import sqrt |
46 | 46 | from optparse import OptionValueError |
|
158 | 158 | from lib.core.settings import REFLECTED_REPLACEMENT_TIMEOUT |
159 | 159 | from lib.core.settings import REFLECTED_VALUE_MARKER |
160 | 160 | from lib.core.settings import REFLECTIVE_MISS_THRESHOLD |
161 | | -from lib.core.settings import SAFE_VARIABLE_MARKER |
162 | 161 | from lib.core.settings import SENSITIVE_DATA_REGEX |
163 | 162 | from lib.core.settings import SENSITIVE_OPTIONS |
164 | 163 | from lib.core.settings import STDIN_PIPE_DASH |
@@ -2079,7 +2078,7 @@ def parseXmlFile(xmlFile, handler): |
2079 | 2078 | """ |
2080 | 2079 |
|
2081 | 2080 | try: |
2082 | | - with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream: |
| 2081 | + with contextlib.closing(io.StringIO(readCachedFileContent(xmlFile))) as stream: |
2083 | 2082 | parse(stream, handler) |
2084 | 2083 | except (SAXParseException, UnicodeError) as ex: |
2085 | 2084 | errMsg = "something appears to be wrong with " |
@@ -3322,7 +3321,7 @@ def openFile(filename, mode='r', encoding=UNICODE_ENCODING, errors="replace", bu |
3322 | 3321 | if filename not in kb.cache.content: |
3323 | 3322 | kb.cache.content[filename] = sys.stdin.read() |
3324 | 3323 |
|
3325 | | - return contextlib.closing(StringIO(readCachedFileContent(filename))) |
| 3324 | + return contextlib.closing(io.StringIO(readCachedFileContent(filename))) |
3326 | 3325 | else: |
3327 | 3326 | try: |
3328 | 3327 | return codecs.open(filename, mode, encoding, errors, buffering) |
@@ -4107,9 +4106,9 @@ def findPageForms(content, url, raise_=False, addToTargets=False): |
4107 | 4106 | set([(u'/input.php', 'POST', u'id=1', None, None)]) |
4108 | 4107 | """ |
4109 | 4108 |
|
4110 | | - class _(StringIO): |
| 4109 | + class _(io.BytesIO): |
4111 | 4110 | def __init__(self, content, url): |
4112 | | - StringIO.__init__(self, unicodeencode(content, kb.pageEncoding) if isinstance(content, unicode) else content) |
| 4111 | + io.BytesIO.__init__(self, unicodeencode(content, kb.pageEncoding) if isinstance(content, unicode) else content) |
4113 | 4112 | self._url = url |
4114 | 4113 |
|
4115 | 4114 | def geturl(self): |
|
0 commit comments