Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f01cbf

Browse files
committed
Patching some resource-related warnings
1 parent 1e9e33d commit 2f01cbf

4 files changed

Lines changed: 30 additions & 20 deletions

File tree

data/txt/sha256sums.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ f9c96cd3fe99578bed9d49a8bdf8d76836d320a7c48c56eb0469f48b36775c35 lib/controller
165165
99d0e94dd5fe60137abf48bfa051129fb251f5c40f0f7a270c89fbcb07323730 lib/controller/__init__.py
166166
826c33f1105be4c0985e1bbe1d75bdb009c17815ad6552fc8d9bf39090d3c40f lib/core/agent.py
167167
b2d69c99632da5c2acd0c0934e70d55862f1380a3f602cbe7456d617fb9c1fc9 lib/core/bigarray.py
168-
ba3f0002aa93f8f21f06dbea343573c590b9e6ec160fc6668c15e68a970cfb12 lib/core/common.py
168+
a4863238aba3a2d203c26127a4a7a6df873bd0c6f1cd798d4a7abcdc71a07cb6 lib/core/common.py
169169
5c26b0f308266bc3a9679ef837439e38d1dc7a69eac6bd3422280f49aaf114d2 lib/core/compat.py
170170
b60c96780cad4a257f91a0611b08cfcc52f242908c5d5ab2bf9034ef07869602 lib/core/convert.py
171171
5e381515873e71c395c77df00bf1dd8c4592afc6210a2f75cbc20daf384e539f lib/core/data.py
@@ -187,11 +187,11 @@ bf77f9fc4296f239687297aee1fd6113b34f855965a6f690b52e26bd348cb353 lib/core/profi
187187
4eff81c639a72b261c8ba1c876a01246e718e6626e8e77ae9cc6298b20a39355 lib/core/replication.py
188188
bbd1dcda835934728efc6d68686e9b0da72b09b3ee38f3c0ab78e8c18b0ba726 lib/core/revision.py
189189
eed6b0a21b3e69c5583133346b0639dc89937bd588887968ee85f8389d7c3c96 lib/core/session.py
190-
df96b0f2f935c583492c6331c6f222427976606af9a03ee5f05755a697ea7cec lib/core/settings.py
190+
4cc89d1791e21b3bb4739039cb7eb57659370ab7008902eb80871c85a52c263f lib/core/settings.py
191191
2bec97d8a950f7b884e31dfe9410467f00d24f21b35672b95f8d68ed59685fd4 lib/core/shell.py
192192
e90a359b37a55c446c60e70ccd533f87276714d0b09e34f69b0740fd729ddbf8 lib/core/subprocessng.py
193193
54f7c70b4c7a9931f7ff3c1c12030180bde38e35a306d5e343ad6052919974cd lib/core/target.py
194-
5941a7a641ea58b1d9e59ab3c9f4e9e40566ba08842e1cadb51ea8df9faf763f lib/core/testing.py
194+
970b1c3e59481f11dd185bdde52f697f7d8dfc3152d24e3d336ec3fab59a857c lib/core/testing.py
195195
8cb7424aa9d42d028a6780250effe4e719d9bb35558057f8ebe9e32408a6b80f lib/core/threads.py
196196
ff39235aee7e33498c66132d17e6e86e7b8a29754e3fdecd880ca8356b17f791 lib/core/unescaper.py
197197
2984e4973868f586aa932f00da684bf31718c0331817c9f8721acd71fd661f89 lib/core/update.py

lib/core/common.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,10 @@ def isZipFile(filename):
13331333

13341334
checkFile(filename)
13351335

1336-
return openFile(filename, "rb", encoding=None).read(len(ZIP_HEADER)) == ZIP_HEADER
1336+
with openFile(filename, "rb", encoding=None) as f:
1337+
header = f.read(len(ZIP_HEADER))
1338+
1339+
return header == ZIP_HEADER
13371340

13381341
def isDigit(value):
13391342
"""
@@ -2533,21 +2536,22 @@ def initCommonOutputs():
25332536
kb.commonOutputs = {}
25342537
key = None
25352538

2536-
for line in openFile(paths.COMMON_OUTPUTS, 'r'):
2537-
if line.find('#') != -1:
2538-
line = line[:line.find('#')]
2539+
with openFile(paths.COMMON_OUTPUTS, 'r') as f:
2540+
for line in f:
2541+
if line.find('#') != -1:
2542+
line = line[:line.find('#')]
25392543

2540-
line = line.strip()
2544+
line = line.strip()
25412545

2542-
if len(line) > 1:
2543-
if line.startswith('[') and line.endswith(']'):
2544-
key = line[1:-1]
2545-
elif key:
2546-
if key not in kb.commonOutputs:
2547-
kb.commonOutputs[key] = set()
2546+
if len(line) > 1:
2547+
if line.startswith('[') and line.endswith(']'):
2548+
key = line[1:-1]
2549+
elif key:
2550+
if key not in kb.commonOutputs:
2551+
kb.commonOutputs[key] = set()
25482552

2549-
if line not in kb.commonOutputs[key]:
2550-
kb.commonOutputs[key].add(line)
2553+
if line not in kb.commonOutputs[key]:
2554+
kb.commonOutputs[key].add(line)
25512555

25522556
def getFileItems(filename, commentPrefix='#', unicoded=True, lowercase=False, unique=False):
25532557
"""
@@ -5594,7 +5598,9 @@ def checkSums():
55945598
expected, filename = match.groups()
55955599
filepath = os.path.join(paths.SQLMAP_ROOT_PATH, filename).replace('/', os.path.sep)
55965600
checkFile(filepath)
5597-
if not hashlib.sha256(open(filepath, "rb").read()).hexdigest() == expected:
5601+
with open(filepath, "rb") as f:
5602+
content = f.read()
5603+
if not hashlib.sha256(content).hexdigest() == expected:
55985604
retVal &= False
55995605
break
56005606

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.8.4.3"
23+
VERSION = "1.8.4.5"
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def _thread():
162162
direct = "sqlite3://%s" % database
163163
tmpdir = tempfile.mkdtemp()
164164

165-
content = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.conf"))).read().replace("url =", "url = %s" % url)
165+
with open(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.conf"))) as f:
166+
content = f.read().replace("url =", "url = %s" % url)
167+
166168
with open(config, "w+") as f:
167169
f.write(content)
168170
f.flush()
@@ -214,7 +216,9 @@ def smokeTest():
214216

215217
unisonRandom()
216218

217-
content = open(paths.ERRORS_XML, "r").read()
219+
with open(paths.ERRORS_XML, "r") as f:
220+
content = f.read()
221+
218222
for regex in re.findall(r'<error regexp="(.+?)"/>', content):
219223
try:
220224
re.compile(regex)

0 commit comments

Comments
 (0)