diff options
-rwxr-xr-x | Makefile | 24 | ||||
-rw-r--r-- | README.md | 232 | ||||
-rw-r--r-- | man/lpass.1 | 162 | ||||
-rw-r--r-- | src/easydir.c (renamed from easydir.c) | 0 | ||||
-rw-r--r-- | src/easydir.h (renamed from easydir.h) | 0 | ||||
-rw-r--r-- | src/handerror.c (renamed from handerror.c) | 0 | ||||
-rw-r--r-- | src/handerror.h (renamed from handerror.h) | 0 | ||||
-rw-r--r-- | src/implementation.c (renamed from implementation.c) | 0 | ||||
-rw-r--r-- | src/implementation.h (renamed from implementation.h) | 0 | ||||
-rw-r--r-- | src/main.c (renamed from main.c) | 30 |
10 files changed, 415 insertions, 33 deletions
@@ -1,8 +1,11 @@ PREFIX = /usr/local/bin CC = gcc CFLAGS = -Wall -g -SOURCES = easydir.c handerror.c implementation.c main.c -OBJECTS = $(SOURCES:.c=.o) +MAN_PATH = /usr/share/man/man1 +SOURCES = src/easydir.c src/handerror.c src/implementation.c src/main.c +OBJECTS = easydir.o handerror.o implementation.o main.o +MAN_SOURCES = man/lpass.1 +MAN_OBJECTS = lpass.1.gz BASH = lpass_copy.sh EXECUTABLE = lpass @@ -12,6 +15,7 @@ all: $(EXECUTABLE) clean: @rm -rf $(EXECUTABLE) $(OBJECTS) + @rm -rf $(MAN_OBJECTS) $(OBJECTS): @$(CC) -c $(CFLAGS) $(SOURCES) @@ -21,12 +25,16 @@ $(EXECUTABLE): $(OBJECTS) install: all @echo installing files to $(PREFIX) - @install $(EXECUTABLE) $(PREFIX) - @chmod 755 $(PREFIX)/$(EXECUTABLE) - @install $(BASH) $(PREFIX) - @chmod 755 $(PREFIX)/$(BASH) + @install $(EXECUTABLE) $(PREFIX) && chmod 755 $(PREFIX)/$(EXECUTABLE) + @install $(BASH) $(PREFIX) && chmod 755 $(PREFIX)/$(BASH) + @echo installing man page + @cat $(MAN_SOURCES) | gzip > $(MAN_OBJECTS) + @install $(MAN_OBJECTS) $(MAN_PATH) uninstall: @echo removing files from $(PREFIX) - @rm -rf $(PREFIX)/$(EXECUTABLE) - @rm -rf $(PREFIX)/$(BASH)
\ No newline at end of file + @echo deleting man page + @rm -rf \ + $(PREFIX)/$(EXECUTABLE) \ + $(PREFIX)/$(BASH) \ + $(MAN_PATH)/$(MAN_OBJECTS)
\ No newline at end of file @@ -1,23 +1,209 @@ -# LockPassword - a simple terminal password manager -## Synopsis -### lpass [command] - -## Commands -### --init -Initialize password bank. Before use a LockPassword you must be run this command. -### -c -In developing... -### -e name -Edit a existing password in 'name'. -### -g [number-of-symbols] name -Generate a new password using length [number-of-symbols] and insert in name. Without [number-of-symbols] default generate 10 chars. -### -i name -Create 'name' store and insert your password there. -### -R name -Remove 'name' store from the password bank. - -## How are passwords stored? -For now, passwords are kept in clear еtext. We will add password encryption in the next update - -## Guide -Coming soon... +# LockPassword +a simple terminal password manager, using GnuPG to encrypt passwords. The application positions itself as open-source software. Distributed under the Unlicense license. + +## Dependencies: +The following dependencies must be installed for work: +* tree +* gpg +* gcc + +P.S: these can be installed using the package manager such as `pacman`, `apt`, `yum` etc. + +## Installation: +Run the next commands: +``` +git clone https://github.com/Joursoir/lockpassword +make +sudo make install +``` + +## Synopsis: +lpass [command] [arguments] ... + +## Commands: +### init *gpg-key* +Initialize the password manager using the passed *gpg-key* as the encryption key. This command must be run first before you start working with LockPassword. +### insert [**-e, --echo**] [**-c, --copy**] [**-f, --force**] *passname* +Add the specified *passname* to the password manager. The password will be read interactively using standard input, character display is hidden. The **-e, --echo** argument enable the show of characters when typing a password; **-c, --copy** write password to clipboard; **-f, --force** ignore exist of *passname*, overwrites it without prompt. +### edit [**-t, --text-editor=text-editor**] *passname* +Open the specified *passname* in a text editor, waiting for changes. Standard text editor - vim, argument **-t, --text-editor = text-editor** allow you to change it. +### generate [**-l, --length=pass-length**] [**-c, --copy**] [**-f, --force**] *passname* +Generate a random password and write it in *passname*. The **-l, --length = pass-length** argument allow you to specify the desired password length. Without this argument, a 14 character password will be generated. **-c, --copy** write password to clipboard; **-f, --force** ignore exist of *passname*, overwrites it without prompt. +### mv/move [**-f, --force**] *old-path* *new-path* +Move/rename *old-path* to *new-path*. *old-path* must be an exist file, *new-path* can be a file/directory. The **-f, --force** argument ignore exist of *new-path* (if it's a file), overwrites it without prompt. +### rm/remove/delete *passname* +Remove the *passname* you specified from the password manager. If the directories where your *passname* was nested became empty after deletion, then they are also deleted. +### help +Print help information about commands and the application itself. +### version +Print information about the version, release date, and license of the application. + +## Guide: +* Initialize the password manager: +``` +[joursoir@archlin ~]$ lpass init joursoir@github.com +mkdir: created directory '/home/joursoir/.lock-password/' +LockPassword initialized successfully +``` +``` +[joursoir@archlin ~]$ lpass init 3BC3B37774696574B0F1C7D47B411E35F4F03E49 +mkdir: created directory '/home/joursoir/.lock-password/' +LockPassword initialized successfully +``` + +* Add password in the password manager: +``` +[joursoir@archlin ~]$ lpass insert games/chess/user +Please type your new password: [invisible input] +Please type your new password again: [invisible input] +Password added successfully for games/chess/user +``` + +* Print a list of exists password: +``` +[joursoir@archlin ~]$ lpass +Password Manager +|-- banks +| |-- abankpro +| | `-- phone_number +| `-- ubank +| `-- phone_number +`-- games + `-- chess + |-- site.com + `-- user +``` + +* Print a list of exists password in some directory: +``` +[joursoir@archlin ~]$ lpass banks +Password Manager/banks +|-- abankpro +| `-- phone_number +`-- ubank + `-- phone_number +``` + +* Show password: +``` +[joursoir@archlin ~]$ lpass games/iko/LordOfNight +helloitismypassword123 +``` + +* Copy password to clipboard: +``` +[joursoir@archlin ~]$ lpass -c games/iko/LordOfNight +Password copied to clipboard. +``` + +* Generate password: +``` +[joursoir@archlin ~]$ lpass generate bank/sbank/phone_number +Generated password: NsNu:+^Re(cshW +Password added successfully for bank/sbank/phone_number +``` + +# LockPassword - +простой терминальный менеджер паролей, использующий GnuPG для шифрования паролей. Приложение позиционирует себя, как открытое программное обеспечение. Распространяется под лицензией Unlicense. + +## Зависимости: +Для работы приложения необходимо установить следующие зависимости: +* tree +* gpg +* gcc + +P.S: их можно установить с помощью пакет менеджеров, таких как `pacman`, `apt`, `yum` и другие. + +## Установка: +Выполните следующие команды: +``` +git clone https://github.com/Joursoir/lockpassword +make +sudo make install +``` + +## Синтаксис: +lpass [command] [arguments] ... + +## Команды: +### init *gpg-key* +Инициализирует менеджер паролей, в качестве ключа шифрования использует переданный *gpg-key*. Это команда должна быть запущена самой первой, перед тем как вы начнете работу с LockPassword. +### insert [**-e, --echo**] [**-c, --copy**] [**-f, --force**] *passname* +Добавляет указанный *passname* в менеджер паролей. Пароль будет считан в интерактивном режиме, с помощью стандартного потока ввода данных, отображение символов скрыто. Аргумент **-e, --echo** позволяет включить отображение символов при вводе пароля; **-c, --copy** записывает пароль в буфер обмена; **-f, --force** игнорирует наличие существующего *passname*, перезаписывает его не спрашивая. +### edit [**-t, --text-editor=text-editor**] *passname* +Открывает указанный *passname* в текстовом редакторе, ожидая изменений. Стандартный текстовый редактор - vim, аргумент **-t, --text-editor=text-editor** позволяет сменить его. +### generate [**-l, --length=pass-length**] [**-c, --copy**] [**-f, --force**] *passname* +Генерирует случайный пароль и записывает его в *passname*. Аргумент **-l, --length=pass-length** позволяет указать желаемую длину пароля. Без данного аргумента будет сгенерирован пароль длиной 14 символов. Аргумент **-c, --copy** записывает пароль в буфер обмена; **-f, --force** игнорирует наличие существующего *passname*, перезаписывает его не спрашивая. +### mv/move [**-f, --force**] *old-path* *new-path* +Передвигает/переименовывает *old-path* в *new-path*. *old-path* обязательно должен быть существующим файлом, *new-path* может быть файлом/директорией. Аргумент **-f, --force** игнорирует наличие существующего *new-path* (если это файл), перезаписывает его не спрашивая. +### rm/remove/delete *passname* +Удаляет указанный вами *passname* из менеджера паролей. Если директории, куда был вложен ваш *passname* после удаления стали пусты, то они тоже удаляются. +### help +Выводит справочную информацию о командах и самом приложении. +### version +Выводит информацию о версии, дате выпуска и лицензии приложения. + +## Гайд: +* Инициализация менеджера паролей: +``` +[joursoir@archlin ~]$ lpass init joursoir@github.com +mkdir: created directory '/home/joursoir/.lock-password/' +LockPassword initialized successfully +``` +``` +[joursoir@archlin ~]$ lpass init 3BC3B37774696574B0F1C7D47B411E35F4F03E49 +mkdir: created directory '/home/joursoir/.lock-password/' +LockPassword initialized successfully +``` + +* Добавить пароль в менеджер паролей: +``` +[joursoir@archlin ~]$ lpass insert games/chess/user +Please type your new password: [невидимый ввод текста] +Please type your new password again: [невидимый ввод текста] +Password added successfully for games/chess/user +``` + +* Вывести список существующих паролей: +``` +[joursoir@archlin ~]$ lpass +Password Manager +|-- banks +| |-- abankpro +| | `-- phone_number +| `-- ubank +| `-- phone_number +`-- games + `-- chess + |-- site.com + `-- user +``` + +* Вывести список существующих паролей в какой-либо директории: +``` +[joursoir@archlin ~]$ lpass banks +Password Manager/banks +|-- abankpro +| `-- phone_number +`-- ubank + `-- phone_number +``` + +* Показать пароль: +``` +[joursoir@archlin ~]$ lpass games/iko/LordOfNight +helloitismypassword123 +``` + +* Скопировать пароль в буфер обмена: +``` +[joursoir@archlin ~]$ lpass -c games/iko/LordOfNight +Password copied to clipboard. +``` + +* Сгенерировать пароль: +``` +[joursoir@archlin ~]$ lpass generate bank/sbank/phone_number +Generated password: NsNu:+^Re(cshW +Password added successfully for bank/sbank/phone_number +```
\ No newline at end of file diff --git a/man/lpass.1 b/man/lpass.1 new file mode 100644 index 0000000..02ed320 --- /dev/null +++ b/man/lpass.1 @@ -0,0 +1,162 @@ +.TH "LPASS" "1" "30\ \&OCTOBER\ \&2020" "LPASS v1.0" "LockPassword" + +.SH "NAME" +LockPassword - a password manager. + +.SH "SYNOPSIS" +\fBlpass\fR [\fBcommand\fR] [\fBarguments\fR] ... + +.SH "DESCRIPTION" +\fBlpass\fR \- a simple terminal password manager, using GnuPG to encrypt passwords. The application positions itself as open-source software. Distributed under the Unlicense license. + +.SH "COMMANDS" +\fBinit \fIgpg-key\fR +.RS 4 +Initialize the password manager using the passed \fIgpg-key\fR as the encryption key. This command must be run first before you start working with LockPassword. +.RE +.PP + +\fBinsert\fR [\fB-e, --echo\fR] [\fB-c, --copy\fR] [\fB-f, --force\fR] \fIpassname\fR +.RS 4 +Add the specified \fIpassname\fR to the password manager. The password will be read interactively using standard input, character display is hidden. The \fB-e, --echo\fR argument enable the show of characters when typing a password; \fB-c, --copy\fR write password to clipboard; \fB-f, --force\fR ignore exist of \fIpassname\fR, overwrites it without prompt. +.RE +.PP + +\fBedit\fR [\fB-t, --text-editor=text-editor\fR] \fIpassname\fR +.RS 4 +Open the specified \fIpassname\fR in a text editor, waiting for changes. Standard text editor - vim, argument \fB-t, --text-editor = text-editor\fR allow you to change it. +.RE +.PP + +\fBgenerate\fR [\fB-l, --length=pass-length\fB] [\fB-c, --copy\fR] [\fB-f, --force\fR] \fIpassname\fR +.RS 4 +Generate a random password and write it in \fIpassname\fR. The \fB-l, --length = pass-length\fR argument allow you to specify the desired password length. Without this argument, a 14 character password will be generated. \fB-c, --copy\fR write password to clipboard; \fB-f, --force\fR ignore exist of \fIpassname\fR, overwrites it without prompt. +.RE +.PP + +\fBmv/move\R [\fB-f, --force\fR] \fIold-path\R \fInew-path\fR +.RS 4 +Move/rename \fIold-path\fR to \fInew-path\fR. \fIold-path\fR must be an exist file, \fInew-path\fR can be a file/directory. The \fB-f, --force\fR argument ignore exist of \fInew-path\fR (if it's a file), overwrites it without prompt. +.RE +.PP + +\fBrm/remove/delete \fIpassname\fR +.RS 4 +Remove the \fIpassname\fR you specified from the password manager. If the directories where your \fIpassname\fR was nested became empty after deletion, then they are also deleted. +.RE +.PP + +\fBhelp\fR +.RS 4 +Print help information about commands and the application itself. +.RE +.PP + +\fBversion\fR +.RS 4 +Print information about the version, release date, and license of the application. +.RE +.PP + +.SH "EXAMPLES" +Initialize the password manager: +.RS 4 +\fB[joursoir@archlin ~]$ lpass init joursoir@github.com\fR +.br +mkdir: created directory '/home/joursoir/.lock-password/'R +.br +LockPassword initialized successfully +.RE +.PP + +Add password in the password manager: +.RS 4 +\fB[joursoir@archlin ~]$ lpass insert games/chess/user\fR +.br +Please type your new password: [invisible input] +.br +Please type your new password again: [invisible input] +.br +Password added successfully for games/chess/user +.RE +.PP + +Print a list of exists password: +.RS 4 +\fB[joursoir@archlin ~]$ lpass\fR +.br +Password Manager +.br +|-- banks +.br +| |-- abankpro +.br +| | `-- phone_number +.br +| `-- ubank +.br +| `-- phone_number +.br +`-- games +.br + `-- chess +.br + |-- site.com +.br + `-- user +.RE +.PP + +Print a list of exists password in some directory: +.RS 4 +\fB[joursoir@archlin ~]$ lpass banks\fR +.br +Password Manager/banks +.br +|-- abankpro +.br +| `-- phone_number +.br +`-- ubank +.br + `-- phone_number +.RE +.PP + +Show password: +.RS 4 +\fB[joursoir@archlin ~]$ lpass games/iko/LordOfNight\fR +.br +helloitismypassword123 +.RE +.PP + +Copy password to clipboard: +.RS 4 +\fB[joursoir@archlin ~]$ lpass -c games/iko/LordOfNight\fR +.br +Password copied to clipboard. +.RE +.PP + +Generate password: +.RS 4 +\fB[joursoir@archlin ~]$ lpass generate bank/sbank/phone_number\fR +.br +Generated password: NsNu:+^Re(cshW +.br +Password added successfully for bank/sbank/phone_number +.RE +.PP + +.SH "AUTHOR" +Code was written by Joursoir + +.SH "COPYING" +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. + +In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/easydir.c b/src/easydir.c index 162bae7..162bae7 100644 --- a/easydir.c +++ b/src/easydir.c diff --git a/easydir.h b/src/easydir.h index 4680709..4680709 100644 --- a/easydir.h +++ b/src/easydir.h diff --git a/handerror.c b/src/handerror.c index 35e8f28..35e8f28 100644 --- a/handerror.c +++ b/src/handerror.c diff --git a/handerror.h b/src/handerror.h index 6f75c7b..6f75c7b 100644 --- a/handerror.h +++ b/src/handerror.h diff --git a/implementation.c b/src/implementation.c index 3ba2be7..3ba2be7 100644 --- a/implementation.c +++ b/src/implementation.c diff --git a/implementation.h b/src/implementation.h index f41cc4a..f41cc4a 100644 --- a/implementation.h +++ b/src/implementation.h @@ -19,7 +19,7 @@ #include "implementation.h" #define VERSION "1.0" -#define DATE_RELEASE "21 October, 2020" +#define DATE_RELEASE "31 October, 2020" //#define DEBUG #define STANDARD_TEXTEDITOR "vim" #define MAXLEN_TEXTEDITOR 16 @@ -431,14 +431,40 @@ static void cmd_showtree(int argc, char *argv[]) static void cmd_help() { + printf("Synopsis:\n\tlpass [command] [arguments] ...\n"); + printf("Commands:\n\tinit gpg-key\n"); + printf("\t\tInitialize the password manager using the passed gpg-key.\n"); + + printf("\tinsert [-e, --echo] [-c, --copy] [-f, --force] passname\n"); + printf("\t\tAdd the specified passname to the password manager.\n"); + + printf("\tedit [-t, --text-editor=text-editor] passname\n"); + printf("\t\tOpen the specified passname in a text editor, waiting for changes.\n"); + + printf("\tgenerate [-l, --length=pass-length] [-c, --copy] [-f, --force] passname\n"); + printf("\t\tGenerate a random password and write it in passname.\n"); + + printf("\tmv/move [-f, --force] old-path new-path\n"); + printf("\t\tMove/rename old-path to new-path.\n"); + + printf("\trm/remove/delete passname\n"); + printf("\t\tRemove the passname you specified from the password manager.\n"); + + printf("\thelp\n"); + printf("\t\tPrint help information about commands and the application itself.\n"); + + printf("\tversion\n"); + printf("\t\tPrint version information.\n"); + + printf("\nMore information may be found in the lpass(1) man page.\n"); } static void cmd_version() { printf("LockPassword v%s\n", VERSION); printf("Release date: %s\n\n", DATE_RELEASE); - printf("Code written by Joursoir\n"); + printf("Code was written by Joursoir\n"); printf("This is free and unencumbered software released into the public domain.\n\n"); } |