From 9bcbf9302f2599d22918087f027b63611433d316 Mon Sep 17 00:00:00 2001 From: encrypt Date: Wed, 8 Jul 2015 17:30:52 +0200 Subject: [PATCH] first commit --- README.md | 14 ++++++++ cpozzi | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 README.md create mode 100755 cpozzi diff --git a/README.md b/README.md new file mode 100644 index 0000000..e016861 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +cpozzi +====== + +**cpozzi** is a new password manager developer following HackingTeam's security standards. +It stores all your password in a **.xlsx** file (~/passwords.xlsx) obviously in clear text because "we don't have anything to hide". + +Usage +----- + + * `make install` + * `cpozzi init` + * `cpozzi insert password-name` + * `cpozzi show password-name` + diff --git a/cpozzi b/cpozzi new file mode 100755 index 0000000..98cf7ce --- /dev/null +++ b/cpozzi @@ -0,0 +1,102 @@ +#!/bin/sh + +WALLET=$HOME/passwords.xlsx +TMP_WALLET=/tmp/passwords.csv +STRONG_PASSWORD="Passw0rd" +clip=0 +strong=0 + +csv2xlsx() { + soffice --headless --convert-to xlsx $TMP_WALLET --outdir $HOME > /dev/null + rm $TMP_WALLET +} + +xlsx2csv() { + soffice --headless --convert-to csv $WALLET --outdir /tmp/ > /dev/null +} + +init() { + touch $TMP_WALLET + csv2xlsx +} + +insert() { + password_name=$1 + password=$2 + xlsx2csv + cat $TMP_WALLET | grep -q "^$password_name," + if [ $? -eq 0 ];then + echo "Passw0rd for $password_name already exists (and you should not change it)" + rm $TMP_WALLET + exit 1 + fi + ### NO ENCRYPTION -- cuz "we don't have anything to hide" + echo "$password_name,$password" >> $TMP_WALLET + csv2xlsx +} + +show() { + password_name=$1 + xlsx2csv + entry=`cat $TMP_WALLET | grep -m 1 -w "^$password_name"` + if [ $? -ne 0 ]; then + echo "Passw0rd for $password_name not found (try with \"Passw0rd\")" + else + password=`echo $entry | cut -f 2 -d ,` + if [ $clip -ne 1 ];then + echo $password + else + echo $password | xclip + echo "Passw0rd copied to clipboard" + fi + + fi + rm $TMP_WALLET +} + +help() { + echo "Usage: cpozzi COMMAND password-name [options..]" + echo "The SECURE Passw0rd Manager" + echo "Commands:" + echo " init Initialize an empty password manager" + echo " insert password-name [-g] Insert new passsword, optionally generate a strong password™" + echo " show password-name [-c] Show existing password and optionally put it on the clipboard" +} + +command=$1 +password_name=$2 +shift 2 +for arg in "$@" +do + case $arg in + -s|-g|--strong) + strong=1 + ;; + -c|--clip) + clip=1 + ;; + *) + ;; + esac +done + + +case $command in + "init") + init + ;; + "show") + show $password_name + ;; + "insert") + if [ $strong -eq 1 ];then + password=$STRONG_PASSWORD + else + read -s -p "Passw0rd:" password + fi + insert $password_name $password + ;; + *) + help + ;; +esac