aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/syscalls.sh
diff options
context:
space:
mode:
authorLibravatar Avi Lumelsky <avilume@gmail.com>2020-04-09 16:25:23 +0300
committerLibravatar GitHub <noreply@github.com>2020-04-09 16:25:23 +0300
commit2a3f61bc6bfc21aa29e7f3be12dfee278b46ce36 (patch)
tree967961fb0e227b1f5cd9a8b243ffd27fa53301cd /contrib/syscalls.sh
parentMerge pull request #3334 from matu3ba/docs (diff)
downloadfirejail-2a3f61bc6bfc21aa29e7f3be12dfee278b46ce36.tar.gz
firejail-2a3f61bc6bfc21aa29e7f3be12dfee278b46ce36.tar.zst
firejail-2a3f61bc6bfc21aa29e7f3be12dfee278b46ce36.zip
Improvements for syscalls.sh contib file
Fixed the identation for copy/past problems and added a console character that returns the console to it's original colour after the SYSCALLS_OUTPUT_FILE param is printed.
Diffstat (limited to 'contrib/syscalls.sh')
-rwxr-xr-xcontrib/syscalls.sh38
1 files changed, 17 insertions, 21 deletions
diff --git a/contrib/syscalls.sh b/contrib/syscalls.sh
index c9b5a245a..b990ac23c 100755
--- a/contrib/syscalls.sh
+++ b/contrib/syscalls.sh
@@ -8,26 +8,22 @@ SYSCALLS_OUTPUT_FILE="$(pwd)/syscalls.txt"
8 8
9if [ $# -eq 0 ] 9if [ $# -eq 0 ]
10then 10then
11echo 11 echo
12echo " *** No program specified!!! ***" 12 echo " *** No program specified!!! ***"
13echo 13 echo
14echo -e "Make this file executable and execute it as:\\n" 14 echo -e "Make this file executable and execute it as:\\n"
15echo -e "\\e[96m syscalls.sh /full/path/to/program\\n" 15 echo -e "\\e[96m syscalls.sh /full/path/to/program\\n"
16echo -e "\\e[39mif you saved this script in a directory in your PATH (e.g., in ${HOME}/bin), otherwise as:\\n" 16 echo -e "\\e[39mif you saved this script in a directory in your PATH (e.g., in ${HOME}/bin), otherwise as:\\n"
17echo -e "\\e[96m ./syscalls.sh /full/path/to/program\\n" 17 echo -e "\\e[96m ./syscalls.sh /full/path/to/program\\n"
18echo -e "\\e[39mUse the full path to the respective program to avoid executing it sandboxed with Firejail\\n(if a Firejail profile for it already exits and 'sudo firecfg' was executed earlier)\\nin order to determine the necessary system calls." 18 echo -e "\\e[39mUse the full path to the respective program to avoid executing it sandboxed with Firejail\\n(if a Firejail profile for it already exits and 'sudo firecfg' was executed earlier)\\nin order to determine the necessary system calls."
19echo 19 echo
20exit 0 20 exit 0
21
22else 21else
23 22 strace -cfo "$STRACE_OUTPUT_FILE" "$@" && awk '{print $NF}' "$STRACE_OUTPUT_FILE" | sed '/syscall\|-\|total/d' | sort -u | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/' > "$SYSCALLS_OUTPUT_FILE"
24strace -cfo "$STRACE_OUTPUT_FILE" "$@" && awk '{print $NF}' "$STRACE_OUTPUT_FILE" | sed '/syscall\|-\|total/d' | sort -u | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/' > "$SYSCALLS_OUTPUT_FILE" 23 echo
25echo 24 echo -e "\e[39mThese are the sorted syscalls:\n\e[93m"
26echo -e "\e[39mThese are the sorted syscalls:\n\e[93m" 25 cat "$SYSCALLS_OUTPUT_FILE"
27cat "$SYSCALLS_OUTPUT_FILE" 26 echo
28echo 27 echo -e "\e[39mThe sorted syscalls were saved to:\n\e[96m$SYSCALLS_OUTPUT_FILE\n\e[39m"
29echo -e "\e[39mThe sorted syscalls were saved to:\n\n\e[96m$SYSCALLS_OUTPUT_FILE" 28 exit 0
30echo
31exit 0
32
33fi 29fi