1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-12-02 20:36:40 +01:00

Prefer the pwd module for getuid when available

This commit is contained in:
Spencer McIntyre 2014-12-02 14:20:11 -05:00 committed by Brent Cook
parent b5b1c9f832
commit f4bd471ee4

View File

@ -698,7 +698,9 @@ def stdapi_sys_config_getsid(request, response):
@meterpreter.register_function
def stdapi_sys_config_getuid(request, response):
if has_windll:
if has_pwd:
username = pwd.getpwuid(os.getuid()).pw_name
elif has_windll:
token = get_token_user(ctypes.windll.kernel32.GetCurrentProcess())
if not token:
return ERROR_FAILURE, response