Skip to content
Snippets Groups Projects
Commit 740a82c2 authored by nkennedy's avatar nkennedy
Browse files

Fix to script to only analyze subprograms that were successfully exec'd, that...

Fix to script to only analyze subprograms that were successfully exec'd, that exist and are 32-bit ELF executables.
ok nkennedy@ ip:peasoup


Former-commit-id: 6fb287475a124b42ecd11c5fd43b2c043fa0c08a
parent 06b83adb
Branches
Tags
No related merge requests found
...@@ -121,17 +121,19 @@ python $LOG_COMMAND -n $1 -t "Analyze script" -m "$message_2" ...@@ -121,17 +121,19 @@ python $LOG_COMMAND -n $1 -t "Analyze script" -m "$message_2"
python $LOG_COMMAND -n $1 -t "Analyze script" -m "Analysis phase beginning" python $LOG_COMMAND -n $1 -t "Analyze script" -m "Analysis phase beginning"
# Get a list of pathnames of everything $execcmd execs during initialization # Get a list of pathnames of everything $execcmd execs during initialization
EXEC_FILES=( $( $GRACE_HOME/concolic/bin/pgrp-timeout 10 strace -s10240 -f -e trace=execve $execcmd 2>&1 >/dev/null | grep -Po '(?<=execve\(")([^"]+(?="))' | sort | uniq ) ) EXEC_FILES=( $( $GRACE_HOME/concolic/bin/pgrp-timeout 10 strace -s10240 -f -e trace=execve $execcmd 2>&1 >/dev/null | /bin/grep " = 0$" | /bin/grep -Po '(?<=execve\(")([^"]+(?="))' | sort | uniq ) )
TO_ANALYZE=() TO_ANALYZE=()
# filter out anything that matches execcmd, # filter out anything that matches execcmd,
execcmd_base=`basename $execcmd` execcmd_base=`basename $execcmd`
for f in "${EXEC_FILES[@]}" for f in "${EXEC_FILES[@]}"
do do
if [[ `basename $f` != $execcmd_base ]] && [[ $f != /bin/* ]] && [[ $f != /usr/bin/* ]] && [[ $f != /sbin/* ]] && [[ $f != /usr/sbin/* ]] ; if [[ -x $f ]] && [[ `basename $f` != $execcmd_base ]] && [[ $f != /bin/* ]] && [[ $f != /usr/bin/* ]] && [[ $f != /sbin/* ]] && [[ $f != /usr/sbin/* ]]; then
then file $f | /bin/grep "ELF 32"
python $LOG_COMMAND -n $1 -t "Analyze script" -m "Queueing subprogram for analysis: $f" if [[ $? = 0 ]]; then
TO_ANALYZE+=("$f") python $LOG_COMMAND -n $1 -t "Analyze script" -m "Queueing subprogram for analysis: $f"
TO_ANALYZE+=("$f")
fi
else else
python $LOG_COMMAND -n $1 -t "Analyze script" -m "Skipping subprogram: $f" python $LOG_COMMAND -n $1 -t "Analyze script" -m "Skipping subprogram: $f"
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment