Protect yourself from yourself!
rm -rf *
git reset --hard
before saving?kubectl delete ns
which going to delete all resources under this namespace?Do you want to learn from people that made those mistakes??
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.
```bash $ rm -rf /
Solve the challenge: 8 + 0 = ? (^C to cancel) ```
shellfirm
evaluate all shell command behind the scene.
If a risky pattern is detected, you will get a prompt with a warning and double verification will requests.
bash
brew tap kaplanelad/tap && brew install shellfirm
bash
curl https://raw.githubusercontent.com/kaplanelad/shellfirm/main/shellfirm.plugin.zsh --create-dirs -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/shellfirm/shellfirm.plugin.zsh
shellfirm
as the plugin in your .zshrc file as:
bash
plugins=(... shellfirm)
| Group | Path | Enable By Default |
| --- | --- | --- |
| base
| base.yaml | true
|
| git
| git.yaml | true
|
| fs
| fs.yaml | true
|
| kubernetes
| kubernetes.yaml | false
shellfirm config update --check-group kubernetes
|
After installing shellfirm
tool the config stored in the path: ~/.shellfirm/config.yaml
You can always manage your out risky command:
```yaml challenge: Math # Math, Enter, Yes
includes: - base - fs - git
checks: - is: git reset method: Contains enable: true description: "This command going to reset all your local changes." from: git - is: "rm.+(-r|-f|-rf|-fr)" method: Regex enable: true description: "You are going to delete everything in the path." from: fs - is: ">.+/dev/sda" method: Regex enable: true description: "Writing the data directly to the hard disk drive and damaging your file system." from: fs - is: "mv+./dev/null" method: Regex enable: true description: "The files will be discarded and destroyed." from: fs ```
:information_source: to define custom check (that not include int the shillfirm
check) add new check to config.yaml file with from: custom
.
yaml
- is: "special check"
method: Regex
enable: true
description: "Example of custom check."
from: custom
bash
$ shellfirm config update --check-group {group} {group}
bash
$ shellfirm config update --check-group {group} {group} --remove
Edit configuration file in ~/.shellfirm/config.yaml
and change the check to enable:false
.
currently we supporting 3 different challenges when a command is detected:
* Math
- Default challenge which requires you to solve a math question.
* Enter
- Requite only Enter
to continue.
* Yes
- Requite yes
to continue.
You can change the default challenge by running the command:
bash
$ shellfirm config challenge --challenge Math
At any time you can exit with the challenge by ^C
shellfirm
:
bash
$ brew upgrade shellfirm
See the contributing directory for more developer documentation.