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

Skip to content

Commit ec1ac81

Browse files
committed
Minor refactoring
1 parent 6ba46bf commit ec1ac81

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.8.16"
22+
VERSION = "1.0.8.17"
2323
REVISION = getRevisionNumber()
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}

lib/utils/api.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,33 +224,33 @@ def write(self, value, status=CONTENT_STATUS.IN_PROGRESS, content_type=None):
224224
# Ignore all non-relevant messages
225225
return
226226

227-
output = conf.database_cursor.execute(
227+
output = conf.databaseCursor.execute(
228228
"SELECT id, status, value FROM data WHERE taskid = ? AND content_type = ?",
229229
(self.taskid, content_type))
230230

231231
# Delete partial output from IPC database if we have got a complete output
232232
if status == CONTENT_STATUS.COMPLETE:
233233
if len(output) > 0:
234234
for index in xrange(len(output)):
235-
conf.database_cursor.execute("DELETE FROM data WHERE id = ?",
235+
conf.databaseCursor.execute("DELETE FROM data WHERE id = ?",
236236
(output[index][0],))
237237

238-
conf.database_cursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)",
238+
conf.databaseCursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)",
239239
(self.taskid, status, content_type, jsonize(value)))
240240
if kb.partRun:
241241
kb.partRun = None
242242

243243
elif status == CONTENT_STATUS.IN_PROGRESS:
244244
if len(output) == 0:
245-
conf.database_cursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)",
245+
conf.databaseCursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)",
246246
(self.taskid, status, content_type,
247247
jsonize(value)))
248248
else:
249249
new_value = "%s%s" % (dejsonize(output[0][2]), value)
250-
conf.database_cursor.execute("UPDATE data SET value = ? WHERE id = ?",
250+
conf.databaseCursor.execute("UPDATE data SET value = ? WHERE id = ?",
251251
(jsonize(new_value), output[0][0]))
252252
else:
253-
conf.database_cursor.execute("INSERT INTO errors VALUES(NULL, ?, ?)",
253+
conf.databaseCursor.execute("INSERT INTO errors VALUES(NULL, ?, ?)",
254254
(self.taskid, str(value) if value else ""))
255255

256256
def flush(self):
@@ -269,16 +269,16 @@ def emit(self, record):
269269
Record emitted events to IPC database for asynchronous I/O
270270
communication with the parent process
271271
"""
272-
conf.database_cursor.execute("INSERT INTO logs VALUES(NULL, ?, ?, ?, ?)",
272+
conf.databaseCursor.execute("INSERT INTO logs VALUES(NULL, ?, ?, ?, ?)",
273273
(conf.taskid, time.strftime("%X"), record.levelname,
274274
record.msg % record.args if record.args else record.msg))
275275

276276

277277
def setRestAPILog():
278278
if hasattr(conf, "api"):
279279
try:
280-
conf.database_cursor = Database(conf.database)
281-
conf.database_cursor.connect("client")
280+
conf.databaseCursor = Database(conf.database)
281+
conf.databaseCursor.connect("client")
282282
except sqlite3.OperationalError, ex:
283283
raise SqlmapConnectionException, "%s ('%s')" % (ex, conf.database)
284284

sqlmap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def main():
300300

301301
if hasattr(conf, "api"):
302302
try:
303-
conf.database_cursor.disconnect()
303+
conf.databaseCursor.disconnect()
304304
except KeyboardInterrupt:
305305
pass
306306

@@ -314,10 +314,10 @@ def main():
314314
time.sleep(0.01)
315315
except KeyboardInterrupt:
316316
pass
317-
318-
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
319-
if threading.activeCount() > 1:
320-
os._exit(0)
317+
finally:
318+
# Reference: http://stackoverflow.com/questions/1635080/terminate-a-multi-thread-python-program
319+
if threading.activeCount() > 1:
320+
os._exit(0)
321321

322322
if __name__ == "__main__":
323323
main()

txt/checksum.md5

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ e60456db5380840a586654344003d4e6 lib/core/readlineng.py
4545
5ef56abb8671c2ca6ceecb208258e360 lib/core/replication.py
4646
99a2b496b9d5b546b335653ca801153f lib/core/revision.py
4747
7c15dd2777af4dac2c89cab6df17462e lib/core/session.py
48-
3213c60c98bcb3037a74cbdde92c10a1 lib/core/settings.py
48+
c857eea31beebb5aac5719c2329bbaf3 lib/core/settings.py
4949
7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py
5050
23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py
5151
0bc2fae1dec18cdd11954b22358293f2 lib/core/target.py
@@ -100,7 +100,7 @@ cc9c82cfffd8ee9b25ba3af6284f057e lib/techniques/__init__.py
100100
cc9c82cfffd8ee9b25ba3af6284f057e lib/techniques/union/__init__.py
101101
f5d6884cdeed28281187c111d3e49e3b lib/techniques/union/test.py
102102
12ce1bb7ee5f1f23f58be12fe9fa8472 lib/techniques/union/use.py
103-
d05be2ba94734e95150a33aec05d3d9b lib/utils/api.py
103+
26c1babc6289fac9056f8b21d10f3bb1 lib/utils/api.py
104104
8cdc8c1e663c3b92a756fb7b02cc3c02 lib/utils/crawler.py
105105
393f8fd1684308213e1d2e6a9d4258c2 lib/utils/deps.py
106106
4dfd3a95e73e806f62372d63bc82511f lib/utils/getch.py
@@ -218,7 +218,7 @@ c3cc8b7727161e64ab59f312c33b541a shell/stager.aspx_
218218
1f7f125f30e0e800beb21e2ebbab18e1 shell/stager.jsp_
219219
01e3505e796edf19aad6a996101c81c9 shell/stager.php_
220220
56702e95555adee718b6a11ee7098fd4 sqlmapapi.py
221-
7e80fcefc56426ed780c48556b70a1f0 sqlmap.py
221+
b7b44bffd0fdc4a793427a0fcc674d24 sqlmap.py
222222
1316deb997418507e76221c84ec99946 tamper/apostrophemask.py
223223
a6efe8f914c769c52afec703bd73609f tamper/apostrophenullencode.py
224224
b1c56983919b69f4f6f0e7929c881e7a tamper/appendnullbyte.py

0 commit comments

Comments
 (0)