Skip to content

Commit 5ea5fc8

Browse files
committed
Fixing a problem with pypy (explicit flush needed)
1 parent 374f38f commit 5ea5fc8

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.5.9.21"
23+
VERSION = "1.5.9.22"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/testing.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,29 @@ def _thread():
121121
os.close(handle)
122122

123123
content = "POST / HTTP/1.0\nUser-agent: foobar\nHost: %s:%s\n\nid=1\n" % (address, port)
124+
with open(request, "w+") as f:
125+
f.write(content)
126+
f.flush()
124127

125-
open(request, "w+").write(content)
126-
open(log, "w+").write('<port>%d</port><request base64="true"><![CDATA[%s]]></request>' % (port, encodeBase64(content, binary=False)))
128+
content = '<port>%d</port><request base64="true"><![CDATA[%s]]></request>' % (port, encodeBase64(content, binary=False))
129+
with open(log, "w+") as f:
130+
f.write(content)
131+
f.flush()
127132

128133
base = "http://%s:%d/" % (address, port)
129134
url = "%s?id=1" % base
130135
direct = "sqlite3://%s" % database
131136
tmpdir = tempfile.mkdtemp()
132137

133138
content = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.conf"))).read().replace("url =", "url = %s" % url)
134-
open(config, "w+").write(content)
135-
136-
open(multiple, "w+").write("%s?%s=%d\n%s?%s=%d\n%s&%s=1" % (base, randomStr(), randomInt(), base, randomStr(), randomInt(), url, randomStr()))
139+
with open(config, "w+") as f:
140+
f.write(content)
141+
f.flush()
142+
143+
content = "%s?%s=%d\n%s?%s=%d\n%s&%s=1" % (base, randomStr(), randomInt(), base, randomStr(), randomInt(), url, randomStr())
144+
with open(multiple, "w+") as f:
145+
f.write(content)
146+
f.flush()
137147

138148
for options, checks in TESTS:
139149
status = '%d/%d (%d%%) ' % (count, len(TESTS), round(100.0 * count / len(TESTS)))

0 commit comments

Comments
 (0)