seadoggie01 Posted July 3, 2020 Share Posted July 3, 2020 This UDF automates KeePass databases through the use of KPScript, a plugin for KeePass that is developed by the original author. This is something I've wanted for a long time. I really like KeePass and I really like using AutoIt, but I feel uncomfortable typing clear text passwords into my scripts. I can only get away with using Send("^!a") to try to get KeePass to input my passwords for me for so long. To download the UDF, head over to GitHub for now (this is easier for me to manage). When I get a release version, I'll update this post with more info and a link to download from the forums. Be sure to read the Notes section, and let me know of any issues, features, or praise you might have! TheDcoder, argumentum and TheXman 3 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
BigDaddyO Posted July 6, 2020 Share Posted July 6, 2020 Been a while (2016) since I've used KeePass. my Co banned it and forced us to move to a web tool that InfoSec can control. This is what i used with a standalone Keepass database stored on a network share that was setup for Windows Authentication so I didn't need credentials to log into KeePass as long as I was logged into the computer doing the automation. Your version looks MUCH more detailed than the quick grab code I had. ;========================================================================================================================= ; Access data from Keepass where the login credentials are set for Windows Authentication ; sAppUserName = GetKpCredential(@UserName, "Portal", "UserName") ; sAppPassword = GetKpCredential(@UserName, "Portal", "Password") ;========================================================================================================================= Func _GetKpCredential($kpDatabase, $kpEntryName, $kpFieldName) $sKPLoc = "\\..\Path\" Local $iPID = Run('"' & $sKPLoc & 'KPScript.exe" -c:GetEntryString "' & $sKPLoc & $kpDatabase & '.kdbx" -useraccount -field:' & $kpFieldName & ' -ref-Title:"' & $kpEntryName & '"', "", @SW_HIDE, 2) ProcessWaitClose($iPID) ;Need to wait for it to finish before we get the StdOutput values $sOutput = StdoutRead($iPID) ;Retrieve whatever the KPScript.exe returned $sRetVal = StringLeft($sOutput, StringInStr($sOutput, @CRLF) - 1) ;Split out the returned value to get the value or see if it failed If StringLeft($sRetVal, 3) = "OK:" Then Return SetError(1) Else Return $sRetVal EndIf EndFunc ;_GetKpCredential Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 6, 2020 Author Share Posted July 6, 2020 My company doesn't "recommend" it, but the IT security guys recommended it when I brought it up. Yup, I'm working on getting all of the functionality of KPScript into it, then I'll probably create a wrapper function or two doing pretty much exactly that ^. I just need to write all of the base functions first or else I'll never get back to it All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
somdcomputerguy Posted December 7, 2023 Share Posted December 7, 2023 On 7/3/2020 at 7:02 PM, seadoggie01 said: I can only get away with using Send("^!a") to try to get KeePass to input my passwords for me for so long. I realize the quote is from a 3 year old post, and this post may not be needed or necessary, but.. I wrote an AutoIt script to assist me with my KeePass use, At first, I was using Send() to, send, the intended hot-keys, but I quickly was only using that function to send an ALT-TAB sequence to 'switch' back to my browser, and instead I used ShellExecute() to, run, the intended KeePass function. I am currently using the below code, because I added more functionality to the script, but it's basically the same code as I posted here. https://pastebin.com/BxVR6WFp - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now