0
votes

I need to get files that a binary uses.

I can view all dependency of an ELF binary in the .interp section, but can I get conf files of my binary? For example if a binary reads /etc/host, I want to see /etc/host in a section of my ELF file.

I do not see that in the documentation: https://refspecs.linuxfoundation.org/LSB_1.1.0/gLSB/specialsections.html

1
You should explain why do you need to get the list of files written by which program. Looks like some XY problem. So please edit your question to improve and motivate it. - Basile Starynkevitch

1 Answers

1
votes

I need to get files that some binary executable uses.

You can't get (all of) them. A file path used by some executable could be computed at runtime (and that is very often the case, just think of the cat(1) program). Solving that problem (of reliably computing all the files used by a program) in general could be proved equivalent to the Halting problem.

However, in practice, the strings(1) utility might help you guess some of the files (statically) referred by an executable.

You could also use strace(1) to understand (dynamically) what files are open(2)-ed during some particular execution.

Read also carefully the documentation of your executable. If it is a free software, study also its source code.