-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfind-unstripped
executable file
·32 lines (29 loc) · 1.02 KB
/
find-unstripped
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# part of the security-assessor project
# Copyright (c) 2024 Steve Grubb. ALL RIGHTS RESERVED.
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# this program checks for elf files that were somehow not stripped
DIR="/"
if [ $# -ge 2 ] ; then
echo "Usage: find-unstripped [DIR]"
exit 1
fi
if [ $# -eq 1 ] ; then
if [ -d "$1" ] ; then
DIR="$1"
else
echo "Option passed in was not a directory" 1>&2
exit 1
fi
fi
# Get executable files under /usr
/usr/bin/find $DIR -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec /usr/bin/file {} \; 2>/dev/null | /bin/grep -E -v 'shared object|debug' | /bin/grep 'not stripped' | /bin/grep 'ELF' | /bin/awk '{ print $1 }' | /usr/bin/tr -d ':'
exit 1