forked from AlessandroZ/LaZagne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new module - retrieve autologon passwords if enabled
- Loading branch information
1 parent
a3bd451
commit 06b8e3f
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from lazagne.config.write_output import print_debug | ||
from lazagne.config.moduleInfo import ModuleInfo | ||
from lazagne.config.WinStructure import * | ||
import _winreg | ||
|
||
# Password are stored in cleartext on old system (< 2008 R2 and < Win7) | ||
# If enabled on recent system, the password should be visible on the lsa secrets dump (check lsa module output) | ||
|
||
class Autologon(ModuleInfo): | ||
def __init__(self): | ||
options = {'command': '--autologon', 'action': 'store_true', 'dest': 'autologon', 'help': 'Windows autologon'} | ||
ModuleInfo.__init__(self, 'Autologon', 'windows', options, cannot_be_impersonate_using_tokens=True) | ||
|
||
def run(self, software_name = None): | ||
pwdFound = [] | ||
try: | ||
hkey = _winreg.OpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon') | ||
if int(_winreg.QueryValueEx(hkey, 'AutoAdminLogon')[0]) == 1: | ||
print_debug('INFO', 'Autologin enabled') | ||
|
||
keys = { | ||
'DefaultDomainName' : '', | ||
'DefaultUserName' : '', | ||
'DefaultPassword' : '', | ||
'AltDefaultDomainName' : '', | ||
'AltDefaultUserName' : '', | ||
'AltDefaultPassword' : '', | ||
} | ||
|
||
toRemove = [] | ||
for k in keys: | ||
try: | ||
keys[k] = str(_winreg.QueryValueEx(hkey, k)[0]) | ||
except: | ||
toRemove.append(k) | ||
|
||
for r in toRemove: | ||
keys.pop(r) | ||
|
||
if keys: | ||
pwdFound.append(keys) | ||
|
||
except Exception,e: | ||
print_debug('DEBUG', '{0}'.format(e)) | ||
return | ||
|
||
return pwdFound |