104 lines
3.4 KiB
Markdown
104 lines
3.4 KiB
Markdown
# Fast Memo Shell
|
|
|
|
**Fast Memo Shell** is a tool designed to boost productivity when using a ZSH shell.
|
|
|
|
It allows users to enhance their current shell with a customized list of commands by using the Alt+L key combination or by typing the command 'f'.
|
|
|
|

|
|
|
|
## How to install
|
|
|
|
### Dependencies
|
|
|
|
FMS (Fast Memo Shell) a ZSH script based on three tools: [skim](https://github.com/lotabout/skim), [yq-go](https://github.com/mikefarah/yq) and [bat](https://github.com/sharkdp/bat).
|
|
|
|
All of them should be installed and available in your PATH with the commands 'sk', 'yq', and 'bat'.
|
|
|
|
For example, you can use Nix to install them:
|
|
|
|
```sh
|
|
nix-env -i skim bat yq-go
|
|
```
|
|
|
|
Or use Parabola GNU/Linux-libre binaries (a compatible method for a Kali Linux VM out of the box):
|
|
|
|
```sh
|
|
wget https://www.parabola.nu/packages/extra/x86_64/skim/download/ -O /tmp/skim.tar.zst
|
|
sudo tar --zstd -xvf /tmp/skim.tar.zst -C /usr/local/bin --strip-components=2 usr/bin/sk
|
|
|
|
wget https://www.parabola.nu/packages/extra/x86_64/go-yq/download/ -O /tmp/yq.tar.zst
|
|
sudo tar --zstd -xvf /tmp/yq.tar.zst -C /usr/local/bin --strip-components=2 usr/bin/yq
|
|
|
|
wget https://www.parabola.nu/packages/extra/x86_64/bat/download/ -O /tmp/bat.tar.zst
|
|
sudo tar --zstd -xvf /tmp/bat.tar.zst -C /usr/local/bin --strip-components=2 usr/bin/bat
|
|
```
|
|
|
|
### FMS
|
|
|
|
You should download the latest version and extract it in your home directory:
|
|
```sh
|
|
wget "https://git.hackade.org/fms/snapshot/fms-main.tar.gz" -O fms.tar.gz
|
|
tar zxvf fms.tar.gz -C ~
|
|
```
|
|
|
|
Then add the following line to your ZSH configuration file:
|
|
```sh
|
|
echo 'source ~/fms/integration.zsh' >> ~/.zshrc
|
|
```
|
|
|
|
## How to configure
|
|
|
|
Each command is stored in the file data/commands.yaml. To add new commands or modify existing ones, edit data/commands.yaml with the following fields:
|
|
```yaml
|
|
- cmd: <the command to insert in your prompt>
|
|
lang: <the language of your command, sh, ps1>
|
|
tags: <a tag reprenting a group of commands>
|
|
desc: <the description of the command>
|
|
```
|
|
|
|
The tags and desc fields are only used to provide information to easily find your command when you search for it.
|
|
The lang field is used for syntax highlighting.
|
|
|
|
Here is an example of an entry:
|
|
```yaml
|
|
- cmd: find / -perm -u=s -type f 2>/dev/null
|
|
lang: sh
|
|
tags: security
|
|
desc: Search for executables with SUID permission
|
|
```
|
|
|
|
Then, to update the database and apply the changes, run the following commands:
|
|
```sh
|
|
~/fms/fms.sh update
|
|
```
|
|
|
|
Warning, this may take a long time.
|
|
|
|
# Populate database from Arsenal data
|
|
|
|
The Fast Memo Shell can import data from the [Arsenal](https://github.com/Orange-Cyberdefense/arsenal) project, but you are highly encouraged to update it according to your needs.
|
|
|
|
To generate a FMS-compatible commands.yaml file from Arsenal use, the following script:
|
|
```
|
|
./data/generate_arsenal_commands.sh
|
|
```
|
|
|
|
## How to use
|
|
|
|
To launch Fast Memo Shell, there are two possibilities: press Alt+L or enter the command 'f'.
|
|
|
|
To select the right command, you can:
|
|
|
|
* Enter a string to find your command.
|
|
* Use the up and down arrow keys.
|
|
* Enter 'string to display only the commands containing this substring.
|
|
* Use the number assigned to the order to remember
|
|
* Once you have the desired command selected, just press Enter.
|
|
|
|
Fast Memo Shell can also display all available manuals. To switch between both modes, use Shift+Left and Shift+Right arrows."
|
|
|
|
## Todo
|
|
|
|
* Allow more language like java, cmd .. (with adapted comment chars for description)
|
|
* Multithreaded update
|