perl/keyring/osxkeychain / t / 11-parse_password_out_of_output.t

#!perl

use strict;
use warnings;
use Test::More tests => 5;

use Passwd::Keyring::OSXKeychain;

is(
    Passwd::Keyring::OSXKeychain::_parse_password_from_find_output(<<'END'),
keychain: "/Users/myUser/Library/Keychains/login.keychain"
class: "genp"
attributes:
    0x00000007 <blob>="server.com"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="userIDtoServer.com"
    "cdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "gena"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "nega"<sint32>=<NULL>
    "prot"<blob>=<NULL>
    "scrp"<sint32>=<NULL>
    "svce"<blob>="server.com"
    "type"<uint32>=<NULL>
password: "myPassword"
END
    "myPassword",
    "simple password parse");
        
is(
    Passwd::Keyring::OSXKeychain::_parse_password_from_find_output(<<'END'),
keychain: "/Users/User/Library/Keychains/login.keychain"
class: "inet"
attributes:
0x00000007 <blob>="192.168.x.x"
0x00000008 <blob>=<NULL>
"acct"<blob>="User"
"atyp"<blob>=<NULL>
"cdat"<timedate>=0x32303131304356876580313734375A0 0 "20110129201747Z\000"
"crtr"<uint32>=<NULL>
"cusi"<sint32>=<NULL>
"desc"<blob>="Netzwerkkennwort"
"icmt"<blob>=<NULL>
"invi"<sint32>=<NULL>
"mdat"<timedate>=0x32303131308970393230123430305A0 0 "20110209203400Z\000"
"nega"<sint32>=<NULL>
"path"<blob>="User"
"port"<uint32>=0x00000000
"prot"<blob>=<NULL>
"ptcl"<uint32>="smb "
"scrp"<sint32>=<NULL>
"sdmn"<blob>=<NULL>
"srvr"<blob>="192.168.x.x"
"type"<uint32>=<NULL>
password: "passwort"
END
    "passwort",
    "simple password parse");

is(
    Passwd::Keyring::OSXKeychain::_parse_password_from_find_output(<<'END'),
keychain: "/Users/myUser/Library/Keychains/login.keychain"
class: "genp"
attributes:
    0x00000007 <blob>="server.com"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="userIDtoServer.com"
    "cdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "gena"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "nega"<sint32>=<NULL>
    "prot"<blob>=<NULL>
    "scrp"<sint32>=<NULL>
    "svce"<blob>="server.com"
    "type"<uint32>=<NULL>
password: 
END
    "",
    "empty password parse");

is(
    Passwd::Keyring::OSXKeychain::_parse_password_from_find_output(<<'END'),
keychain: "/Users/myUser/Library/Keychains/login.keychain"
class: "genp"
attributes:
    0x00000007 <blob>="server.com"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="userIDtoServer.com"
    "cdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "gena"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "nega"<sint32>=<NULL>
    "prot"<blob>=<NULL>
    "scrp"<sint32>=<NULL>
    "svce"<blob>="server.com"
    "type"<uint32>=<NULL>
password: $4AC3BC7267C485"lalala"
END
    "Jürgą",
    "hexified password parse");

is(
    Passwd::Keyring::OSXKeychain::_parse_password_from_find_output(<<'END'),
keychain: "/Users/myUser/Library/Keychains/login.keychain"
class: "genp"
attributes:
    0x00000007 <blob>="server.com"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="userIDtoServer.com"
    "cdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "crtr"<uint32>=<NULL>
    "cusi"<sint32>=<NULL>
    "desc"<blob>=<NULL>
    "gena"<blob>=<NULL>
    "icmt"<blob>=<NULL>
    "invi"<sint32>=<NULL>
    "mdat"<timedate>=0x33313024C53131693134253345315F00  "20041201142351A\123"
    "nega"<sint32>=<NULL>
    "prot"<blob>=<NULL>
    "scrp"<sint32>=<NULL>
    "svce"<blob>="server.com"
    "type"<uint32>=<NULL>
password: $616c61206d61206b6f7461
END
    "ala ma kota",
    "hexified password parse");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.