I am writing a function that will give you the OSX firewall status :)
-(BOOL)getFirewallStatus{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
path = [NSString stringWithFormat:@"%@/%@",path,@"Preferences/com.apple.alf.plist"];
path = [path stringByReplacingOccurrencesOfString:@"/System"
withString:@""];
NSDictionary* _dictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
int status = [[_dictionary valueForKey:@"globalstate"] integerValue];
if (status == 0)
{
return NO;
}
return YES;
}
source
share