Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Using "Process" raises "AttributeError: module 'os' has no attribute 'getuid'" #2406

Closed
MatthiasHeinz opened this issue May 12, 2024 · 2 comments

Comments

@MatthiasHeinz
Copy link

On Windows: When trying to invoke process, pwntools crashes with the following error.

> python .\solver.py DEBUG LOG_FILE=log.txt
Traceback (most recent call last):
  File "F:\some_dir\solver.py", line 12, in <module>
    conn = process(['python', 'chall.py'])
  File "D:\Python3.10.4\lib\site-packages\pwnlib\tubes\process.py", line 260, in __init__
    executable_val, argv_val, env_val = self._validate(cwd, executable, argv, env)
  File "D:\Python3.10.4\lib\site-packages\pwnlib\tubes\process.py", line 553, in _validate
    elif os.path.sep not in executable and which(executable, path=path):
  File "D:\Python3.10.4\lib\site-packages\pwnlib\util\misc.py", line 163, in which
    isroot = os.getuid() == 0
AttributeError: module 'os' has no attribute 'getuid'

log.txt

================================================================================
= Started at 2024-05-12T20:03:11                                               =
= sys.argv = [                                                                 =
=   '.\\solver.py',                                                            =
= ]                                                                            =
================================================================================
================================================================================
= Started at 2024-05-12T20:03:11                                               =
= sys.argv = [                                                                 =
=   '.\\solver.py',                                                            =
= ]                                                                            =
================================================================================

solver.py

from pwn import *
conn = process(['python', 'chall.py'])

chall.py

print(1)

Could be related to #2379.

@peace-maker
Copy link
Member

You are looking for #2310 which is only available in the beta. Try pip install --upgrade --pre pwntools to switch to the 4.13 beta. That support is very new and I'm interested if it works out for you!

@MatthiasHeinz
Copy link
Author

Seems to work beautifully. Thanks for pointing me into the right direction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants