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

Skip to content

Commit 8cdc66f

Browse files
committed
Bug fix (multiple Ctrl-C in crawling mode)
1 parent 72fa5a9 commit 8cdc66f

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
19091909
kb.injections = []
19101910
kb.laggingChecked = False
19111911
kb.lastParserStatus = None
1912+
kb.lastCtrlCTime = None
19121913

19131914
kb.locks = AttribDict()
19141915
for _ in ("cache", "connError", "count", "handlers", "hint", "index", "io", "limit", "log", "socket", "redirect", "request", "value"):

lib/core/settings.py

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

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

lib/core/threads.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
185185
kb.threadContinue = False
186186
kb.threadException = True
187187

188+
if kb.lastCtrlCTime and (time.time() - kb.lastCtrlCTime < 1):
189+
kb.multipleCtrlC = True
190+
raise SqlmapUserQuitException("user aborted (Ctrl+C was pressed multiple times)")
191+
192+
kb.lastCtrlCTime = time.time()
193+
188194
if numThreads > 1:
189195
logger.info("waiting for threads to finish%s" % (" (Ctrl+C was pressed)" if isinstance(ex, KeyboardInterrupt) else ""))
190196
try:

sqlmap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def main():
200200
if not isinstance(ex, SqlmapUserQuitException):
201201
errMsg = "problem occurred while crawling '%s' ('%s')" % (target, getSafeExString(ex))
202202
logger.error(errMsg)
203+
else:
204+
raise
203205
else:
204206
if kb.targets:
205207
start()

0 commit comments

Comments
 (0)