Skip to content

Commit

Permalink
Merge pull request #1609 from exploide:mssqlshell-enum_impersonate-us…
Browse files Browse the repository at this point in the history
…e_db
  • Loading branch information
exploide authored Sep 13, 2023
1 parent 3f64510 commit 0017927
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions impacket/examples/mssqlshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def do_help(self, line):
disable_xp_cmdshell - you know what it means
enum_db - enum databases
enum_links - enum linked servers
enum_impersonate - check logins that can be impersonate
enum_impersonate - check logins that can be impersonated
enum_logins - enum login users
enum_users - enum current db users
enum_owner - enum db owner
Expand Down Expand Up @@ -203,6 +203,7 @@ def do_enum_owner(self, line):
pass

def do_enum_impersonate(self, line):
old_db = self.sql.currentDB
try:
self.sql_query("select name from sys.databases")
result = []
Expand Down Expand Up @@ -232,6 +233,8 @@ def do_enum_impersonate(self, line):
self.sql.printRows()
except:
pass
finally:
self.sql_query("use " + old_db)

def do_enum_logins(self, line):
try:
Expand All @@ -256,4 +259,4 @@ def emptyline(self):
pass

def do_exit(self, line):
return True
return True

0 comments on commit 0017927

Please sign in to comment.