Oktane, plist tricks...
From Terminal...
In 10.4 and higher, most of the plist files used by the system are in binary format, not xml (text). The program 'plutil' can convert between the two formats.
CODE
sudo plutil -convert binary1 /Library/Preferences/com.apple.sharing.firewall.plist
hexdump -Cn 100 /Library/Preferences/com.apple.sharing.firewall.plist
QUOTE
00000000 62 70 6c 69 73 74 30 30 d4 01 02 03 04 05 07 08 |bplist00........|
00000010 58 5b 61 6c 6c 75 64 70 70 6f 72 74 73 55 73 74 |X[alludpportsUst|
00000020 61 74 65 58 66 69 72 65 77 61 6c 6c 58 61 6c 6c |ateXfirewallXall|
00000030 70 6f 72 74 73 a1 06 54 35 39 30 30 08 dd 09 0a |ports..T5900....|
00000040 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 21 26 2a 2e |............!&*.|
00000050 32 36 3a 3f 44 48 4e 53 5f 10 14 41 70 70 6c 65 |26:?DHNS_..Apple|
00000060 20 52 65 6d | Rem|
CODE
sudo plutil -convert xml1 /Library/Preferences/com.apple.sharing.firewall.plist
hexdump -Cn 100 /Library/Preferences/com.apple.sharing.firewall.plist
QUOTE
00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 |<?xml version="1|
00000010 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 |.0" encoding="UT|
00000020 46 2d 38 22 3f 3e 0a 3c 21 44 4f 43 54 59 50 45 |F-8"?>.<!DOCTYPE|
00000030 20 70 6c 69 73 74 20 50 55 42 4c 49 43 20 22 2d | plist PUBLIC "-|
00000040 2f 2f 41 70 70 6c 65 20 43 6f 6d 70 75 74 65 72 |//Apple Computer|
00000050 2f 2f 44 54 44 20 50 4c 49 53 54 20 31 2e 30 2f |//DTD PLIST 1.0/|
00000060 2f 45 4e 22 |/EN"|
The program 'defaults' can read and write binary or xml plist files.
CODE
sudo defaults read /Library/Preferences/com.apple.sharing.firewall
QUOTE
{
allports = ("5900-5902");
alludpports = (5900);
firewall = {
"Apple Remote Desktop" = {
editable = 0;
enable = 0;
port = (3283, 5900);
row = 5;
udpport = (3283, 5900);
};
"FTP Access" = {editable = 0; enable = 0; port = (21); row = 4; };
"Network Time" = {editable = 1; enable = 0; row = 11; udpport = (123); };
"Personal File Sharing" = {editable = 0; enable = 0; port = (548, 427); row = 0; };
"Personal Web Sharing" = {editable = 0; enable = 0; port = (80, 427, 443); row = 2; };
"Printer Sharing" = {editable = 0; enable = 0; port = (631, 515); row = 7; };
"Remote Apple Events" = {editable = 0; enable = 0; port = (3031); row = 6; };
"Remote Login - SSH" = {editable = 0; enable = 0; port = (22); row = 3; };
"Samba Sharing" = {editable = 0; enable = 0; port = (139); row = 1; udpport = (137, 138); };
VNC = {editable = 1; enable = 1; port = ("5900-5902"); row = 12; udpport = (5900); };
"iChat Rendezvous" = {editable = 1; enable = 0; port = (5297, 5298); row = 8; };
"iPhoto Rendezvous Sharing" = {editable = 1; enable = 0; port = (8770); row = 10; };
"iTunes Music Sharing" = {editable = 1; enable = 0; port = (3689); row = 9; };
};
state = 0;
}
And of course, once it's a text file (xml) it's easy to mess with it using standard command line utilities such as 'tr' and 'sed'.
CODE
cat /Library/Preferences/com.apple.sharing.firewall.plist | tr -s "\n\t" "Q " | sed -e 's/enable<\/key>Q <integer>0</enable<\/key>Q <integer>1</g' | tr "Q" "\n"
QUOTE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>allports</key>
<array>
<string>5900-5902</string>
</array>
<key>alludpports</key>
<array>
<string>5900</string>
</array>
<key>firewall</key>
<dict>
<key>Apple Remote Desktop</key>
<dict>
<key>editable</key>
<integer>0</integer>
<key>enable</key>
<integer>1</integer>
<key>port</key>
<array>
<string>3283</string>
<string>5900</string>
</array>
<key>row</key>
<integer>5</integer>
<key>udpport</key>
<array>
<string>3283</string>
<string>5900</string>
</array>
</dict>
<key>FTP Access</key>
<dict>
<key>editable</key>
<integer>0</integer>
<key>enable</key>
<integer>1</integer>
[...]
Firewall info for 10.5
http://www.google.com/search?q=%22com.apple.alf.plist%22