shellfirm

Crates.ioshellfirm
lib.rsshellfirm
version0.2.11
created_at2022-01-03 13:53:53.708954+00
updated_at2025-03-25 11:37:56.413001+00
description`shellfirm` will intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification, kinda like a captcha for your terminal.
homepagehttps://github.com/kaplanelad/shellfirm
repositoryhttps://github.com/kaplanelad/shellfirm
max_upload_size
id507130
size310,625
Elad Kaplan (kaplanelad)

documentation

README

shellfirm

Opppppsss you did it again? :scream: :scream: :cold_sweat:

How do I save myself from myself?

  • rm -rf *
  • git reset --hard Before hitting the enter key?
  • kubectl delete ns Stop! you are going to delete a lot of resources
  • And many more!

Do you want to learn from other people's mistakes?

shellfirm will intercept any risky patterns and immediately prompt a small challenge that will double verify your action, think of it as a captcha for your terminal.

rm -rf /
#######################
# RISKY COMMAND FOUND #
#######################
* You are going to delete everything in the path.

Solve the challenge: 8 + 0 = ? (^C to cancel)

How does it work?

shellfirm will evaluate all the shell commands behind the scenes. If a risky pattern is detected, you will immediately get a prompt with the relevant warning to verify your command.

Example

Setup your shell

Install via brew

brew tap kaplanelad/tap && brew install shellfirm

Or download the binary file from releases page, unzip the file and move to /usr/local/bin folder.

Validate shellfirm installation

shellfirm --version

Verify installation

mkdir /tmp/shellfirm
cd /tmp/shellfirm
git reset --hard

Select your shell

Oh My Zsh Download zsh plugin:
curl https://raw.githubusercontent.com/kaplanelad/shellfirm/main/shell-plugins/shellfirm.plugin.oh-my-zsh.zsh --create-dirs -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/shellfirm/shellfirm.plugin.zsh

Add shellfirm to the list of Oh My Zsh plugins when Zsh is loaded(inside ~/.zshrc):

plugins=(... shellfirm)
Bash Bash implementation is based on https://github.com/rcaloras/bash-preexec project, which adds a pre-exec hook to catch the command before executing.
# Download bash-preexec hook functions. 
Commit count: 310

cargo fmt