Post

Replies

Boosts

Views

Activity

How to bypass Keychain Access "username and password" modal window to access the password?
I am trying to get the connected wifi password from keychain access in one of the macOS application and am able to get the password using the following code:There are two ways to get the wifi password:1. Via Security Framework Api SecItemCopyMatching(_:_:)let query = [ kSecClass as String: kSecClassGenericPassword as String, kSecAttrAccount as String: accountName, kSecReturnData as String: kCFBooleanTrue as Any, kSecMatchLimit as String: kSecMatchLimitOne ] as [String : Any] var dataTypeRef: AnyObject? let status: OSStatus = SecItemCopyMatching(query as CFDictionary, &dataTypeRef) var data: Data? if status == noErr{ data = dataTypeRef as? Data print(data!) print(String(decoding: data!, as: UTF8.self)) } return data != nil ? NSString(data: data!, encoding: String.Encoding.utf8.rawValue)! as String : ""2. Via CoreWLAN Framework Api CWKeychainFindWiFiPassword(_:_:_:), By passing the SSID data, we can get the wifi password.func getPassword(data:Data) -> String { var responseData:NSString? = nil var thePassword:String = "" var status:OSStatus? if data.count > 0 { status = CWKeychainFindWiFiPassword(CWKeychainDomain.system, data, &responseData) if status == noErr { thePassword = responseData! as String } } return thePassword }Query:Everytime while executing the either way keychain access is poping the modal window to provide admin credentials to acess the password.Let me know if there is any way to bypass the above modal window by supplying the username and passoword in the code (background).
3
0
1.2k
Apr ’20
is it possible to enable the log level using OSLog?
Requirement:Whenever i run the cocoa app exe, I should be able to enable the log level (info, debug, error, fault) using mac terminal.if i enable log level as debug, only debug logs should appear in terminal at runtime.i used the below command to enable the log level as "debug" in subsytem plist file."sudo log config --mode "level:debug" --subsystem com.companyName.ProjectName"but its not enabling the log level, please let me know the steps to achieve this.
1
0
1.1k
Mar ’20
get Firewall status from system preferences via Cocoa app
I am using the below code snippet to get the system preferences firewall status wheter it is ON/OFF using system .plist file.func getFirewallStatus() -> Bool { let paths = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .systemDomainMask, true) var path = paths[0] path = "\(path)/\("Preferences/com.apple.alf.plist")" path = path.replacingOccurrences(of: "/System", with: "") let _dictionary = NSDictionary(contentsOfFile: path) // firewall status let status = (_dictionary["globalstate"] as? NSNumber)?.intValue ?? 0 if status == 0 { return false } return true }Sandbox disable(Xcode): In this case, I am able to get the firewall status (On/Off).Sandbox enable(Xcode): app is crashing when accessing the contents of file.let _dictionary = NSDictionary(contentsOfFile: path)Please let me know the reasons, why app is crashing in case of sandbox enable mode?My intention is to get the status of firewall and not to update any system preferences config.Thanks in advance!
2
0
1k
Mar ’20
is there any way to find the "guest wifi network" connected?
I have created the macOS application and I am using "CoreWLAN" framework to list all available wifi networks using the classes "CWInterface" and "CWNetwork" and able to get the current connected interface details like, SSID, BSSID, RSSI etc.UseCase: I have created a new guest network in the router and connected in MAC (ex: "Test_Guest") , now I have to find whether the connected network is Guest network or not?Is there any other frameworks can find this behaviour in the wifi network and that should be acceptable by the AppStore.Thanks in advance.
7
0
1.3k
Feb ’20