3

Hi I'd like to run a python command python -c 'print "\x90"*52' when the program start in GDB, as I would do when I execute : python -c 'print "\x90"*52' | ./myProg . Does anyone knows any way to acheive this?

What I've tried so far :

  • `python -c 'print "\x90"*52' ` run
  • run `python -c 'print "\x90"*52' `

I really apologies if I'm not asking on the right StackExchange forum. Thanks.

  • 1
    i ususally save the output to a file and execute "r < /file" – Amirag Jun 18 '18 at 21:49
  • 1
    @Amirag I just tried this. Looks like it work just fine, thanks a lot ! Please create an answer on this topic so I can mark this topic as "answered". – Nark Jun 18 '18 at 22:01
6

I don't know of any way to run a script as a run argument.
A common solution is to redirect your input from a file.

You first need to run the script and save the result:

python -c "print 'A'*50" > my_file

and redirect it to gdb run.

r < my_file

also, from the help run command:

Input and output redirection with ">", "<", or ">>" are also allowed.

which means you can also redirect output if needed.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.