-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
deps: make socks and serial optional #2245
base: dev
Are you sure you want to change the base?
Conversation
Do you want to remove them from the required packages in the pyproject.yml too? Maybe move them to a "all" group or similar? |
Yes, that would be great, to make most heavy deps actually install-time optional, not only runtime-optional. If possible, I would like to move there (apart from pysocks and pyserial): rpyc, requests, unicorn, capstone, colored_traceback and paramiko.
|
pwnlib/tubes/remote.py
Outdated
pass | ||
except IOError as e: | ||
if not isinstance(e, socket.error): | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to render the following code useless, since a ProxyError is not a socket.error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit tricky, so I am not sure I got it right:
- We want to reraise all
socks.ProxyError
s. We also want to silence allsocket.error
s (not sure why, but w/e, this is what the code has been doing so far). - On py2
socket.error
is a child class ofIOError
, which is also the base class forsocks.ProxyError
. Therefore the following code is useless indeed. - On py3
socket.error
is a deprecated alias forOSError
, which is also aliased asIOError
, and is therefore the base class forsocks.ProxyError
. The first check will always fail (so not sure whether we want to keep it), so the second check forsocks.ProxyError
is still needed, although I think we could also get away without importingsocks
, but through inspecting the exception's__mro__
for classes matchingc.__module__ == "socks" and c.__name__ == "ProxyError"
. This is not an expensive import however, and an error path anyway, so I think we can afford some extra time spent during actually importing the module.
Another idea I have is to cache the last exception anyway, and raise it just as socket.create_connection
does. And I think this will be the best way in the end.
389e0b9
to
3c1b453
Compare
Hm, we should log the To avoid confusion with the change of |
I would prefer pwntools[slim] to be without features, but it seems optional dependencies can only be positive.
Email z poniedziałku 21 sierpnia 2023 od peace-makera:
… Hm, we should log the `pip install pwntools[full]` command and the exact missing library in the error message when users try to use such a feature.
To avoid confusion with the change of `pip install pwntools` not installing everything.
--
Reply to this email directly or view it on GitHub:
#2245 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***
--
Wysłane z mojego urządzenia Sailfish
|
The typer package now provides a Maybe that is an option. |
Okay, maybe it would be doable, but not in this release. I would be happy to already have the deps de facto optional (i.e. pwntools not breaking if something from this list is missing) though. |
No description provided.