1212from lib .utils import versioncheck # this has to be the first non-standard import
1313
1414import bdb
15+ import distutils
1516import inspect
1617import logging
1718import os
4950from lib .core .option import init
5051from lib .core .profiling import profile
5152from lib .core .settings import LEGAL_DISCLAIMER
53+ from lib .core .settings import VERSION
5254from lib .core .testing import smokeTest
5355from lib .core .testing import liveTest
5456from lib .parse .cmdline import cmdLineParser
@@ -68,21 +70,33 @@ def modulePath():
6870
6971 return getUnicode (os .path .dirname (os .path .realpath (_ )), encoding = sys .getfilesystemencoding ())
7072
73+ def checkEnvironment ():
74+ paths .SQLMAP_ROOT_PATH = modulePath ()
75+
76+ try :
77+ os .path .isdir (paths .SQLMAP_ROOT_PATH )
78+ except UnicodeEncodeError :
79+ errMsg = "your system does not properly handle non-ASCII paths. "
80+ errMsg += "Please move the sqlmap's directory to the other location"
81+ logger .critical (errMsg )
82+ raise SystemExit
83+
84+ #if distutils.version.LooseVersion(VERSION) < distutils.version.LooseVersion("1.0"):
85+ if True :
86+ errMsg = "your runtime environment (e.g. PYTHONPATH) is "
87+ errMsg += "broken. Please make sure that you are not running "
88+ errMsg += "newer versions of sqlmap with runtime scripts for older "
89+ errMsg += "versions"
90+ logger .critical (errMsg )
91+ raise SystemExit
92+
7193def main ():
7294 """
7395 Main function of sqlmap when running from command line.
7496 """
7597
7698 try :
77- paths .SQLMAP_ROOT_PATH = modulePath ()
78-
79- try :
80- os .path .isdir (paths .SQLMAP_ROOT_PATH )
81- except UnicodeEncodeError :
82- errMsg = "your system does not properly handle non-ASCII paths. "
83- errMsg += "Please move the sqlmap's directory to the other location"
84- logger .error (errMsg )
85- raise SystemExit
99+ checkEnvironment ()
86100
87101 setPaths ()
88102 banner ()
0 commit comments