summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/checksec/files/_checksec')
-rw-r--r--app-admin/checksec/files/_checksec50
1 files changed, 35 insertions, 15 deletions
diff --git a/app-admin/checksec/files/_checksec b/app-admin/checksec/files/_checksec
index b30e0160..35b3a6ae 100644
--- a/app-admin/checksec/files/_checksec
+++ b/app-admin/checksec/files/_checksec
@@ -1,18 +1,38 @@
#compdef checksec
-_checksec_procname() {
- compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho command 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t}
-}
-_arguments : \
-'--help[print help]' \
+local curcontext="$curcontext" state state_descr line
+typeset -A opt_args
+_arguments -C : \
'--version[print version]' \
-'--file[FILE (check FILE)]:file to check:_files' \
-'--fortify-file[FILE (check FILE for fortify)]:file for fortify:_files' \
-'--fortify-proc[ID (check ID'\''s process for fortify)]:process ID for fortify: _pids' \
-'--proc[NAME (check process NAME)]:process name:_checksec_procname' \
-'--proc-all[check all procname]' \
-'--proc-libs[ID (check ID'\''s process libs)]:process ID to check: _pids' \
+{'(--help)-h','(-h)--help'}'[print help]' \
+'-d[debug mode]' \
+{'(--update)--upgrade','(--upgrade)--update'}'[update program]' \
+{'(--format --output)-o','(-o --output)--format','(-o --format)--output'}'[use specified output format]:output format:->format' \
+{'(--dir)-d','(-d)--dir'}'[\[-v\] check specified DIR]:vdir:->vdir' \
+'--file[check specified FILE]:file to check:_files' \
+'--proc[check specifiec process NAME)]:process name:->procname' \
+'--proc-all[check all processes]' \
+'--proc-libs[check specified ID'\''s process libs)]:process ID to check: _pids' \
'--kernel[check kernel]' \
-'--dir[DIR \[-v\] (check DIR)]:dir:_files -/'
-local stat=$?
-unset -f _checksec_procname
-return stat
+'--fortify-file[check specified FILE for fortify)]:file for fortify:_files' \
+'--fortify-proc[check specied ID'\''s process for fortify)]:process ID for fortify: _pids'
+local ret=$?
+case $state in
+format)
+ local formats
+ formats=(
+ 'cli:use cli output format'
+ 'csv:use csv output format'
+ 'xml:use xml output format'
+ 'json:use json output format'
+ )
+ _describe -t formats 'output format' formats
+ ret=$?;;
+procname)
+ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho command 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t}
+ ret=$?;;
+vdir)
+ compadd "$expl[@]" -v
+ _files -/
+ ret=0;;
+esac
+return ret