2024-06-03
This commit is contained in:
		
							
								
								
									
										89
									
								
								_-Review/kpscript.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								_-Review/kpscript.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,89 @@ | ||||
| --- | ||||
| type: "topic" | ||||
| created: "2024-01-14T02:18:08.257Z" | ||||
| updated: "2024-01-19T03:11:28.638Z" | ||||
| --- | ||||
|  | ||||
| # KPScript | ||||
|  | ||||
| ## Generate PASSWORD_ENC | ||||
|  | ||||
| ```yaml KeePass GUI | ||||
| # https://keepass.info/download.html | ||||
| # https://keepass.info/help/base/placeholders.html#passwordenc | ||||
| # https://keepass.info/help/v2_dev/scr_sc_index.html#listgroups | ||||
| # https://videoportal.infineon.com/videos/play/f3d1a032-8372-487d-9b16-a6a68eb17044/d535b720-360e-4ef2-a77f-958c3b878644 | ||||
| # -> 14:25 / 52:58 | ||||
| General --- Title: $machineName | ||||
| General --- User name: $userName | ||||
| General --- Password: PASSWORD_ENC | ||||
| Auto-Type --- Override default sequence: {PASSWORD_ENC} | ||||
| ``` | ||||
|  | ||||
| - [ ] Open notepad on side of KeePass GUI | ||||
| - [ ] Preform Auto-Type Ctrl + v | ||||
| - [ ] Change General --- Password to line in notepad | ||||
|  | ||||
| ## Examples | ||||
|  | ||||
| ```bash | ||||
| KPScript -c:ListGroups "C:\KeePass\MyDb.kdbx" -pw:MyPassword | ||||
| KPScript -c:ListEntries "C:\KeePass\MyDb.kdbx" -pw:MyPassword -keyfile:"C:\KeePass\MyDb.key" | ||||
| ``` | ||||
|  | ||||
| ## Use PASSWORD_ENC in DevOps | ||||
|  | ||||
| ```PowerShell | ||||
| $data = @('$(Agent.TempDirectory)/Infineon-Na.kdbx', '-c:GetEntryString', '-Field:Password', '-refx-UUID:D3BB0F499E1E7844B86DFCEBD0670B81', '-pw-enc:AQAA') | ||||
| $data.count | ||||
| $processStartInfo = New-Object System.Diagnostics.ProcessStartInfo | ||||
| $processStartInfo.FileName = "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" | ||||
| $processStartInfo.RedirectStandardError = $true | ||||
| $processStartInfo.RedirectStandardOutput = $true | ||||
| $processStartInfo.UseShellExecute = $false | ||||
| $processStartInfo.Arguments = $data | ||||
| $process = New-Object System.Diagnostics.Process | ||||
| $process.StartInfo = $processStartInfo | ||||
| $process.Start() | Out-Null | ||||
| $process.WaitForExit() | ||||
| $stdout = $process.StandardOutput.ReadToEnd() | ||||
| $stderr = $process.StandardError.ReadToEnd() | ||||
| Write-Host "stderr: $stderr" | ||||
| Write-Host "exit code: " + $process.ExitCode | ||||
| Write-Host "##vso[task.setvariable variable=pipelinePassword;]$stdout" | ||||
| ``` | ||||
|  | ||||
| ## More Examples | ||||
|  | ||||
| ```bash | ||||
| # https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops | ||||
| KPScript -c:GenPw -profile:"Infineon" -count:5 | ||||
| KPScript -c:ListGroups "D:\Tmp\Phares\Infineon-Mesa.kdbx" -pw:asdf | ||||
| KPScript -c:ListGroups "D:\Tmp\Phares\Infineon-Mesa.kdbx" -useraccount | ||||
| KPScript -c:ListGroups "D:\Tmp\Phares\Infineon-Mesa.kdbx" -pw-enc:"AQAAANCMnd8BFdERjHoAb" | ||||
| ``` | ||||
|  | ||||
| ```bash | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:ListGroups "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -pw-enc:"AQAA" | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:GetEntryString -Field:UserName -refx-UUID:A0563988F3794E4DA2336BE27BF2D966 "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -pw-enc:"AQAA" | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -c:GetEntryString -Field:Password -refx-UUID:A0563988F3794E4DA2336BE27BF2D966 -pw-enc:"AQAA" | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -c:GetEntryString -auto-type:PASSWORD_ENC -refx-UUID:A0563988F3794E4DA2336BE27BF2D966 -pw-enc:"AQAA" | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -c:GetEntryString -Field:Password -refx-UUID:A0563988F3794E4DA2336BE27BF2D966 -pw-enc:"AQAA" | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:ListEntries "L:\DevOps\Mesa_FI\KeePass\Infineon-Na.kdbx" -pw-enc:"AQAA" | ||||
| ``` | ||||
|  | ||||
| ```bash Mon Jan 08 2024 14:46:20 GMT-0700 (Mountain Standard Time) | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:EstimateQuality -text:MyTopSecretPassword | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "D:\Documents\Personal\KeePass\Mike-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Mike-Phares.kdbx.xml" -pw-enc:"AQAA" | ||||
| ``` | ||||
|  | ||||
| ```bash Thu Jan 18 2024 19:27:19 GMT-0700 (Mountain Standard Time) | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Chelsea-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Chelsea-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Infineon-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Infineon-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Julie-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Julie-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Kristy-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Kristy-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Logan-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Logan-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Mike-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Mike-Phares.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Norman-Herman.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Norman-Herman.kdbx.xml" -pw:asdf | ||||
| "C:\Users\phares\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe" -c:Export "d:/5-Other-Small/KeePass/Shared-Phares.kdbx" -Format:"KeePass XML (2.x)" -OutFile:"D:\Tmp\Phares\KeePass\Shared-Phares.kdbx.xml" -pw:asdf | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user