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

Enhance documentation and error logging for preexec_fn usage #787

Merged
merged 1 commit into from
Nov 12, 2016

Conversation

zachriggle
Copy link
Member

Target stable since this has real bug fixes for logging issues.

Fixes #786

@zachriggle zachriggle added this to the 3.1.0 milestone Nov 1, 2016
@zachriggle zachriggle changed the base branch from dev to stable November 1, 2016 23:16
@zachriggle zachriggle force-pushed the preexecfn branch 3 times, most recently from c901f19 to 8a087e9 Compare November 1, 2016 23:17
@zachriggle
Copy link
Member Author

Assigned to @idolf to merge into stable

@@ -667,8 +667,12 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, time
See ``stdin``.
preexec_fn(callable):
Function which is executed on the remote side before execve().
This **MUST** be a self-contained function -- it must perform
all of its own imports, and cannot refer to variables outside
its scope.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just check whether this is the case by inspecting the callable object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't, actually. And if you can, it's more complex than I care to worry about. If things break, the exception is thrown on the other side and all we have is the Python stack trace -- which appears as part of the tube data. There's not a way around this that I'm aware of.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you chould just check if func_closure is None/() and if func_code.co_names only contains names from __builtins__.

However def f(): import x also has x in its co_names. So I guess you are right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@TethysSvensson TethysSvensson merged commit 0994042 into Gallopsled:stable Nov 12, 2016
@TethysSvensson
Copy link
Contributor

I am not doing a new 3.1.0 release, since the 3.2.0 release is done today. Changing the milestone to match.

@TethysSvensson TethysSvensson modified the milestones: 3.2.0, 3.1.0 Nov 12, 2016
@zachriggle zachriggle deleted the preexecfn branch January 4, 2017 18:03
Kyle-Kyle pushed a commit to Kyle-Kyle/pwntools that referenced this pull request Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants