Repository navigation
Expand file tree
/
Copy pathNetwork
More file actions
166 lines (82 loc) · 8.23 KB
/
Copy pathNetwork
File metadata and controls
166 lines (82 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/Library/Preferences/SystemConfiguration/
launchctl kickstart -k system/com.apple.locate
sudo /usr/libexec/PlistBuddy -c "print"
pluginkit -e ignore -i com.apple.share.AirDrop.send
defaults write com.apple.NetworkBrowser DisableAirDrop -bool true
sudo /usr/libexec/PlistBuddy -c "Print" /Library/Preferences/SystemConfiguration/preferences.plist
sudo defaults read /Library/Preferences/SystemConfiguration/preferences.plist
/Library/Preferences/com.apple.wifi.known-networks.plist
------------------------------------------------------------------------------------------------------------------------------
# Set the main Computer Name
/usr/libexec/PlistBuddy -c "Set :System:System:ComputerName computer" preferences.plist
# Set the system HostName
/usr/libexec/PlistBuddy -c "Set :System:System:HostName computer" preferences.plist
# Set the local mDNS HostName
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:LocalHostName computer" preferences.plist
------------------------------------------------------------------------------------------------------------------------------
preferences.plist – all network services
NetworkInterfaces.plist – interface mapping
com.apple.airport.preferences.plist – Wi-Fi details
com.apple.network.eapolclient.plist – authentication configs
------------------------------------------------------------------------------------------------------------------------------
scutil --dns
scutil --proxy
------------------------------------------------------------------------------------------------------------------------------
plutil -p <file>
plutil -convert xml1 <file>
plutil -convert binary1 <file>
plist -p <file>
stat -x <file>
------------------------------------------------------------------------------------------------------------------------------
/usr/libexec/PlistBuddy -c "Set :NetworkServices:5B3A5772-21BA-410C-83C3-AE4860BA8F25:Proxies:FTPPassive 0" preferences.plist
/usr/libexec/PlistBuddy -c "Set :NetworkServices:B4A43A18-A98E-4BF9-BB24-A30968FBD7BC:Proxies:FTPPassive 0" preferences.plist
/usr/libexec/PlistBuddy -c "Set :NetworkServices:CDF5C487-B2DD-44F6-BB49-F3D547692486:Proxies:FTPPassive 0" preferences.plist
/usr/libexec/PlistBuddy -c "Set :NetworkServices:F03C5DC8-B32D-49DE-970C-670F413A5E19:Proxies:FTPPassive 0" preferences.plist
/usr/libexec/PlistBuddy -c "Set :NetworkServices:FC3BD2D9-CF31-4BF5-B91D-BC096916F8A1:Proxies:FTPPassive 0" preferences.plist
grep -A 1 "FTPPassive" preferences.plist
plutil -convert binary1 preferences.plist
killall configd
PLIST_FILE="preferences.plist"; for uuid in $(/usr/libexec/PlistBuddy -c "Print :NetworkServices" "$PLIST_FILE" 2>/dev/null | grep -E -o '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}'); do if /usr/libexec/PlistBuddy -c "Print :NetworkServices:$uuid:Proxies:FTPPassive" "$PLIST_FILE" &>/dev/null; then /usr/libexec/PlistBuddy -c "Set :NetworkServices:$uuid:Proxies:FTPPassive 0" "$PLIST_FILE" && echo "Updated $uuid -> FTPPassive: 0"; fi; done
------------------------------------------------------------------------------------------------------------------------------
log show --predicate 'subsystem == "com.apple.network"' --last 24h
sudo killall -INFO mDNSResponder
sudo fs_usage -w | grep -E "System Settings|plist"
/usr/bin/fs_usage
sudo /usr/libexec/PlistBuddy -c "Set :NetBIOSName computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo /usr/libexec/PlistBuddy -c "Print :NetBIOSName" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
------------------------------------------------------------------------------------------------------------------------------
/usr/libexec/PlistBuddy -c "Add :System:System dict" preferences.plist 2>/dev/null
/usr/libexec/PlistBuddy -c "Add :System:Network dict" preferences.plist 2>/dev/null
/usr/libexec/PlistBuddy -c "Add :System:Network:HostNames dict" preferences.plist 2>/dev/null
------------------------------------------------------------------------------------------------------------------------------
/usr/libexec/PlistBuddy -c "Set :System:System:ComputerName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:System:ComputerName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:System:HostName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:System:HostName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:System:LocalHostName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:System:LocalHostName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:System:ComputerNameEncoding 134217984" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:System:ComputerNameEncoding integer 134217984" preferences.plist
------------------------------------------------------------------------------------------------------------------------------
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:ComputerName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:Network:HostNames:ComputerName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:HostName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:Network:HostNames:HostName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:LocalHostName computer" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:Network:HostNames:LocalHostName string computer" preferences.plist
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:ComputerNameEncoding 134217984" preferences.plist 2>/dev/null || /usr/libexec/PlistBuddy -c "Add :System:Network:HostNames:ComputerNameEncoding integer 134217984" preferences.plist
------------------------------------------------------------------------------------------------------------------------------
# Ensure the 'Network' dictionary exists inside 'System'
/usr/libexec/PlistBuddy -c "Add :System:Network dict" preferences.plist 2>/dev/null
# Ensure the 'HostNames' dictionary exists inside 'System:Network'
/usr/libexec/PlistBuddy -c "Add :System:Network:HostNames dict" preferences.plist 2>/dev/null
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:LocalHostName computer" preferences.plist 2>/dev/null || \
/usr/libexec/PlistBuddy -c "Add :System:Network:HostNames:LocalHostName string computer" preferences.plist
------------------------------------------------------------------------------------------------------------------------------
sudo /usr/libexec/PlistBuddy -c "Set :NetBIOSName computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo /usr/libexec/PlistBuddy -c "Set :AllowGuestAccess false" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist 2>/dev/null || \
sudo /usr/libexec/PlistBuddy -c "Add :AllowGuestAccess bool false" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo /usr/libexec/PlistBuddy -c "Set :ServerDescription computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist 2>/dev/null || \
sudo /usr/libexec/PlistBuddy -c "Add :ServerDescription string computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo /usr/libexec/PlistBuddy -c "Set :NetBIOSName computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist 2>/dev/null || \
sudo /usr/libexec/PlistBuddy -c "Add :NetBIOSName string computer" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo /usr/libexec/PlistBuddy -c "Delete :LocalKerberosRealm" /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist 2>/dev/null || true
sudo chflags uchg /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo chflags nouchg /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo chown root:wheel /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
sudo chmod 644 /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
------------------------------------------------------------------------------------------------------------------------------
/usr/libexec/PlistBuddy -c "Print :NetworkServices" preferences.plist