I want to find the Safari Extensions List password from the keychain. I am doing it through NSTask now, As soon as we launch the task, it is printing some password. But When I store the password in some NSString using, NSString * password = [[NSString alloc] initWithData:dataRead encoding:NSASCIIStringEncoding]; it is returning some other value. Is there any other way to read the output of NSTask/NSPipe?
Asked
Active
Viewed 1,053 times
2 Answers
0
If you already have NSData* dataRead
from "Safari Extensions List", just save it to a file:
[dataRead writeToFile:@"/tmp/extensions_list.plist" atomically:YES];

Kimo
- 185
- 1
- 1
- 11
0
Got the answer
There are two ways to find the safari password from the keychain. 1. Using API
status = SecKeychainFindGenericPassword(
NULL, // default keychain
service_length, // length of service name
cService_name, // service name
username_length,// length of account name
cUser_name, // account name
&passwordLength, // length of password
&passwordData, // pointer to password data
NULL // the item reference
);
Here Service name is Extended Preferneces and username is Safari.
- Using NSTask or Terminal : [task setArguments:[NSArray arrayWithObjects:@"find-generic-password",@"-g",@"-l", @"Safari Extensions List", nil]];
Terminal Command is security find-generic-password -l "Safari Extensions List" -g
Copy the Hexadecimal password from the ouput of the above command, delete 0x prefix from the password, convert it to NSData and then use NSPropertyListSerialization propertyListWithData method, we can see the Safari Extensions List along with its enabled state.

user3328076
- 31
- 5