Skip to content

Commit

Permalink
Merge pull request #146 from PSKeePass/jkdev
Browse files Browse the repository at this point in the history
v2.1.1.8
  • Loading branch information
jkdba authored Jun 25, 2018
2 parents 8427ead + 3e24c7a commit 4c38072
Show file tree
Hide file tree
Showing 42 changed files with 816 additions and 1,036 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Test/recycle.log
KeePassConfiguration.xml
Test/Includes/MasterKeyWindowsAuth.kdbx
Test/Includes/NoRecycle.kdbx
KeePassConfiguration.xml.old
KeePassConfiguration.xml.old
bin/EncodeKeePassLib\.ps1
Binary file modified PoShKeePass.psd1
Binary file not shown.
52 changes: 49 additions & 3 deletions PoShKeePass.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,64 @@ Get-ChildItem -Path $PSScriptRoot -Recurse -File -Filter '*.ps1' | ForEach-Objec
}
}

## Source KpLib
Import-KPLibrary

[String] $Global:KeePassConfigurationFile = '{0}\KeePassConfiguration.xml' -f $PSScriptRoot
[String] $Global:KeePassLibraryPath = '{0}\bin\KeePassLib_2.39.1.dll' -f $PSScriptRoot

## Check fo config and init
## Source KpLib
Import-KPLibrary

## Check for config and init
if (-not(Test-Path -Path $Global:KeePassConfigurationFile))
{
Write-Warning -Message '**IMPORTANT NOTE:** Please always keep an up-to-date backup of your keepass database files and key files if used.'

$CurrentVersion = ((Get-ChildItem "$PSScriptRoot\..").Name | Sort-Object -Descending | Select-Object -First 2)[0]

if($CurrentVersion -eq '2.1.1.8')
{
Write-Warning -Message ('**BREAKING CHANGES:** This new version of the module {0} contains BREAKING CHANGES, please review the changelog or readme for details!' -f $CurrentVersion)
}

Write-Warning -Message 'This message will not show again on next import.'

if(-not $(Restore-KPConfigurationFile))
{
New-KPConfigurationFile
}
}
else
{
New-Variable -Name 'KeePassProfileNames' -Value @((Get-KeePassDatabaseConfiguration).Name) -Scope 'Script' #-Option Constant
}

Export-ModuleMember *

if(Get-Command Register-ArgumentCompleter -ea 0)
{
Register-ArgumentCompleter -ParameterName 'DatabaseProfileName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

Get-KeePassDatabaseConfiguration | Where-Object { $_.Name -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_.Name, $_.Name, 'ParameterValue', $_.Name)
}
}

Register-ArgumentCompleter -ParameterName 'IconName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

[KeePassLib.PwIcon].GetEnumValues() | Where-Object { $_ -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_, $_, 'ParameterValue', $_)
}
}

Register-ArgumentCompleter -ParameterName 'PasswordProfileName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

(Get-KPPasswordProfile).Name | Where-Object { $_ -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_, $_, 'ParameterValue', $_)
}
}
}

## add one for paths - can't do this until connection management is implemented.
Binary file not shown.
File renamed without changes.
Binary file added Test/Includes/PSKeePassTestDatabase2.39.1.kdbx
Binary file not shown.
313 changes: 158 additions & 155 deletions Test/PSKeePassUsage.Tests.ps1

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/AutoVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param()

## Get psd1 file
$RawPSD = Get-Content -Path "$($PSScriptRoot)\..\PoShKeePass.psd1"
$ModuleVersion = ($RawPSD | ? { $_ -match "^\s+ModuleVersion.+$" }) -replace '.+(\d\.\d\.\d\.\d).$', '$1'
$ModuleVersion = ($RawPSD | Where-Object { $_ -match "^\s+ModuleVersion.+$" }) -replace '.+(\d\.\d\.\d\.\d).$', '$1'

Write-Verbose -Message ('ModuleVersion Found: ' + $ModuleVersion)
[Int[]] $VerArr = $ModuleVersion -split '\.'
Expand Down
51 changes: 0 additions & 51 deletions bin/EncodeKeePassLib.ps1

This file was deleted.

File renamed without changes.
Binary file added bin/KeePassLib_2.39.1.dll
Binary file not shown.
51 changes: 47 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(-not $BuildPath)
{
Write-Verbose -Message 'Setting up Build Path'
$RawPSD = Get-Content -Path "$($PSScriptRoot)\PoShKeePass.psd1"
$ModuleVersion = ($RawPSD | ? { $_ -match "^\s+ModuleVersion.+$" }) -replace '.+(\d\.\d\.\d\.\d).$', '$1'
$ModuleVersion = ($RawPSD | Where-Object { $_ -match "^\s+ModuleVersion.+$" }) -replace '.+(\d\.\d\.\d\.\d).$', '$1'
$BuildPath = ('{0}\build\{1}\PoShKeePass' -f $PSScriptRoot, $ModuleVersion)

if(Test-Path $BuildPath)
Expand All @@ -29,7 +29,7 @@ New-Item -Path $BuildPath -Name 'bin' -ItemType Directory -Force
[string] $LicenseFile = '{0}\license' -f $PSScriptRoot
[string] $FormatFile = '{0}\PoShKeePass.format.ps1xml' -f $PSScriptRoot
[string] $ReadMeFile = '{0}\readme.md' -f $PSScriptRoot
[string] $Bin = '{0}\bin\KeePassLib.dll' -f $PSScriptRoot
[string] $Bin = '{0}\bin\KeePassLib*.dll' -f $PSScriptRoot

[string[]] $RootFilesToCopy = @($ManifestFile, $ChangeLogFile, $LicenseFile, $FormatFile, $ReadMeFile)

Expand All @@ -45,21 +45,64 @@ Get-ChildItem -Path $PSScriptRoot -Recurse -File -Filter '*.ps1' | ForEach-Objec
Write-Verbose -Message 'Adding tail to module file.'
@'
[String] $Global:KeePassConfigurationFile = '{0}\KeePassConfiguration.xml' -f $PSScriptRoot
[String] $Global:KeePassLibraryPath = '{0}\bin\KeePassLib_2.39.1.dll' -f $PSScriptRoot
## Source KpLib
Import-KPLibrary
[String] $Global:KeePassConfigurationFile = '{0}\KeePassConfiguration.xml' -f $PSScriptRoot
## Check fo config and init
if (-not(Test-Path -Path $Global:KeePassConfigurationFile))
{
Write-Warning -Message '**IMPORTANT NOTE:** Please always keep an up-to-date backup of your keepass database files and key files if used.'
$CurrentVersion = ((Get-ChildItem "$PSScriptRoot\..").Name | Sort-Object -Descending | Select-Object -First 2)[0]
if($CurrentVersion -eq '2.1.1.8')
{
Write-Warning -Message ('**BREAKING CHANGES:** This new version of the module {0} contains BREAKING CHANGES, please review the changelog or readme for details!' -f $CurrentVersion)
}
Write-Warning -Message 'This message will not show again on next import.'
if(-not $(Restore-KPConfigurationFile))
{
New-KPConfigurationFile
}
}
else
{
New-Variable -Name 'KeePassProfileNames' -Value @((Get-KeePassDatabaseConfiguration).Name) -Scope 'Script' #-Option Constant
}
Export-ModuleMember *
if(Get-Command Register-ArgumentCompleter -ea 0)
{
Register-ArgumentCompleter -ParameterName 'DatabaseProfileName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
Get-KeePassDatabaseConfiguration | Where-Object { $_.Name -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_.Name, $_.Name, 'ParameterValue', $_.Name)
}
}
Register-ArgumentCompleter -ParameterName 'IconName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
[KeePassLib.PwIcon].GetEnumValues() | Where-Object { $_ -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_, $_, 'ParameterValue', $_)
}
}
Register-ArgumentCompleter -ParameterName 'PasswordProfileName' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
(Get-KPPasswordProfile).Name | Where-Object { $_ -ilike "${wordToComplete}*" } | ForEach-Object {
New-Object System.Management.Automation.CompletionResult ( $_, $_, 'ParameterValue', $_)
}
}
}
'@ | Add-Content -Path $ModuleFile -Force

Expand Down
41 changes: 41 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Changelog

## v2.1.1.8

### Many fixes, features and improvements, please note the **Breaking Changes** Below

* Fix [#129](https://github.com/PSKeePass/PoShKeePass/issues/129) - Can now pass Credential Object to `-MasterKey` Parameter
* Fix/Implemented [#69](https://github.com/PSKeePass/PoShKeePass/issues/69) - All primary Functions return a Powershell object rather than a KeePass Object **This Includes Breaking changes!**.
* **Breaking:**
* Since a powershell object is now returned, in order to access the keepass object a child property has been added to the ps object, `.KPEntry` and `.KPGroup`.
* Deprecated the `-AsPlainText` parameter on the `Get-KeePassGroup` function, the call will still work but it will present a warning message. This is being removed as it is no longer necessary.
* **Non-Breaking:**
* Moved how database profile name was being added to the ps object for better performance on conversion.
* Implemented [#93](https://github.com/PSKeePass/PoShKeePass/issues/93) - `Get-KeePassEntry` Now supports `-Title` and `-UserName` parameters also via pipeline.
* Normalized Error handling to remove repetitive code
* Converted extraneous logic to parameter splatting
* Code formatting and removed explict parameter attributes where not necessary.
* Updated Object creation to use the `hashtable` method for performance over the `New-Object` + `Add-Memeber`.
* Fix [#44](https://github.com/PSKeePass/PoShKeePass/issues/44) - Pipeline now Works for `Remove-KeePassDatabaseConfiguration`.
* Implemented [#141](https://github.com/PSKeePass/PoShKeePass/issues/141) - Much stronger Pipeline support.
* `-DatabaseProfileName` no longer needs to be specified to a KPPSObject pipeline recieving function.
* Example: `Get-KeePassEntry -Title 'test' -DatabaseProfileName 'profile' | Remove-KeePassEntry`
* All parent and object paths now are recieved by the pipeline which of course can be overridden by specifing the parameter.
* Fixed [#140](https://github.com/PSKeePass/PoShKeePass/issues/140) and [#138](https://github.com/PSKeePass/PoShKeePass/issues/138) - by removing the `EncodeKeePassLib.ps1` script file as it is no longer in use.
* Fixed [#144](https://github.com/PSKeePass/PoShKeePass/issues/144) - Removed Faultly logic which allowed for the KeePass Icon to get set to blank while updating an object.
* Implemented [#143](https://github.com/PSKeePass/PoShKeePass/issues/143) There are no more dynamic parameters! So all of the gitches have left with them. They still support tab completion by using `Register-ArgumentCompleter`.
* **Breaking Change** as this is only supported in powershell v5 and up, auto complete will not work in older versions.
* Implemented [#118](https://github.com/PSKeePass/PoShKeePass/issues/118) - by adding support for keepasslib version `2.39.1`
* The new file format version between the previous version of `2.34` and the latest apears to be much slower on some operations.
* Testing the new Lib version against the previously suported version `2.34` all worked and appears to be backwards compatible. Also it does not upgrade the file format version.
* Version can easily flipped back by modifying the global variable in the `.psm1` file.
* This fixes [#131](https://github.com/PSKeePass/PoShKeePass/issues/131).
* Fix [#145](https://github.com/PSKeePass/PoShKeePass/issues/145) - Updating a KeePass Entry now updates the modification time in UTC.
* **Breaking Change** - Renamed the `LastAccessTime` and `LastModificationTime` properties to `LastAccessTimeUtc` and `LastModificationTimeUtc` to reflect that they are in UTC.
* Addressed [#88](https://github.com/PSKeePass/PoShKeePass/issues/88) - `Get-KeePassEntry`
* Since a Ps object is now always returned, all fields but the password are in plaintext. Now specifying the `-AsPlainText` will decode the password to plaintext.
* This gives the user better control over when they expose the password as plaintext if need be.
* Another improvement is there is now a `-WithCredential` parameter which adds a `.Credential` property to the return Entry PS Object.
* This is not done by default as it has overhead.
* This gives the user better options and does not require manual creation of the credential.
* **Breaking Change** Since this has been implemeneted the `-AsPsCredential` parameter has been removed. The new method is better as it allows for multiple entries to be returned with thier cred objects instead of limiting it to 1 entry.
* **Breaking Change** - `ConvertTo-KPPSObject` and all returned objects the `.FullPath` property now returns the true full path of the object. The `ParentGroup` property still exists and can be used as an alteranative data source for any lost functionality.

## v2.0.5.6

* Update-KeePassEntry no longer creates a new entry, Entry history is retained, UUID is never changed, All time modificiation fields are now updated when appropriate.
Expand Down
Loading

0 comments on commit 4c38072

Please sign in to comment.