存储和搜索命令行
spellbook的Python项目详细描述
存储和搜索命令行
问题
灵感来自opennssl命令行工具的用户体验。 在我以前的一个项目中,我使用openssl命令行工具。 在下面的例子中,我将使用openssl来演示如何使用拼写本。
最快的开始
安装拼写手册:
$ pip install spellbook
创建第一个名为aux:
$ spellbook aux create
将拼写添加到您的拼写本:
$ spellbook aux add "tar -xvzf file.tar.gz" "extract tar.gz archive"
搜索:
$ spellbook aux search tar tar -xvzf file.tar.gz
文件
我们的想法是为openssl创建“book”。
创建第一个名为openssl的魔法书:
$ spellbook openssl create
然后为Linux创建拼写手册:
$ spellbook linux create
添加
向其中添加一些数据,有三种方法:
格式:
$ spellbook <book_name> add [command [description]]
添加命令和说明:
$ spellbook openssl add "openssl rand 16 -hex" "generate random 16 bytes and encode as hex" openssl rand 16 -hex::generate random 16 bytes and encode as hex
仅使用命令添加:
$ spellbook openssl add "openssl asn1parse -in 3msg.enc.der -inform der" provide description>> show asn1 encoded file openssl asn1parse -in 3msg.enc.der -inform der::show asn1 encoded file
不带命令添加:
$ spellbook openssl add provide command>> openssl des3 -d -in 3msg.enc.msg -K `xxd -p 3msg.dec.key` -iv `xxd -p 3msg.iv` provide description>> decode file using des3 with key and iv openssl des3 -d -in 3msg.enc.msg -K `xxd -p 3msg.dec.key` -iv `xxd -p 3msg.iv`::decode file using des3 with key and iv
在Linux手册中添加一些内容:
$ spellbook linux add "tar -xvzf file.tar.gz" "extract tar.gz archive" tar -xvzf file.tar.gz::extract tar.gz archive
搜索
在书本openssl中搜索:
$ spellbook openssl search rand openssl rand 16 -hex
或在所有书籍中(-means all):
$ spellbook - search extract tar -xvzf file.tar.gz
搜索任意单词:
$ spellbook - search openssl d openssl rand 16 -hex openssl asn1parse -in 3msg.enc.der -inform der openssl des3 -d -in 3msg.enc.msg -K `xxd -p 3msg.dec.key` -iv `xxd -p 3msg.iv`
或全方位拍摄:
$ spellbook - search "openssl d" openssl des3 -d -in 3msg.enc.msg -K `xxd -p 3msg.dec.key` -iv `xxd -p 3msg.iv`
列表
列出所有咒语:
$ spellbook openssl list openssl rand 16 -hex ::>> generate random 16 bytes and encode as hex openssl asn1parse -in 3msg.enc.der -inform der ::>> show asn1 encoded file openssl des3 -d -in 3msg.enc.msg -K `xxd -p 3msg.dec.key` -iv `xxd -p 3msg.iv` ::>> decode file using des3 with key and iv
Dropbox支持
只需安装Dropbox或使用Dropbox安装咒语书即可
$ pip install spellbook[with_dropbox] or $ pip install spellbook dropbox
连接到Dropbox
$ spellbook - connectdb
1. Go to: https://www.dropbox.com/1/oauth2/authorize?response_type=code&client_id=ow3gosk8pb9bhkr
2. Click "Allow" (you might have to log in first)
3. Copy the authorization code.
provide the authorization code here>> oh4dTc9F_fgAAAAAAAAC3fovgKZ7cPL65mS5Ajxevug
successfully linked account: DonPiekarz
使用Dropbox同步魔法书
所有魔法书将与您的Dropbox帐户同步
$ spellbook - sync
未来工作
- 一些结束解析参数的技巧
- 重构