mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-06-30 05:21:15 +00:00
Minor fix
This commit is contained in:
parent
7774c73291
commit
fd7eaf107b
7 changed files with 52 additions and 12 deletions
|
|
@ -73,6 +73,15 @@ def bootstrap():
|
|||
import logging
|
||||
logging.getLogger("sqlmapLog").setLevel(logging.CRITICAL + 1)
|
||||
|
||||
# Some console output bypasses the logger entirely and goes straight through dataToStdout():
|
||||
# the \r-progress lines ("[INFO] retrieved: ...", "[INFO] cracked password ..."), and the echo
|
||||
# of batch-auto-answered readInput() prompts (the fingerprint-mismatch prompt, the LIKE/exact
|
||||
# and common-wordlist choices, ...). dataToStdout() only writes forced output or when
|
||||
# kb.wizardMode is False, and readInput() echoes with forceOutput=not kb.wizardMode - so setting
|
||||
# wizardMode keeps the unittest report to just dots. wizardMode is read ONLY by dataToStdout/
|
||||
# readInput (plus the interactive wizard flow, unused here), so this has no effect on results.
|
||||
kb.wizardMode = True
|
||||
|
||||
sys.argv = _orig_argv # restore so unittest's arg parsing works
|
||||
_BOOTSTRAPPED = True
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,18 @@ class _CrackBase(unittest.TestCase):
|
|||
conf.hashDB = None
|
||||
kb.wordlists = [self.wordlist]
|
||||
|
||||
# cracking prints "[INFO] cracked password ..." via dataToStdout(forceOutput=True), which
|
||||
# bypasses both the logger and kb.wizardMode suppression; redirect stdout so the unittest
|
||||
# report stays clean (these tests assert on return values/kb, never on console output).
|
||||
self._saved_stdout = sys.stdout
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
|
||||
def tearDown(self):
|
||||
if getattr(self, "_saved_stdout", None) is not None:
|
||||
try:
|
||||
sys.stdout.close()
|
||||
finally:
|
||||
sys.stdout = self._saved_stdout
|
||||
conf.disableMulti = self._saved["disableMulti"]
|
||||
conf.hashDB = self._saved["hashDB"]
|
||||
conf.hashFile = self._saved["hashFile"]
|
||||
|
|
|
|||
|
|
@ -435,6 +435,8 @@ class TestRealXPathSyntax(unittest.TestCase):
|
|||
payload = xpath._makePayload(original, boundary, "true()")
|
||||
try:
|
||||
count = self._count(template, payload)
|
||||
except unittest.SkipTest:
|
||||
raise # lxml unavailable -> skip cleanly; SkipTest is an Exception, so the broad except below would otherwise mask it into a failure
|
||||
except Exception as e:
|
||||
self.fail("Boundary '%s' in '%s' with orig='%s' invalid: %s\n payload: %s" % (bk, tkey, original, e, payload))
|
||||
self.assertIsInstance(count, int,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue