NAME
scanelf - user-space utility to scan ELF files
SYNOPSIS
scanelf [options] ELFs or directories
DESCRIPTION
scanelf is a user-space utility to quickly scan given ELFs,
directories, or common system paths for different information. This may
include ELF types, their PaX markings, TEXTRELs, etc...
OPTIONS
-A, --archives
Scan archives (.a files)
-a, --all
Print all scanned info (-x -e -t -r -n -i -b)
-B, --banner
Don’t display the header
-b, --bind
Print BIND information
-E, --etype ETYPE
Print only ELF files matching specified etype (like ET_DYN,
ET_EXEC, etc...)
-e, --header
Print GNU_STACK markings
-F, --format FORMAT
Use specified format for output; see the FORMAT section
-f, --from FILE
Read input stream from specified filename
-g, --gmatch
Use strncmp to match libraries (use with -N). Or regexp with symbol
matching
-h, --help
Show condensed usage and exit
-i, --interp
Print INTERP information
-k, --section SECTION
Find the specified section
-L, --ldcache
Utilize ld.so.cache information (use with -r/-n)
-l, --ldpath
Scan all directories in /etc/ld.so.conf
-M, --bits BITS
Print only ELF files matching specified numeric bits (like 32/64)
-D, --endian
Print Endianness
-O, --perms PERMS
Print only ELF files with matching specified octal bits (like 755)
-m, --mount
Don’t recursively cross mount points
-N, --lib SONAME
Find ELFs that need the specified SONAME
-n, --needed
Print NEEDED information
-o, --file FILE
Write output stream to specified filename
-p, --path
Scan all directories in PATH environment
-q, --quiet
Only output ’bad’ things.
-R, --recursive
Scan directories recursively
-r, --rpath
Print RUNPATH information
-S, --soname
Print SONAME information
-s, --symbol SYMBOL
Find the specified symbol; a - prefix will only show undefined
references while a + prefix will only show defined references while
no prefix will show both
-T, --textrels
Locate cause of TEXTRELs
-t, --textrel
Print TEXTREL information
-V, --version
Print version and exit
-v, --verbose
Be verbose (can be used more than once)
-X, --fix
Try and ’fix’ bad things (use with -r/-e)
-x, --pax
Print PaX markings
-y, --symlink
Don’t scan symlinks
-z, --setpax FLAGS
Sets EI_PAX/PT_PAX_FLAGS to specified flags (use with -Xx)
FORMAT
The format string is much like a printf string in that it is a literal
string with flags requesting different information. For example, you
could use a format string and expect the following results.
# scanelf -BF ’file %f needs %n; funky time!’ /bin/bash
file bash needs libncurses.so.5,libdl.so.2,libc.so.6; funky time!
Note that when you use a format string, generally information related
flags should be omitted. In other words, you do not want to try and
request NEEDED output (-n) and try to specify a format output at the
sametime as these operations are mutually exclusive. Each information
related flag has an equivalent conversion specifier, so use those
instead. You can of course continue to use non-information related
flags (such as --verbose).
There are three characters that introduce conversion specifiers. · % -
replace with info .sp -1 .TP 4 · # - silent boolean match .sp -1 .TP 4
· + - verbose match
And there are a number of conversion specifiers. We try to match up the
specifier with corresponding option. · a - machine (EM) type .sp -1
.TP 4 · b - bind flags .sp -1 .TP 4 · e - program headers .sp -1 .TP 4
· D - endian .sp -1 .TP 4 · F - long filename .sp -1 .TP 4 · f - short
filename .sp -1 .TP 4 · i - interp .sp -1 .TP 4 · k - section .sp -1
.TP 4 · M - EI class .sp -1 .TP 4 · N - specified needed .sp -1 .TP 4 ·
n - needed libraries .sp -1 .TP 4 · p - filename (minus search) .sp -1
.TP 4 · o - etype .sp -1 .TP 4 · O - perms .sp -1 .TP 4 · r - runpaths
.sp -1 .TP 4 · S - SONAME .sp -1 .TP 4 · s - symbol .sp -1 .TP 4 · T -
all textrels .sp -1 .TP 4 · t - textrel status .sp -1 .TP 4 · x - pax
flags
ELF ETYPES
You can narrow your search by specifying the ELF object file type
(ETYPE). The commandline option takes the numeric value and or symbolic
type. Multiple values can be passed comma separated. Example -E
ET_EXEC,ET_DYN,1
Here is the normal list available for your pleasure. You of course are
free to specify any numeric value you want. · 0 - ET_NONE - unknown
type .sp -1 .TP 4 · 1 - ET_REL - relocatable file .sp -1 .TP 4 · 2 -
ET_EXEC - executable file .sp -1 .TP 4 · 3 - ET_DYN - shared object .sp
-1 .TP 4 · 4 - ET_CORE - core file
ELF BITS
You can also narrow your search by specifying the ELF bitsize. Again,
specify the numeric value or the symbolic define. · 32 - ELFCLASS32 -
32bit ELFs .sp -1 .TP 4 · 64 - ELFCLASS64 - 64bit ELFs
HOMEPAGE
http://hardened.gentoo.org/pax-utils.xml
REPORTING BUGS
Please include as much information as possible (using any available
debugging options) and send bug reports to the maintainers (see the
AUTHORS section).
SEE ALSO
chpax(1), dumpelf(1), paxctl(1), pspax(1), readelf(1), scanelf(1)
AUTHORS
Ned Ludd <solar@gentoo.org>
Maintainer
Mike Frysinger <vapier@gentoo.org>
Maintainer