]>
iEval git - linux-seccomp.git/blob - libseccomp/tools/scmp_app_inspector
45b86b2ca0c5abe29d6312af9991dab4a5ae4ea5
4 # Runtime syscall inspector
6 # Copyright (c) 2012 Red Hat <pmoore@redhat.com>
7 # Author: Paul Moore <paul@paul-moore.com>
11 # This library is free software; you can redistribute it and/or modify it
12 # under the terms of version 2.1 of the GNU Lesser General Public License as
13 # published by the Free Software Foundation.
15 # This library is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
20 # You should have received a copy of the GNU Lesser General Public License
21 # along with this library; if not, see <http://www.gnu.org/licenses>.
27 function verify_deps
() {
28 [[ -z "$1" ]] && return
29 if ! which "$1" >& /dev
/null
; then
30 echo "error: install \"$1\" and include it in your \$PATH"
38 # verify script dependencies
44 # get the command line arguments
47 opt_out
="/proc/self/fd/1"
48 while getopts "afo:h" opt
; do
60 echo "usage $0 [-f] [-a] [-o <file>] <command> [<args>]"
64 shift $
(expr $OPTIND - 1)
66 # generate a temporary output file
67 raw
=$
(mktemp
-t strace-raw_XXXXXX
)
70 # capture the strace output
73 # filter the raw strace
74 if [[ $opt_args -eq 0 ]]; then
75 if [[ $opt_freq -eq 0 ]]; then
76 cat $raw |
sed -e 's/(.*//' |
sort -u > $out
78 cat $raw |
sed -e 's/(.*//' |
sort |
uniq -c |
sort -nr > $out
81 if [[ $opt_freq -eq 0 ]]; then
82 cat $raw |
sed -e 's/)[ \t]*=.*$/)/' \
83 |
sed -e 's/".*,/"...",/g;s/\/\*.*\*\//.../g' \
84 |
sed -e 's/0x[a-f0-9]\+/.../g' \
87 cat $raw |
sed -e 's/)[ \t]*=.*$/)/' \
88 |
sed -e 's/".*,/"...",/g;s/\/\*.*\*\//.../g' \
89 |
sed -e 's/0x[a-f0-9]\+/.../g' \
90 |
sort |
uniq -c |
sort -nr > $out
95 echo "============================================================" > $opt_out
96 echo "Syscall Report (\"$*\")" >> $opt_out
97 [[ $opt_freq -eq 1 ]] && echo " freq syscall" >> $opt_out
98 echo "============================================================" >> $opt_out
This page took 0.052384 seconds and 4 git commands to generate.