Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running against MSSQL #2

Closed
Pilly170 opened this issue Jul 26, 2018 · 2 comments
Closed

Error when running against MSSQL #2

Pilly170 opened this issue Jul 26, 2018 · 2 comments

Comments

@Pilly170
Copy link

./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
Copy link
Owner

m8sec commented Jul 30, 2018

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
Copy link
Owner

m8sec commented Aug 6, 2018

Closing issue

@m8sec m8sec closed this as completed Aug 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants