From 5772d8904df6fd7539112277a33ee5b4a40bf1c2 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 9 Nov 2016 12:20:54 +0100 Subject: [PATCH] Fixes #2266 --- lib/core/replication.py | 14 ++++++++++---- lib/core/settings.py | 2 +- lib/utils/hashdb.py | 6 +++--- txt/checksum.md5 | 6 +++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/core/replication.py b/lib/core/replication.py index 92c591aa0..cd0292c3e 100644 --- a/lib/core/replication.py +++ b/lib/core/replication.py @@ -10,6 +10,7 @@ import sqlite3 from extra.safe2bin.safe2bin import safechardecode from lib.core.common import getSafeExString from lib.core.common import unsafeSQLIdentificatorNaming +from lib.core.exception import SqlmapConnectionException from lib.core.exception import SqlmapGenericException from lib.core.exception import SqlmapValueException from lib.core.settings import UNICODE_ENCODING @@ -21,10 +22,15 @@ class Replication(object): """ def __init__(self, dbpath): - self.dbpath = dbpath - self.connection = sqlite3.connect(dbpath) - self.connection.isolation_level = None - self.cursor = self.connection.cursor() + try: + self.dbpath = dbpath + self.connection = sqlite3.connect(dbpath) + self.connection.isolation_level = None + self.cursor = self.connection.cursor() + except sqlite3.OperationalError, ex: + errMsg = "error occurred while opening a replication " + errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex)) + raise SqlmapConnectionException(errMsg) class DataType: """ diff --git a/lib/core/settings.py b/lib/core/settings.py index db9bca884..7b7386867 100755 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.0.11.8" +VERSION = "1.0.11.9" 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) diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index 90146abbf..f31f016b2 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -17,7 +17,7 @@ from lib.core.common import serializeObject from lib.core.common import singleTimeWarnMessage from lib.core.common import unserializeObject from lib.core.data import logger -from lib.core.exception import SqlmapDataException +from lib.core.exception import SqlmapConnectionException from lib.core.settings import HASHDB_END_TRANSACTION_RETRIES from lib.core.settings import HASHDB_FLUSH_RETRIES from lib.core.settings import HASHDB_FLUSH_THRESHOLD @@ -44,7 +44,7 @@ class HashDB(object): except Exception, ex: errMsg = "error occurred while opening a session " errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex)) - raise SqlmapDataException(errMsg) + raise SqlmapConnectionException(errMsg) return threadData.hashDBCursor @@ -92,7 +92,7 @@ class HashDB(object): except sqlite3.DatabaseError, ex: errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex)) errMsg += "If the problem persists please rerun with `--flush-session`" - raise SqlmapDataException, errMsg + raise SqlmapConnectionException, errMsg else: break diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 12c72f66c..3df8e4670 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -42,10 +42,10 @@ d027df65e7cbb99758daf77aaa6ab61c lib/core/optiondict.py eb5e96b4baef52ad172e0359c1783d83 lib/core/option.py 7af487340c138f7b5dbd443161cbb428 lib/core/profiling.py e60456db5380840a586654344003d4e6 lib/core/readlineng.py -4502017bfdabd9d29bba10fed1b54e35 lib/core/replication.py +b3a62d41a5af6cd7fa733b6227febb0c lib/core/replication.py 99a2b496b9d5b546b335653ca801153f lib/core/revision.py 7c15dd2777af4dac2c89cab6df17462e lib/core/session.py -e9e85d7705eb178f10e1205d8b3a2a00 lib/core/settings.py +029fde655c5314b617c5479058738c1d lib/core/settings.py 7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py 23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py c3ace7874a536d801f308cf1fd03df99 lib/core/target.py @@ -103,7 +103,7 @@ f5d6884cdeed28281187c111d3e49e3b lib/techniques/union/test.py 8cdc8c1e663c3b92a756fb7b02cc3c02 lib/utils/crawler.py 84604ae4cf0f31602b412036b51f5dae lib/utils/deps.py 4dfd3a95e73e806f62372d63bc82511f lib/utils/getch.py -f20b306a3895e9585834c3491dcfc8d5 lib/utils/hashdb.py +f71a7b0aec145ba77edd3c4543621fb9 lib/utils/hashdb.py 0330607242d4f704ae6d7bba5f52ccae lib/utils/hash.py a3e885f7d4c6ff05db1156244bb84158 lib/utils/htmlentities.py cc9c82cfffd8ee9b25ba3af6284f057e lib/utils/__init__.py