NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor
git clone https://git.daemon-sec.xyz/NixDaemon.git
Log | Files | Refs | README

_htbbox (1784B)


      1 #compdef htbbox
      2 # zsh completion for htbbox (modules/features/pentest/_htbbox.py)
      3 
      4 _htbbox_boxes() {
      5   local -a boxes
      6   boxes=( ${HTB_ROOT:-$HOME/htb}/*(N/:t) )
      7   _describe -t boxes 'box' boxes
      8 }
      9 
     10 _htbbox() {
     11   local -a cmds
     12   cmds=(
     13     'new:scaffold a box (name ip os difficulty [hosts], any order)'
     14     'use:make a box current ($BOX, $TARGET, /etc/hosts)'
     15     'ls:all boxes, newest first'
     16     'info:the box card'
     17     'path:the box directory'
     18     'json:raw box.json, or one key'
     19     'set:change a field (ip os difficulty status domain name)'
     20     'host:add hostnames'
     21     'cred:add or list credentials'
     22     'flag:record the user or root flag'
     23     'note:add or list notes'
     24     'ports:import open ports from recon/*.xml'
     25     'help:usage'
     26   )
     27   if (( CURRENT == 2 )); then
     28     _describe -t commands 'htbbox command' cmds
     29     return
     30   fi
     31   case $words[2] in
     32     new)
     33       _alternative \
     34         'os:os:(windows linux freebsd openbsd android other)' \
     35         'difficulty:difficulty:(easy medium hard insane)' \
     36         'flags:flag:(-n -i -o -d -H -t)' ;;
     37     use|info|path) _htbbox_boxes ;;
     38     json)  _alternative 'boxes:box:_htbbox_boxes' 'keys:key:(name slug ip os difficulty hostnames domain status flags creds ports notes)' ;;
     39     set)
     40       case $CURRENT in
     41         3) _values 'key' name ip os difficulty status domain ;;
     42         4) case $words[3] in
     43              os) _values 'os' windows linux freebsd openbsd android other ;;
     44              difficulty) _values 'difficulty' easy medium hard insane ;;
     45              status) _values 'status' active user root retired paused ;;
     46            esac ;;
     47       esac ;;
     48     flag)  (( CURRENT == 3 )) && _values 'flag' user root ;;
     49     ports) _files -g '*.xml' ;;
     50   esac
     51   [[ $words[CURRENT-1] == (-b|--box) ]] && _htbbox_boxes
     52 }
     53 
     54 _htbbox "$@"