aboutsummaryrefslogtreecommitdiffstats

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'.

Demo

How to install

Dependencies

FMS (Fast Memo Shell) a ZSH script based on three tools: skim, yq-go and 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:

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):

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:

wget "https://git.hackade.org/ben/fms/archive/main.tar.gz" -O fms.tar.gz
tar zxvf fms.tar.gz -C ~

Then add the following line to your ZSH configuration file:

echo 'source ~/fms/integration.zsh' >> ~/.zshrc

How to configure

Each command is stored in the file commands.yaml. To add new commands or modify existing ones, edit commands.yaml with the following fields:

  - 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:

  - 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:

~/fms/fms.sh update

Warning, this may take a long time.

The Fast Memo Shell comes with a list of commands, but you are highly encouraged to update it according to your needs.

The database provided as an example comes from a quick extract of the Arsenal tool's database.

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
  • Write a clean extractor for Arsenal