简体   繁体   中英

How to redirect multiple inputs from files to a binary being debugged in gdb?

The binary I am debugging in gdb first asks me for a id first and then if the id is valid asks for a second input.

gef➤  run

Agent ID : 48093572 //This is the first input which the user has to enter

Login Validated

Main Menu:

1. Extraction Points

2. Request Extraction

3. Submit Report

0. Exit

Enter selection:   // This is the second input the user has to enter

How can I pass both the inputs from a file using the '<' operator. If there was a single input I could have done it as

gef➤  run < input.txt

But the approach above is not working for multiple inputs.

*Note:- gef is an addon for gdb

In case you haven't found the solution, or anyone else needs this bit of information, this worked for me:

gdb$ r < <(cat 1_intest.txt 2_intest.txt)

Each input gets passed to the program by cating the corresponding file's content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM