From a5b270c04aa38d51cdc53fbb979efc6cd8c90f21 Mon Sep 17 00:00:00 2001 From: Morgan Simonsen Date: Thu, 6 Aug 2020 20:51:03 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Support=20accepting=20notices=20-=20add=20p?= =?UTF-8?q?arameter=20to=20accept=20notices=20from=20server,=20by=20adding?= =?UTF-8?q?=20'y'=20to=20stdin=20-=20add=20quotes=20to=20=C2=A0$Computerna?= =?UTF-8?q?me=20to=20support=20profiles=20with=20spaces=20in=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Connect-VPN.ps1 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Connect-VPN.ps1 b/Connect-VPN.ps1 index 84a155b..2369293 100644 --- a/Connect-VPN.ps1 +++ b/Connect-VPN.ps1 @@ -12,7 +12,9 @@ function Connect-AnyConnect() # {{{ [Alias("Username")] [string] $User, [Parameter(Position=3, ParameterSetName='Plain', Mandatory=$true)] - [string] $Password + [string] $Password, + [Parameter(Position=4, Mandatory=$false)] + [switch] $AcceptNotice ) if ($PSCmdlet.ParameterSetName -eq 'Credential') { @@ -72,7 +74,7 @@ function Connect-AnyConnect() # {{{ Start-Sleep 2 Write-Verbose "Sending connect" - $vpncli.StandardInput.WriteLine('connect ' + $ComputerName) + $vpncli.StandardInput.WriteLine('connect ' + """$ComputerName""") Write-Verbose "Sending user" $vpncli.StandardInput.WriteLine($User) @@ -80,6 +82,12 @@ function Connect-AnyConnect() # {{{ Write-Verbose "Sending password" $vpncli.StandardInput.WriteLine($Password) + If ( $AcceptNotice ) + { + Write-Verbose "Accepting notice" + $vpncli.StandardInput.WriteLine("y") + } + Write-Verbose "Reading its output stream" $found = $false for ($output = $vpncli.StandardOutput.ReadLine(); $output -ne $null; $output = $vpncli.StandardOutput.ReadLine()) @@ -139,6 +147,9 @@ function Connect-AnyConnect() # {{{ .PARAMETER Password If no PSCredential is provided, a User and a (plain text) Password must be provided. +.PARAMETER AcceptNotice + Accept notice from the server, like a banner message. + .INPUTS The ComputerName can be piped in. @@ -180,7 +191,9 @@ function Connect-VPN # {{{ [Alias("Username")] [string] $User, [Parameter(Position=4, ParameterSetName='Plain', Mandatory=$true)] - [string] $Password + [string] $Password, + [Parameter(Position=5, Mandatory=$false)] + [switch] $AcceptNotice ) DynamicParam { From 40b0ee2d9ec08178befe0dce7b1aefc1757f7575 Mon Sep 17 00:00:00 2001 From: Gildas Date: Fri, 7 Aug 2020 16:54:09 +0900 Subject: [PATCH 2/3] Added doc about AcceptNotice --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0bba1b7..d2d3c39 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,13 @@ The following options are accepted: When this parameter is not present, the module will be installed in WindowsPowerShell\Modules\Posh-VPN under the user's documents. In general, you will not need this parameter as the default folder gets automatically added in the list of folders where Powershell searches for modules and loads them. Default: None +- -Credential + Contains a `PSCredential` to log in the VPN. +- -User, -Password + Contain the user and the password to log in the VPN. + This is less secure than `-Credential` as you need to use plain text. +- -AcceptNotice + Accept notice (*banner*) from the VPN server. - -Verbose Acts verbosely - -WhatIf @@ -80,3 +87,8 @@ vpn.acme.com AUTHORS ======= [![endorse](https://api.coderwall.com/gildas/endorsecount.png)](https://coderwall.com/gildas) + +CONTRIBUTORS +============ +- [Charl Meyers](https://github.com/charlmeyers-bee123) +- [Morgan Simonsen](https://github.com/morgansimonsen) From fc34efaadcfe83a7fbb0ed62ef09828f217364b4 Mon Sep 17 00:00:00 2001 From: Gildas Date: Fri, 7 Aug 2020 16:57:05 +0900 Subject: [PATCH 3/3] Bumped to version 0.1.5 --- Install.ps1 | 2 +- Posh-VPN.psd1 | 2 +- README.md | 2 +- VERSION | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 144069b..aba42de 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -5,7 +5,7 @@ Param( ) $ModuleName = 'Posh-VPN' -$ModuleVersion = '0.1.4' +$ModuleVersion = '0.1.5' $GithubRoot = "https://raw.githubusercontent.com/gildas/posh-vpn/$ModuleVersion" if ([string]::IsNullOrEmpty($Path)) diff --git a/Posh-VPN.psd1 b/Posh-VPN.psd1 index 7737998..da4f163 100644 --- a/Posh-VPN.psd1 +++ b/Posh-VPN.psd1 @@ -12,7 +12,7 @@ RootModule = 'Posh-VPN.psm1' # Version number of this module. -ModuleVersion = '0.1.4' +ModuleVersion = '0.1.5' # ID used to uniquely identify this module GUID = 'c762b59e-61f1-4411-9c5b-3709a00199c1' diff --git a/README.md b/README.md index d2d3c39..4786125 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Install-Module Posh-VPN Copy the following line and paste it in a Powershell: ```posh -Start-BitsTransfer http://tinyurl.com/posh-vpn-0-1-4 $env:TEMP ; & $env:TEMP\Install.ps1 +Start-BitsTransfer http://tinyurl.com/posh-vpn-0-1-5 $env:TEMP ; & $env:TEMP\Install.ps1 ``` To install the latest development version, use one of the followings: diff --git a/VERSION b/VERSION index 845639e..9faa1b7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.4 +0.1.5