-
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
Detect challenge binary and libc in pwn template
#2309
Detect challenge binary and libc in pwn template
#2309
Conversation
When the `args.exe` or `args.libc` arguments are missing, look for the files in the current working directory. This allows to quickly get a template by just running `pwn template` (and maybe --host --port for remote instances). This is inspired by https://github.com/io12/pwninit
6f40ef3
to
ab2ef24
Compare
Allow to keep the old static template behavior.
Inform the user that we're looking for the binaries and if we found one.
We could use the |
parser.add_argument('--path', help='Remote path of file on SSH server') | ||
parser.add_argument('--quiet', help='Less verbose template comments', action='store_true') | ||
parser.add_argument('--color', help='Print the output in color', choices=['never', 'always', 'auto'], default='auto') | ||
parser.add_argument('--template', help='Path to a custom template. Tries to use \'~/.config/pwntools/templates/pwnup.mako\', if it exists. ' | ||
'Check \'%s\' for the default template shipped with pwntools.' % | ||
os.path.join(printable_data_path, "templates", "pwnup.mako")) | ||
parser.add_argument('--no-auto', help='Do not automatically detect missing binaries', action='store_true') | ||
|
||
def detect_missing_binaries(args): |
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.
Idea for the future: more and more challenges ship a Dockerfile
or even docker-compose. We could use it to detect needed libraries and a binary as well maybe (using API like we do with ADB or shelling out to docker cli).
Check about common name patterns instead of plainly the presence of "libc" in the name. Co-authored-by: Arusekk <[email protected]>
Co-authored-by: Arusekk <[email protected]>
When the
args.exe
orargs.libc
arguments are missing, look for the files in the current working directory.This allows to quickly get a template by just running
pwn template
(and maybe--host
+--port
for remote instances) and have the arguments filled in automatically. Less typing - more pwning!This is inspired by https://github.com/io12/pwninit
Related #2276