Author: gnc [email protected]
Copyright: © 2020, gnc
Date: 2020-09-11
Version: 0.1.1
kb is a text-oriented minimalist command line knowledge base manager. kb can be considered a quick note collection and access tool oriented toward software developers, penetration testers, hackers, students or whoever has to collect and organize notes in a clean way. Although kb is mainly targeted on text-based note collection, it supports non-text files as well (e.g., images, pdf, videos and others).
The project was born from the frustration of trying to find a good way to quickly access my notes, procedures, cheatsheets and lists (e.g., payloads) but at the same time, keeping them organized. This is particularly useful for any kind of student. I use it in the context of penetration testing to organize pentesting procedures, cheatsheets, payloads, guides and notes.
I found myself too frequently spending time trying to search for that particular payload list quickly, or spending too much time trying to find a specific guide/cheatsheet for a needed tool. kb tries to solve this problem by providing you a quick and intuitive way to access knowledge.
In few words kb allows a user to quickly and efficiently:
- collect items containing notes,guides,procedures,cheatsheets into an organized knowledge base;
- filter the knowledge base on different metadata: title, category, tags and others;
- visualize items within the knowledge base with (or without) syntax highlighting;
- grep through the knowledge base using regexes;
- import/export an entire knowledge base;
Basically, kb provides a clean text-based way to organize your knowledge.
The installation of kb can be performed by simply doing:
git clone https://github.com/gnebbia/kb
cd kb
pip install -r requirements.txt
python setup.py install
Tip for GNU/Linux and MacOS users: For a better user experience, also set the following kb bash aliases:
cat <<EOF > ~/.kb_alias
alias kbl="kb list"
alias kbe="kb edit --id"
alias kba="kb add"
alias kbv="kb view --id"
alias kbd="kb delete --id"
alias kbg="kb grep"
alias kbt="kb list --tags"
EOF
echo "source ~/.kb_alias" >> ~/.bashrc
source ~/.kb_alias
Tip for Windows users: Do not use notepad as %EDITOR%, kb is not compatible with notepad, a reasonable alternative is notepad++.
A quick demo of a typical scenario using kb:
A quick demo with kb aliases enabled:
A quick demo for non-text documents:
kb list
# or if aliases are used:
kbl
kb list zip
# or if aliases are used:
kbl zip
kb list --category cheatsheet
# or
kb list -c cheatsheet
# or if aliases are used:
kbl -c cheatsheet
kb list --tags "web;pentest"
# or if aliases are used:
kbl --tags "web;pentest"
kb list -v
# or if aliases are used:
kbl -v
kb add ~/Notes/cheatsheets/pytest
# or if aliases are used:
kba ~/Notes/cheatsheets/pytest
kb add ~/ssh_tunnels --title pentest_ssh --category "procedure" \
--tags "pentest;network" --author "gnc" --status "draft"
kb add ~/Notes/cheatsheets/general/* --category "cheatsheet"
kb add --title "ftp" --category "notes" --tags "protocol;network"
# a text editor ($EDITOR) will be launched for editing
kb delete --id 2
# or if aliases are used:
kbd 2
kb delete --id 2 3 4
# or if aliases are used:
kbd 2 3 4
kb delete --title zap --category cheatsheet
kb view --id 3
# or
kb view -i 3
# or if aliases are used:
kbv 3
kb view --title "gobuster"
# or
kb view -t "gobuster"
kb view -t dirb -n
kb view -i 2 -e
# or if aliases are used:
kbv 2 -e
Editing artifacts involves opening a text editor. Hence, binary files cannot be edited by kb.
The editor can be set by the "EDITOR" environment variable.
kb edit --id 13
# or if aliases are used:
kbe 13
kb edit --title "git" --category "cheatsheet"
# or
kb edit -t "git" -c "cheatsheet"
kb grep "[bg]zip"
# or if aliases are used:
kbg "[bg]zip"
kb grep -i "[BG]ZIP"
kb grep -v "[bg]zip"
kb export
This will generate a .kb.tar.gz archive that can
be later be imported by kb.
kb import archive.kb.tar.gz
NOTE: Importing a knowledge base erases all the previous
data. Basically it erases everything and imports the knowledge base.
kb erase
I am an independent developer working on kb in my free time, if you like kb and would like to say thank you, buy me a beer!
Copyright 2020 Giuseppe Nebbione.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.