Skip to content

Commit 44816b8

Browse files
zeroSteinerBrent Cook
authored andcommitted
Prefer the pwd module for getuid when available
1 parent 8f2e444 commit 44816b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

data/meterpreter/ext_server_stdapi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,9 @@ def stdapi_sys_config_getsid(request, response):
698698

699699
@meterpreter.register_function
700700
def stdapi_sys_config_getuid(request, response):
701-
if has_windll:
701+
if has_pwd:
702+
username = pwd.getpwuid(os.getuid()).pw_name
703+
elif has_windll:
702704
token = get_token_user(ctypes.windll.kernel32.GetCurrentProcess())
703705
if not token:
704706
return ERROR_FAILURE, response

0 commit comments

Comments
 (0)