將檔案中的多個輸入提供給 gdb stdin

將檔案中的多個輸入提供給 gdb stdin

這讓我抓狂,事情一定很簡單!我看過很多解決方案,但似乎沒有一個適合我的應用程式。

我正在 gdb 中調試程式。程式需要兩個輸入,如下所示:

pwndbg> run
Starting program: app.html
what is your name?
foo
Wait, who were you again?
bar
kthxbye

上面,使用者輸入是foobar。我希望能夠控制來自一個檔案、多個檔案、python 輸出等的這兩個輸入。只要我能輸入十六進制值,我就很高興。

除此之外,我嘗試過r < input1.txt ; input2.txtwhere input.txtcontainsfooinput2.txtcontains bar,但這只是放入foo輸入中,但從未放入bar。我還嘗試過使用由(適當的)換行符號分隔輸入的單一文件,但仍然只獲得第一個輸入。

先致謝!

相關內容