From 2885a0ee097d10cbcaa75b0adb044380f75d10c2 Mon Sep 17 00:00:00 2001 From: thomasba Date: Mon, 14 Feb 2022 13:16:48 +0100 Subject: [PATCH 1/3] Use main as default branch --- gitconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitconfig b/gitconfig index 57c4816..b774e28 100644 --- a/gitconfig +++ b/gitconfig @@ -10,3 +10,5 @@ rebase = false [gpg] program = gpg +[init] + defaultBranch = main From 75166934ec86cbadca137ac86ad2b1744328316a Mon Sep 17 00:00:00 2001 From: thomasba Date: Mon, 14 Feb 2022 13:17:55 +0100 Subject: [PATCH 2/3] Added option to print quotes --- bin/ciscot7.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/ciscot7.py b/bin/ciscot7.py index 9da6918..20c6fbe 100755 --- a/bin/ciscot7.py +++ b/bin/ciscot7.py @@ -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() From 3f9dc9afdd05124db1ad060210c0cd5eab915517 Mon Sep 17 00:00:00 2001 From: thomasba Date: Mon, 14 Feb 2022 13:25:46 +0100 Subject: [PATCH 3/3] Adjustments for WSL and MacOS --- zsh/commands | 29 +++++++++++++++++++++++++++++ zsh/commands-pc | 8 +++++--- zsh/zshrc.local | 11 +++++------ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/zsh/commands b/zsh/commands index ff0a9aa..11791cb 100644 --- a/zsh/commands +++ b/zsh/commands @@ -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 ..' diff --git a/zsh/commands-pc b/zsh/commands-pc index 8cd042f..3c4eab3 100644 --- a/zsh/commands-pc +++ b/zsh/commands-pc @@ -1,6 +1,8 @@ -eval "$(gnome-keyring-daemon --start --daemonize --components=pkcs11,secrets,ssh,gpg)" -export SSH_AUTH_SOCK -export GPG_AGENT_INFO +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 diff --git a/zsh/zshrc.local b/zsh/zshrc.local index 0b874b3..386317a 100644 --- a/zsh/zshrc.local +++ b/zsh/zshrc.local @@ -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