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 33 34 35 36 37 38 39
|
#compdef checksec
local curcontext="$curcontext" state state_descr line
typeset -A opt_args
_arguments -C : \
'--version[print version]' \
{'--help','--help'}'[print help]' \
'--debug' \
'--verbose' \
{'--update','--upgrade'}'[update program]' \
{'--format=','--output='}'[use specified output format]:output format:->format' \
{'--dir=','--dir='}'[check specified DIR]:vdir:->vdir' \
{'--file=','--file='}'[check specified FILE]:file to check:_files' \
{'--proc=','--proc='}'[check specified process NAME)]:process name:->procname' \
{'--proc-all','--proc-all'}'[check all processes]' \
{'--proc-libs','--proc-libs'}'[check specified ID'\''s process libs)]:process ID to check: _pids' \
{'--kernel','--kernel'}'[check kernel]' \
{'--fortify-file=','--fortify-file='}'[check specified FILE for fortify)]:file for fortify:_files' \
{'--fortify-proc=','--fortify-proc='}'[check specified 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
|