diff --git a/src/sqlmap-master/sqlmap.py b/src/sqlmap-master/sqlmap.py index cd8385d..c7e86f0 100644 --- a/src/sqlmap-master/sqlmap.py +++ b/src/sqlmap-master/sqlmap.py @@ -518,27 +518,32 @@ def main(): # 抛出SystemExit异常,导致程序退出 raise SystemExit + # 检查错误信息中是否包含特定的错误关键词,如果包含,则认为是运行时环境错误,并提取错误信息的最后部分。 elif any(_ in excMsg for _ in ("ImportError", "ModuleNotFoundError", " returned NULL without setting an exception", "source code string cannot contain null bytes", "No module named", "tp_name field", "module 'sqlite3' has no attribute 'OperationalError'")): errMsg = "invalid runtime environment ('%s')" % excMsg.split("Error: ")[-1].strip() logger.critical(errMsg) raise SystemExit + # 如果错误信息包含非ASCII字符编码错误,则认为是运行时环境错误,并提取错误信息的最后部分。 elif all(_ in excMsg for _ in ("SyntaxError: Non-ASCII character", ".py on line", "but no encoding declared")): errMsg = "invalid runtime environment ('%s')" % excMsg.split("Error: ")[-1].strip() logger.critical(errMsg) raise SystemExit + # 如果错误信息包含文件不存在的错误,则认为是运行时环境错误,并提取错误信息的最后部分。 elif all(_ in excMsg for _ in ("FileNotFoundError: [Errno 2] No such file or directory", "cwd = os.getcwd()")): errMsg = "invalid runtime environment ('%s')" % excMsg.split("Error: ")[-1].strip() logger.critical(errMsg) raise SystemExit + # 如果错误信息包含权限错误,则提示用户可能存在权限问题,并建议重新运行程序时禁用多进程。 elif all(_ in excMsg for _ in ("PermissionError: [WinError 5]", "multiprocessing")): errMsg = "there is a permission problem in running multiprocessing on this system. " errMsg += "Please rerun with '--disable-multi'" logger.critical(errMsg) raise SystemExit + # 如果错误信息包含文件不存在的错误,则提示用户安装可能已损坏,并建议从官方GitHub仓库获取最新开发版本。 elif all(_ in excMsg for _ in ("No such file", "_'")): errMsg = "corrupted installation detected ('%s'). " % excMsg.strip().split('\n')[-1] errMsg += "You should retrieve the latest development version from official GitHub " @@ -546,17 +551,20 @@ def main(): logger.critical(errMsg) raise SystemExit + # 如果错误信息包含尝试在生产环境中运行开发测试的错误,则输出相应的错误信息。 elif all(_ in excMsg for _ in ("No such file", "sqlmap.conf", "Test")): errMsg = "you are trying to run (hidden) development tests inside the production environment" logger.critical(errMsg) raise SystemExit + # 如果错误信息包含HTTP NTLM认证相关的兼容性问题,则输出相应的错误信息,并提供参考链接。 elif all(_ in excMsg for _ in ("HTTPNtlmAuthHandler", "'str' object has no attribute 'decode'")): errMsg = "package 'python-ntlm' has a known compatibility issue with the " - errMsg += "Python 3 (Reference: 'https://github.com/mullender/python-ntlm/pull/61')" + errMsg += "Python 3 (Reference: 'https://github.com/mullender/python-ntlm/pull/61')" " logger.critical(errMsg) raise SystemExit + # 如果错误信息包含字典对象属性错误,并且与枚举相关,则提示用户可能存在枚举问题,并建议重新运行程序时刷新会话。 elif "'DictObject' object has no attribute '" in excMsg and all(_ in errMsg for _ in ("(fingerprinted)", "(identified)")): errMsg = "there has been a problem in enumeration. " errMsg += "Because of a considerable chance of false-positive case " @@ -564,17 +572,20 @@ def main(): logger.critical(errMsg) raise SystemExit + # 如果错误信息包含数据库磁盘映像损坏的错误,则提示用户会话文件可能损坏,并建议刷新会话。 elif "database disk image is malformed" in excMsg: errMsg = "local session file seems to be malformed. Please rerun with '--flush-session'" logger.critical(errMsg) raise SystemExit + # 如果错误信息包含模块属性错误,则认为是运行时环境错误,并提取错误信息的最后部分。 elif "AttributeError: 'module' object has no attribute 'F_GETFD'" in excMsg: errMsg = "invalid runtime (\"%s\") " % excMsg.split("Error: ")[-1].strip() - errMsg += "(Reference: 'https://stackoverflow.com/a/38841364' & 'https://bugs.python.org/issue24944#msg249231')" + errMsg += "(Reference: 'https://stackoverflow.com/a/38841364' & 'https://bugs.python.org/issue24944#msg249231')" " logger.critical(errMsg) raise SystemExit + # 如果错误信息包含marshal数据错误,则提示用户.pyc文件可能损坏,并建议删除.pyc文件来解决问题。 elif "bad marshal data (unknown type code)" in excMsg: match = re.search(r"\s*(.+)\s+ValueError", excMsg) errMsg = "one of your .pyc files are corrupted%s" % (" ('%s')" % match.group(1) if match else "")