Hex values in gdb input files

自作多情 提交于 2019-12-06 04:30:00

Use perl! :)

reader@hacking:~/booksrc $ ./overflow_example $(perl -e 'print "A"x30')

with the 'e' option perl will evaluate the following command, and surrounding everything will treat the output of perl as a string. So the command above is identical to:

reader@hacking:~/booksrc $ ./overflow_example AAAAAAAAAAAAAAAAAAAAAAAAA

(adding x30 after a string will repeat it 30 times). Of course perl accepts other hex values with the notation \x??. One more word, to concatenate strings use a dot:

reader@hacking:~/booksrc $ perl -e 'print "A"x20 . "BCD" . "\x61\x66\x67\x69" ;'
AAAAAAAAAAAAAAAAAAAABCDafgi

So you can redirect the output of perl in your input file or directly call perl in gdb when you run the program.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!