如何将python函数返回的参数传递给程序并使用GDB进行分析?(How to pass an argument returned by a python function to a program

编程入门 行业动态 更新时间:2024-10-20 07:59:48
如何将python函数返回的参数传递给程序并使用GDB进行分析?(How to pass an argument returned by a python function to a program and analyse it with GDB?)

假设我有这个功能:

python -c "print '\x98\x84\x04\x08'"

当运行二进制文件时,我可以将参数传递给它(例如通过函数fgets)。

你如何使用python命令的结果在这个二进制文件上启动GDB?

ps:显然在同一命令行中所有这些:-)

Let's say i have this function:

python -c "print '\x98\x84\x04\x08'"

And when runnning a binary i can pass an argument to it (through the function fgets for instance).

How do you start GDB on this binary AND with the result of the python command ?

p.s: all of this in the same command line obviously :-)

最满意答案

一种方式是这样的:

gdb --args name-of-your-binary $(python -c "print '\x98\x84\x04\x08'")

这将把python打印的结果放到argv [1]中。

One way is like this:

gdb --args name-of-your-binary $(python -c "print '\x98\x84\x04\x08'")

This will put result of python print into argv[1].

更多推荐

本文发布于:2023-07-26 00:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1268365.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进行分析   如何将   函数   参数   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!