Displaying String Literals in an elf File

Asked 2 years ago, Updated 2 years ago, 38 views

Is there a way to display only all the string literals in the .rodata section of the elf file?

linux

2022-09-29 22:26

2 Answers

$objdump-s-j.rodata FILE

Is that so?


2022-09-29 22:26

readelf

$readelf-p\.rodata ELF

objcopy+string

$objcopy ELF/dev/null --dump-section\.rodata=/dev/stdout|string-n1

Take out only printable characters with the strings command, as the option name --dump-section shows, exactly as it appears in the specified section.However, printable characters are only 7-bit byte characters (ASCII, ISO 8859, etc.), so 8-bit byte characters like UTF-8 will be removed.

$echo 'Hello World Good morning, World' | strings
Hello World 

You can also extract 8-bit byte characters for the GNU binutils strings command.

$string --version
GNU strings (GNU Binutils for Ubuntu) 2.27.51.20161220
$ echo 'Hello World, Good Morning, World' | strings -- encoding=S
Hello World Good morning, World


2022-09-29 22:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.