m8sec / enumdb

Relational database brute force and post exploitation tool for MySQL and MSSQL
GNU General Public License v3.0
218 stars 64 forks source link

Error when running against MSSQL #2

Closed Pilly170 closed 6 years ago

Pilly170 commented 6 years ago

./enumdb.py 10.x.x.x -u sa -p sa -t mssql -columns `Starting enumdb v.2.0

[+] Connection established sa:sa@10.x.x.x [] Column: className Table: autoadmin_task_agents DB: msdb SRV: (mssql) [] Column: is_password_protected Table: backupmediaset DB: msdb SRV: (mssql) [*] Column: is_password_protected Table: backupset DB: msdb SRV: 10.60.111.107 (mssql) Exception in thread Thread-1: Traceback (most recent call last): File "pymssql.pyx", line 447, in pymssql.Cursor.execute File "_mssql.pyx", line 1011, in _mssql.MSSQLConnection.execute_query File "_mssql.pyx", line 1042, in _mssql.MSSQLConnection.execute_query File "_mssql.pyx", line 1175, in _mssql.MSSQLConnection.format_and_run_query File "_mssql.pyx", line 1586, in _mssql.check_cancel_and_raise File "_mssql.pyx", line 1630, in _mssql.maybe_raise_MSSQLDatabaseException _mssql.MSSQLDatabaseException: (942, b"Database 'IGT' cannot be opened because it is offline.DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\n")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "./enumdb.py", line 197, in db_main self.db_enum(class_obj, args.dbtype, con, outfile, target, args.column_search, args.report, args.verbose) File "./enumdb.py", line 206, in db_enum for table in db_class.get_tables(con, database): File "./enumdb.py", line 165, in get_tables for x in self.db_query(con, 'SELECT NAME FROM {}.sys.tables;'.format(database)): File "./enumdb.py", line 152, in db_query cur.execute(cmd) File "pymssql.pyx", line 467, in pymssql.Cursor.execute pymssql.OperationalError: (942, b"Database 'IGT' cannot be opened because it is offline.DB-Lib error message 20018, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\n") `

m8sec commented 6 years ago

Hey @Pilly170,

Thanks for providing your output, it was helpful in replicating the issue. It appears the database is set to "Offline". I added more error handling to the script to catch this exception, let me know if it does the trick.

offline_mode

Thanks for your help, m8r0wn

m8sec commented 6 years ago

Closing issue