Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Fixed incorrect error handling when database wasn't created
Browse files Browse the repository at this point in the history
(part of issue #93)
  • Loading branch information
byt3bl33d3r committed Apr 4, 2016
1 parent cd98987 commit a1c41d9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crackmapexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@
logger.error("I'm sorry {}, I'm afraid I can't let you do that".format(getpass.getuser()))
sys.exit(1)

if not os.path.exists('data/cme.db'):
logger.error('Could not find CME database, did you run the setup_database.py script?')
sys.exit(1)

if not args.server_port:
args.server_port = server_port_dict[args.server]

try:
# set the database connection to autocommit w/ isolation level
db_connection = sqlite3.connect('data/cme.db', check_same_thread=False)
db_connection.text_factory = str
db_connection.isolation_level = None
db = CMEDatabase(db_connection)
except Exception as e:
logger.error("Could not connect to CME database: {}".format(e))
sys.exit(1)
# set the database connection to autocommit w/ isolation level
db_connection = sqlite3.connect('data/cme.db', check_same_thread=False)
db_connection.text_factory = str
db_connection.isolation_level = None
db = CMEDatabase(db_connection)

if args.cred_id:
try:
Expand Down

0 comments on commit a1c41d9

Please sign in to comment.