<commit_before>#!/usr/bin/env bash

# vpn-connect.sh
#
# by <NAME>, 2017-12-06
#
# Automated connection to Cisco VPN using AnyConnect client CLI, reading credential / login script
# from Mac OS Keychain where it is stored securely. All handling of secrets is done in memory
# and pipes for security; no temp files!
#
#
# Usage:
# 	vpn-connect.sh [ -v ] [ -h ] [ -n "name of login script in Keychain" ] [ -d "name of VPN device" ]
#
# WARNING: USING "-v" WILL DISPLAY CREDENTIALS ON YOUR SCREEN. Do not use "-v" in a non-private environment.
#
# 
# Requirements:
#	- running this on a Mac OS X machine
# 	- Cisco AnyConnect VPN client software
# 	- a Mac Keychain item (Password or Secure Note) in the correct format - see below
# 
# 
# 
########################################################################################################################
# Keychain item format details
# 
# 
# Secure Note Item:
# 	- must be multiple lines, in this order: [ username#realm, password, blank line, "y" ]
# 
# Secure Note Example:
#-------------------------------------
# <EMAIL>#vpnrealm
# p4ssw0rd
# 
# y
#-------------------------------------
# 
# 
# Password Item:
# 	- must be a SINGLE line with "\n" separating each element
# 	- elements are the same as, and in the same order as, the Secure Note format
# 
# Password Item Example:
#-------------------------------------
# <EMAIL>#vpnrealm\np4ssw0rd\n\ny\n
#-------------------------------------
# 
# Note that there are two "\n" back-to-back in the Password Item, to represent the
# end of the password line and the blank line.
# 
########################################################################################################################
# 
# Notes:
# 	- in Mac OS X 10.13.1, if you rename a Secure Note in the Keychain you might not ever be able to access
# 		it again from the CLI!! It appears that the 'security' command can only read the "Service" name
# 		of a Secure Note, but when you rename an existing one the "Service" name DOES NOT change!
# 		If you want to change the name of an existing Secure Note and still use it with this script
# 		(or any other script calling "/usr/bin/security") you may have to delete and re-create the item.
# 
# 
# Shout-outs:
# https://superuser.com/questions/1153273/access-key-pairs-in-a-macos-keychain-from-the-commandline
# https://superuser.com/questions/649614/connect-using-anyconnect-from-command-line



<commit_msg>Minor formatting.<commit_after>#!/usr/bin/env bash

# vpn-connect.sh
#
# by <NAME>, 2017-12-06
#
# Automated connection to Cisco VPN using AnyConnect client CLI, reading credential / login script
# from Mac OS Keychain where it is stored securely. All handling of secrets is done in memory
# and pipes for security; no temp files!
#
#
# Usage:
# 	vpn-connect.sh [ -v ] [ -h ] [ -n "name of login script in Keychain" ] [ -d "name of VPN device" ]
#
# WARNING: USING "-v" WILL DISPLAY CREDENTIALS ON YOUR SCREEN. Do not use "-v" in a non-private environment.
#
# 
# Requirements:
#	- running this on a Mac OS X machine
# 	- Cisco AnyConnect VPN client software
# 	- a Mac Keychain item (Password or Secure Note) in the correct format - see below
# 
# 
# 
########################################################################################################################
# Keychain item format details
# 
# 
# Secure Note Item:
# 	- must be multiple lines, in this order: [ username#realm, password, blank line, "y" ]
# 
# Secure Note Example:
#-------------------------------------------------------
# <EMAIL>#vpnrealm
# p4ssw0rd
# 
# y
#-------------------------------------------------------
# 
# 
# Password Item:
# 	- must be a SINGLE line with "\n" separating each element
# 	- elements are the same as, and in the same order as, the Secure Note format
# 
# Password Item Example:
#-------------------------------------------------------
# <EMAIL>#vpnrealm\np4ssw0rd\n\ny\n
#-------------------------------------------------------
# 
# Note that there are two "\n" back-to-back in the Password Item, to represent the
# end of the password line and the blank line.
# 
########################################################################################################################
# 
# Notes:
# 	- in Mac OS X 10.13.1, if you rename a Secure Note in the Keychain you might not ever be able to access
# 		it again from the CLI!! It appears that the 'security' command can only read the "Service" name
# 		of a Secure Note, but when you rename an existing one the "Service" name DOES NOT change!
# 		If you want to change the name of an existing Secure Note and still use it with this script
# 		(or any other script calling "/usr/bin/security") you may have to delete and re-create the item.
# 
# 
# Shout-outs:
# https://superuser.com/questions/1153273/access-key-pairs-in-a-macos-keychain-from-the-commandline
# https://superuser.com/questions/649614/connect-using-anyconnect-from-command-line




{'fraction_non_alphanumeric': 0.25626009693053314, 'fraction_numerical': 0.012116316639741519, 'mean_word_length': 2.8070714834742505, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1148014', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1401, 'n_words': 555}