mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 04:53:48 +03:00
Better way how to deal with required extensions
This commit is contained in:
parent
3f6d4083a7
commit
f54082111d
|
@ -6,24 +6,12 @@ See the file 'doc/COPYING' for copying permission
|
|||
"""
|
||||
|
||||
import codecs
|
||||
import gzip
|
||||
import logging
|
||||
import re
|
||||
import StringIO
|
||||
import struct
|
||||
|
||||
try:
|
||||
import bz2
|
||||
import gzip
|
||||
import sqlite3
|
||||
import zlib
|
||||
except ImportError, ex:
|
||||
from lib.core.data import logger
|
||||
|
||||
errMsg = "missing one of core extensions (bz2, gzip, sqlite3, zlib) "
|
||||
errMsg += "probably because current version of Python has been "
|
||||
errMsg += "built without appropriate dev packages (e.g. libsqlite3-dev)"
|
||||
logger.critical(errMsg)
|
||||
raise SystemExit
|
||||
import zlib
|
||||
|
||||
from lib.core.common import extractErrorMessage
|
||||
from lib.core.common import extractRegexResult
|
||||
|
|
|
@ -11,3 +11,13 @@ PYVERSION = sys.version.split()[0]
|
|||
|
||||
if PYVERSION >= "3" or PYVERSION < "2.6":
|
||||
exit("[CRITICAL] incompatible Python version detected ('%s'). For successfully running sqlmap you'll have to use version 2.6 or 2.7 (visit 'http://www.python.org/download/')" % PYVERSION)
|
||||
|
||||
extensions = ("bz2", "gzip", "ssl", "sqlite3", "zlib")
|
||||
try:
|
||||
for _ in extensions:
|
||||
__import__(_)
|
||||
except ImportError, ex:
|
||||
errMsg = "missing one or more core extensions (%s) " % (", ".join("'%s'" % _ for _ in extensions))
|
||||
errMsg += "most probably because current version of Python has been "
|
||||
errMsg += "built without appropriate dev packages (e.g. 'libsqlite3-dev')"
|
||||
exit(errMsg)
|
Loading…
Reference in New Issue
Block a user