mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-07-10 18:43:07 +00:00
Minor update
This commit is contained in:
parent
8db71f4d67
commit
165bf837c9
3 changed files with 8 additions and 17 deletions
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.7.45"
|
||||
VERSION = "1.10.7.46"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,11 @@ class TestReportErrorCapture(unittest.TestCase):
|
|||
# otherwise gate the ERROR record before it reaches the recorder (order-dependent flakiness)
|
||||
saved_level = logger.level
|
||||
logger.setLevel(logging.ERROR)
|
||||
# mute the existing console handler(s) so the deliberate ERROR below does not leak to the
|
||||
# unittest output; the recorder added by setupReportCollector next still captures it
|
||||
muted = [(handler, handler.level) for handler in logger.handlers]
|
||||
for handler, _ in muted:
|
||||
handler.setLevel(logging.CRITICAL + 1)
|
||||
collector = setupReportCollector()
|
||||
try:
|
||||
logger.error("boom %s", "here")
|
||||
|
|
@ -129,6 +134,8 @@ class TestReportErrorCapture(unittest.TestCase):
|
|||
self.assertTrue(any("boom here" in _ for _ in result["error"]))
|
||||
finally:
|
||||
logger.setLevel(saved_level)
|
||||
for handler, level in muted:
|
||||
handler.setLevel(level)
|
||||
for handler in list(logger.handlers):
|
||||
if isinstance(handler, ReportErrorRecorder):
|
||||
logger.removeHandler(handler)
|
||||
|
|
|
|||
|
|
@ -176,14 +176,9 @@ class TestLinterSelf(unittest.TestCase):
|
|||
self.assertEqual(checkSanity(u"SELECT \u0131d,ad FROM users"), [])
|
||||
|
||||
|
||||
# module-level coverage accounting (printed in tearDownModule)
|
||||
_COVERAGE = {"queries_dbms": 0, "queries_atoms": 0, "payload_atoms": 0}
|
||||
|
||||
|
||||
class TestCatalogCoverage(unittest.TestCase):
|
||||
def test_queries_xml_clean(self):
|
||||
atoms = _queries_atoms()
|
||||
_COVERAGE["queries_dbms"] = len(atoms)
|
||||
total = 0
|
||||
for dbms, items in atoms.items():
|
||||
for raw in items:
|
||||
|
|
@ -191,12 +186,10 @@ class TestCatalogCoverage(unittest.TestCase):
|
|||
issues = checkSanity(_materialize(raw))
|
||||
self.assertEqual(issues, [],
|
||||
"queries.xml [%s] malformed atom: %r -> %s" % (dbms, raw, issues))
|
||||
_COVERAGE["queries_atoms"] = total
|
||||
self.assertGreater(total, 1000) # sanity: the catalog was actually walked
|
||||
|
||||
def test_payloads_xml_clean(self):
|
||||
items = _payload_atoms()
|
||||
_COVERAGE["payload_atoms"] = len(items)
|
||||
for name, title, raw in items:
|
||||
issues = checkSanity(_materialize(raw))
|
||||
self.assertEqual(issues, [],
|
||||
|
|
@ -204,14 +197,5 @@ class TestCatalogCoverage(unittest.TestCase):
|
|||
self.assertGreater(len(items), 500)
|
||||
|
||||
|
||||
def tearDownModule():
|
||||
q = _COVERAGE
|
||||
total = q["queries_atoms"] + q["payload_atoms"]
|
||||
sys.stderr.write(
|
||||
"\n[sqllint coverage] atom-level: %d SQL atoms linted clean "
|
||||
"(%d queries.xml across %d/30 DBMSes + %d payloads.xml vectors)\n"
|
||||
% (total, q["queries_atoms"], q["queries_dbms"], q["payload_atoms"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue