Continuing the discussion from Get user's username / password from keychain?:
As part of my solution, I’d get a user of my Applet to create a password item entry in their Keychain that hold the user name & password of an Admin account that my Applet can access so it can do it’s little trick…
I’ve worked out how to get a Password from Keychain Access (Thanks to Tobias), but I can’t for the life of me, work out how to get the “Account” (or user name) from the Keychain item. Tobias suggested I could use: short user name of (system info)
My concern is that some users might use two user accounts, usually using a non admin account for safety, and have a separate Admin account.
Querying “short user name of (system info)” just returns the short user name of the active user’s account but I’d love to get the “Account” name entered into the Keychain access along with the admin password:
doing " do shell script “security find-generic-password -s MyKeychainItemname” returns: (I’ve sanitised the username)
keychain: “/Users/a_user/Library/Keychains/login.keychain-db”
version: 512
class: “genp”
attributes:
0x00000007 <blob>=“com.furbies.google-drive-launcher”
0x00000008 <blob>=<NULL>
“acct”<blob>=“admin_user_acct”
“cdat”<timedate>=0x32303234303930383134303732325A00 “20240908140722Z\000”
“crtr”<uint32>=<NULL>
“cusi”<sint32>=<NULL>
“desc”<blob>=<NULL>
“gena”<blob>=<NULL>
“icmt”<blob>=<NULL>
“invi”<sint32>=<NULL>
“mdat”<timedate>=0x32303234303930383134303732325A00 “20240908140722Z\000”
“nega”<sint32>=<NULL>
“prot”<blob>=<NULL>
“scrp”<sint32>=<NULL>
“svce”<blob>=“com.furbies.google-drive-launcher”
“type”<uint32>=<NULL>
My question is, can anyone help me get the “admin_user_acct” from the result ?
I think I need to find the line that starts with “acct” and then copy out the admin_user_acct from: “acct”<blob>=“admin_user_acct”, but Regex just has me sitting in the corner, raving & drooling ?
Can anyone help ?
tia
furbies
(apologies for the multiple edits. had trouble escaping out some charaters so they show correctly)