Merge branch 'main' of git.thomasba.de:thomasba/dot-files into main

main
Thomas Ba. 3 years ago
commit 1450e594a2

@ -59,18 +59,24 @@ def main():
parser.add_option('-e', '--encrypt', action='store_true', dest='encrypt', default=False, help='Encrypt password')
parser.add_option('-d', '--decrypt', action='store_true', dest='decrypt',default=True, help='Decrypt password. This is the default')
parser.add_option('-p', '--password', action='store', dest="password", help='Password to encrypt / decrypt')
parser.add_option('-q', '--quotes', action='store_true', dest='quotes', help='Show quotes around passwords ("«" and "»")')
parser.add_option('-f', '--file', action='store', dest="file", help='Cisco config file, only for decryption')
options, args = parser.parse_args()
render_as = "files"
QUOTE_LEFT = ""
QUOTE_RIGHT = ""
if(options.quotes):
QUOTE_LEFT = "«"
QUOTE_RIGHT = "»"
#fix issue 1, if encrypt is selected, that takes precedence
if (options.encrypt):
options.decrypt = False
if (options.password is not None):
if(options.decrypt):
print("Decrypted password: " + decrypt_type7(options.password))
print("Decrypted password: " + QUOTE_LEFT + decrypt_type7(options.password) + QUOTE_RIGHT)
elif(options.encrypt):
print("Encrypted password: " + encrypt_type7(options.password))
print("Encrypted password: " + QUOTE_LEFT + encrypt_type7(options.password) + QUOTE_RIGHT)
elif (options.file is not None):
if(options.decrypt):
try:
@ -79,7 +85,7 @@ def main():
for line in f:
result = regex.search(line)
if(result):
print("Decrypted password: " + decrypt_type7(result.group(2)))
print("Decrypted password: " + QUOTE_LEFT + decrypt_type7(result.group(2)) + QUOTE_RIGHT)
except IOError:
print("Couldn't open file: " + options.file)
elif(options.encrypt):
@ -87,10 +93,10 @@ def main():
else:
if(options.decrypt):
password = getpass.getpass("Enter type 7 password:")
print("Decrypted password: " + decrypt_type7(password))
print("Decrypted password: " + QUOTE_LEFT + decrypt_type7(password) + QUOTE_RIGHT)
if(options.encrypt):
password = getpass.getpass("Enter password:")
print("Encrypted password: " + encrypt_type7(password))
print("Encrypted password: " + QUOTE_LEFT + encrypt_type7(password) + QUOTE_RIGHT)
if __name__ == '__main__':
main()

@ -10,3 +10,5 @@
rebase = false
[gpg]
program = gpg
[init]
defaultBranch = main

@ -1,3 +1,32 @@
# editor
if command -v nvim &> /dev/null; then
alias vim=nvim
alias vi=nvim
export EDITOR='nvim'
elif command -v vim &> /dev/null; then
alias nvim=vim
alias vi=vim
export EDITOR='vim'
elif command -v nano &> /dev/null; then
alias nvim=nano
alias vim=nano
alias vi=nano
export EDITOR='nano'
elif command -v mcedit &> /dev/null; then
alias nvim=mcedit
alias vim=mcedit
alias vi=mcedit
export EDITOR='mcedit'
elif command -v vi &> /dev/null; then
alias nvim=vi
alias vim=vi
alias vi=vi
export EDITOR='vi'
fi
alias e=$EDITOR
alias :e=$EDITOR
# aliases
alias cd..='cd ..'

@ -1,6 +1,8 @@
if [ "$(uname)" != "Darwin" ] ; then
eval "$(gnome-keyring-daemon --start --daemonize --components=pkcs11,secrets,ssh,gpg)"
export SSH_AUTH_SOCK
export GPG_AGENT_INFO
fi
# aliases

@ -27,6 +27,9 @@ case "$MTYPE" in
if [[ "$(ssh-add -l)" == "The agent has no identities." ]]; then
ssh-add
fi
if [ ! -f '/var/run/crond.pid' ] ; then
sudo /etc/init.d/cron start
fi
;;
"SERVER")
source $HOME/.zsh/commands-server
@ -45,15 +48,11 @@ if [ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
elif [ -f "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] ; then
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
elif [ -f "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] ; then
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
else
printf "-!- zsh-syntax-highlighting not installed!"
fi
# completion
zstyle ':completion:*:*:kill:*:processes' command "ps -u $USER -o pid,user,comm,args -w -w"
export EDITOR='vim'
if [ ! -f '/var/run/crond.pid' ] ; then
sudo /etc/init.d/cron start
fi

Loading…
Cancel
Save