Setup · published

Kali Tweaks

Meine Basis-Anpassungen für frische Kali-Setups: Tastatur, Shell, Tools, zsh, History und Terminator.

KaliSetupZshTools

Deutsche Tastatur einstellen

sudo dpkg-reconfigure keyboard-configuration
# German → German (no dead keys)
sudo systemctl restart keyboard-setup

Power-Save-Modus

Manuell über das Menü “Settings -> Power Manager”

Shell auf zsh umstellen

sudo chsh -s /bin/zsh sm
# Danach neu einloggen oder neustarten.

Hostname anpassen

# Anzeigen
hostnamectl

# Ändern
sudo hostnamectl set-hostname NEUER_NAME

# Dauerhaft prüfen/anpassen
sudo nano /etc/hostname
sudo nano /etc/hosts

Go installieren

sudo apt update && sudo apt install -y golang
echo 'export PATH=$HOME/go/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

Basis-Tools installieren

sudo apt install -y gedit gedit-plugins fzf tree hstr bubblewrap ripgrep sd fd-find moreutils terminator

Enhancd und up installieren

git clone --depth=1 https://github.com/babarot/enhancd.git ~/.enhancd

go install -v github.com/akavel/up@latest
sudo cp $(which up) /usr/local/bin/

zsh pimpen

Folgende Blöcke in ~/.zshrc.

setopt complete_in_word

source ~/.enhancd/init.sh
export ENHANCD_FILTER="fzf --height 40% --reverse --ansi --preview 'tree -L 1 {}'"
export ENHANCD_ENABLE_HOME="false"
export ENHANCD_ARG_DOUBLE_DOT="dd"
export ENHANCD_ARG_HYPHEN="hyp"

HISTSIZE=999999999
SAVEHIST=$HISTSIZE
setopt share_history
setopt hist_find_no_dups
setopt hist_reduce_blanks
setopt complete_in_word

autoload -Uz history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end

bindkey '^[OA' history-beginning-search-backward-end
bindkey '^[[A' history-beginning-search-backward-end
bindkey '^[OB' history-beginning-search-forward-end
bindkey '^[[B' history-beginning-search-forward-end

bracketed-paste() {
  zle .$WIDGET && LBUFFER=$(echo -En $LBUFFER)
}
zle -N bracketed-paste

alias hh=hstr
setopt histignorespace
export HSTR_CONFIG=hicolor,raw-history-view

hstr_no_tiocsti() {
    zle -I
    {
    MERGE="hstr ${BUFFER};"
    HSTR_OUT=$({ </dev/tty eval " $MERGE" } 2>&1 1>&3 3>&- );
    } 3>&1;
    BUFFER="${HSTR_OUT}"
    CURSOR=${#BUFFER}
    zle redisplay
}

zle -N hstr_no_tiocsti
bindkey '\C-r' hstr_no_tiocsti
export HSTR_TIOCSTI=n

up für zsh einbinden

UPCOMMAND="bwrap --die-with-parent --ro-bind / / --bind /tmp /tmp --dev /dev --proc /proc --tmpfs /var --tmpfs /run --dir /run/user/$UID --unshare-pid --unshare-cgroup --unshare-ipc /usr/local/bin/up"

zle-upify() {
    local args=""

    if [[ -n "$ZSH_UP_UNSAFE_FULL_THROTTLE" ]]; then
        args="$args --unsafe-full-throttle"
    fi

    buf="$(echo -n "$BUFFER" | sed 's/[ |]*$//')"
    tmp="$(mktemp)"
    eval "$buf |& $UPCOMMAND $args -o '$tmp' 2>/dev/null"

    cmd="$(tail -n +2 "$tmp" | tr -d "\n")"
    rm -f "$tmp"

    if [[ -n "$cmd" ]]; then
        BUFFER="$buf | $cmd"
        zle end-of-line
    fi
}

zle -N zle-upify
bindkey "${ZSH_UP_KEYBINDING:-^P}" zle-upify

alias up="$UPCOMMAND"

Sandbox-Alias

alias polster='bwrap --die-with-parent --new-session --tmpfs /tmp --ro-bind /usr /usr --ro-bind /bin /bin --ro-bind /lib /lib --ro-bind /lib64 /lib64 --ro-bind /sbin /sbin --ro-bind /etc /etc --dev /dev --proc /proc --tmpfs /var --tmpfs /run --dir /run/user/$UID --tmpfs /usr/share --unshare-all --cap-drop ALL --clearenv'

alias fd='fdfind'

Terminator konfigurieren

Config erstellen:
mkdir -p ~/.config/terminator
gedit ~/.config/terminator/config
Config anpassen:
[global_config]
  focus = mouse
  case_sensitive = False
  new_tab_after_current_tab = True
[keybindings]
  new_tab = <Primary>t
  cycle_next = ""
  cycle_prev = ""
  rotate_cw = ""
  rotate_ccw = ""
  split_horiz = <Super>y
  split_vert = <Super>a
  close_term = ""
  search = <Primary>f
  close_window = <Primary><Shift><Super>d
  move_tab_right = <Primary><Shift>Page_Down
  move_tab_left = <Primary><Shift>Page_Up
  next_tab = <Primary>Tab
  prev_tab = <Primary><Shift>Tab
  switch_to_tab_1 = <Super>1
  switch_to_tab_2 = <Super>2
  switch_to_tab_3 = <Super>3
  switch_to_tab_4 = <Super>4
  switch_to_tab_5 = <Super>5
  switch_to_tab_6 = <Super>6
  group_tab = ""
  insert_number = <Super>n
  edit_tab_title = <Super>r
  edit_terminal_title = <Super>t
[profiles]
  [[default]]
    background_color = "#282828"
    background_darkness = 1.0
    cursor_fg_color = "#300a24"
    cursor_bg_color = "#ffffff"
    font = Fira Code Medium 12
    foreground_color = "#ebdbb2"
    scrollback_infinite = True
    use_system_font = False
    use_theme_colors = True
    copy_on_selection = True
[layouts]
  [[default]]
    [[[window0]]]
      type = Window
      parent = ""
    [[[child1]]]
      type = Terminal
      parent = window0
[plugins]