forked from Halium/halium-boot
-
Notifications
You must be signed in to change notification settings - Fork 5
/
check-kernel-config
executable file
·371 lines (352 loc) · 7.31 KB
/
check-kernel-config
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/bin/bash
FILE=$1
[ -f "$FILE" ] || {
echo "Provide a config file as argument"
exit
}
write=false
if [ "$2" = "-w" ]; then
write=true
fi
CONFIGS_ON="
CONFIG_IKCONFIG
CONFIG_CPUSETS
CONFIG_AUTOFS4_FS
CONFIG_TMPFS_XATTR
CONFIG_TMPFS_POSIX_ACL
CONFIG_CGROUP_DEVICE
CONFIG_SYSVIPC
CONFIG_CGROUPS
CONFIG_NAMESPACES
CONFIG_UTS_NS
CONFIG_IPC_NS
CONFIG_USER_NS
CONFIG_PID_NS
CONFIG_NET_NS
CONFIG_DEVTMPFS
CONFIG_DEVTMPFS_MOUNT
CONFIG_FSNOTIFY
CONFIG_DNOTIFY
CONFIG_INOTIFY_USER
CONFIG_FANOTIFY
CONFIG_FANOTIFY_ACCESS_PERMISSIONS
CONFIG_BT
CONFIG_BT_RFCOMM
CONFIG_BT_RFCOMM_TTY
CONFIG_BT_BNEP
CONFIG_BT_BNEP_MC_FILTER
CONFIG_BT_BNEP_PROTO_FILTER
CONFIG_BT_HIDP
CONFIG_BT_HCIBTUSB_BCM
CONFIG_BT_HCIBTUSB_RTL
CONFIG_BT_HCIUART
CONFIG_BT_HCIBCM203X
CONFIG_BT_HCIBPA10X
CONFIG_BT_HCIBFUSB
CONFIG_CFG80211_WEXT
CONFIG_MAC80211
CONFIG_MAC80211_MESH
CONFIG_DNS_RESOLVER
CONFIG_FHANDLE
CONFIG_EPOLL
CONFIG_SIGNALFD
CONFIG_TIMERFD
CONFIG_TMPFS_POSIX_ACL
CONFIG_USB_RTL8150
CONFIG_USB_RTL8152
CONFIG_MEDIA_DIGITAL_TV_SUPPORT
CONFIG_MEDIA_SDR_SUPPORT
CONFIG_MEDIA_TUNER_MSI001
CONFIG_USB_AIRSPY
CONFIG_USB_HACKRF
CONFIG_USB_MSI2500
CONFIG_DVB_RTL2830
CONFIG_DVB_RTL2832
CONFIG_DVB_RTL2832_SDR
CONFIG_DVB_SI2168
CONFIG_DVB_ZD1301_DEMOD
CONFIG_USB_ACM
CONFIG_USB_CONFIGFS_SERIAL
CONFIG_USB_CONFIGFS_ACM
CONFIG_USB_CONFIGFS_OBEX
CONFIG_USB_CONFIGFS_NCM
CONFIG_USB_CONFIGFS_ECM
CONFIG_USB_CONFIGFS_ECM_SUBSET
CONFIG_USB_CONFIGFS_RNDIS
CONFIG_USB_CONFIGFS_EEM
CONFIG_USB_CONFIGFS_MASS_STORAGE
CONFIG_USB_LAN78XX
CONFIG_WLAN_VENDOR_ATH
CONFIG_ATH9K_HTC
CONFIG_CARL9170
CONFIG_ATH6KL
CONFIG_ATH6KL_USB
CONFIG_WLAN_VENDOR_MEDIATEK
CONFIG_MT7601U
CONFIG_WLAN_VENDOR_RALINK
CONFIG_RT2X00
CONFIG_RT2500USB
CONFIG_RT73USB
CONFIG_RT2800USB
CONFIG_RT2800USB_RT33XX
CONFIG_RT2800USB_RT35XX
CONFIG_RT2800USB_RT3573
CONFIG_RT2800USB_RT53XX
CONFIG_RT2800USB_RT55XX
CONFIG_RT2800USB_UNKNOWN
CONFIG_WLAN_VENDOR_REALTEK
CONFIG_RTL8187
CONFIG_RTL_CARDS
CONFIG_RTL8192CU
CONFIG_RTL8XXXU_UNTESTED
CONFIG_WLAN_VENDOR_ZYDAS
CONFIG_USB_ZD1201
CONFIG_ZD1211RW
CONFIG_USB_NET_RNDIS_WLAN
CONFIG_BT_HCIVHCI
CONFIG_MACVLAN
CONFIG_CHECKPOINT_RESTORE
CONFIG_UNIX_DIAG
CONFIG_PACKET_DIAG
CONFIG_NETLINK_DIAG
CONFIG_MEDIA_TUNER
"
CONFIGS_OFF="
CONFIG_MEDIA_SUBDRV_AUTOSELECT
CONFIG_MEDIA_TUNER_SIMPLE
CONFIG_MEDIA_TUNER_TDA18250
CONFIG_MEDIA_TUNER_TDA8290
CONFIG_MEDIA_TUNER_TDA827X
CONFIG_MEDIA_TUNER_TDA18271
CONFIG_MEDIA_TUNER_TDA9887
CONFIG_MEDIA_TUNER_TEA5761
CONFIG_MEDIA_TUNER_TEA5767
CONFIG_MEDIA_TUNER_MT20XX
CONFIG_MEDIA_TUNER_MT2060
CONFIG_MEDIA_TUNER_MT2063
CONFIG_MEDIA_TUNER_MT2266
CONFIG_MEDIA_TUNER_MT2131
CONFIG_MEDIA_TUNER_QT1010
CONFIG_MEDIA_TUNER_XC2028
CONFIG_MEDIA_TUNER_XC5000
CONFIG_MEDIA_TUNER_XC4000
CONFIG_MEDIA_TUNER_MXL5005S
CONFIG_MEDIA_TUNER_MXL5007T
CONFIG_MEDIA_TUNER_MC44S803
CONFIG_MEDIA_TUNER_MAX2165
CONFIG_MEDIA_TUNER_TDA18218
CONFIG_MEDIA_TUNER_FC0011
CONFIG_MEDIA_TUNER_FC0012
CONFIG_MEDIA_TUNER_FC0013
CONFIG_MEDIA_TUNER_TDA18212
CONFIG_MEDIA_TUNER_E4000
CONFIG_MEDIA_TUNER_FC2580
CONFIG_MEDIA_TUNER_M88RS6000T
CONFIG_MEDIA_TUNER_TUA9001
CONFIG_MEDIA_TUNER_SI2157
CONFIG_MEDIA_TUNER_IT913X
CONFIG_MEDIA_TUNER_R820T
CONFIG_MEDIA_TUNER_MXL301RF
CONFIG_MEDIA_TUNER_QM1D1C0042
CONFIG_MEDIA_TUNER_QM1D1B0004
CONFIG_DVB_STB0899
CONFIG_DVB_STB6100
CONFIG_DVB_STV090x
CONFIG_DVB_STV0910
CONFIG_DVB_STV6110x
CONFIG_DVB_STV6111
CONFIG_DVB_MXL5XX
CONFIG_DVB_DRXK
CONFIG_DVB_TDA18271C2DD
CONFIG_DVB_SI2165
CONFIG_DVB_MN88472
CONFIG_DVB_MN88473
CONFIG_DVB_CX24110
CONFIG_DVB_CX24123
CONFIG_DVB_MT312
CONFIG_DVB_ZL10036
CONFIG_DVB_ZL10039
CONFIG_DVB_S5H1420
CONFIG_DVB_STV0288
CONFIG_DVB_STB6000
CONFIG_DVB_STV0299
CONFIG_DVB_STV6110
CONFIG_DVB_STV0900
CONFIG_DVB_TDA8083
CONFIG_DVB_TDA10086
CONFIG_DVB_TDA8261
CONFIG_DVB_VES1X93
CONFIG_DVB_TUNER_ITD1000
CONFIG_DVB_TUNER_CX24113
CONFIG_DVB_TDA826X
CONFIG_DVB_TUA6100
CONFIG_DVB_CX24116
CONFIG_DVB_CX24117
CONFIG_DVB_CX24120
CONFIG_DVB_SI21XX
CONFIG_DVB_TS2020
CONFIG_DVB_DS3000
CONFIG_DVB_MB86A16
CONFIG_DVB_TDA10071
CONFIG_DVB_SP8870
CONFIG_DVB_SP887X
CONFIG_DVB_CX22700
CONFIG_DVB_CX22702
CONFIG_DVB_S5H1432
CONFIG_DVB_DRXD
CONFIG_DVB_L64781
CONFIG_DVB_TDA1004X
CONFIG_DVB_NXT6000
CONFIG_DVB_MT352
CONFIG_DVB_ZL10353
CONFIG_DVB_DIB3000MB
CONFIG_DVB_DIB3000MC
CONFIG_DVB_DIB7000M
CONFIG_DVB_DIB7000P
CONFIG_DVB_DIB9000
CONFIG_DVB_TDA10048
CONFIG_DVB_EC100
CONFIG_DVB_STV0367
CONFIG_DVB_CXD2820R
CONFIG_DVB_CXD2841ER
CONFIG_DVB_CXD2880
CONFIG_DVB_VES1820
CONFIG_DVB_TDA10021
CONFIG_DVB_TDA10023
CONFIG_DVB_STV0297
CONFIG_DVB_NXT200X
CONFIG_DVB_OR51211
CONFIG_DVB_OR51132
CONFIG_DVB_BCM3510
CONFIG_DVB_LGDT330X
CONFIG_DVB_LGDT3305
CONFIG_DVB_LG2160
CONFIG_DVB_S5H1409
CONFIG_DVB_AU8522
CONFIG_DVB_AU8522_DTV
CONFIG_DVB_AU8522_V4L
CONFIG_DVB_S5H1411
CONFIG_DVB_S921
CONFIG_DVB_DIB8000
CONFIG_DVB_MB86A20S
CONFIG_DVB_TC90522
CONFIG_DVB_MN88443X
CONFIG_DVB_PLL
CONFIG_DVB_TUNER_DIB0070
CONFIG_DVB_TUNER_DIB0090
CONFIG_DVB_DRX39XYJ
CONFIG_DVB_LNBH25
CONFIG_DVB_LNBH29
CONFIG_DVB_LNBP21
CONFIG_DVB_LNBP22
CONFIG_DVB_ISL6405
CONFIG_DVB_ISL6421
CONFIG_DVB_ISL6423
CONFIG_DVB_A8293
CONFIG_DVB_LGS8GL5
CONFIG_DVB_LGS8GXX
CONFIG_DVB_ATBM8830
CONFIG_DVB_TDA665x
CONFIG_DVB_IX2505V
CONFIG_DVB_M88RS2000
CONFIG_DVB_AF9033
CONFIG_DVB_HORUS3A
CONFIG_DVB_ASCOT2E
CONFIG_DVB_HELENE
CONFIG_DVB_CXD2099
CONFIG_DVB_SP2
"
CONFIGS_EQ="
CONFIG_DEFAULT_HOSTNAME=\"kali\"
"
ered() {
echo -e "\033[31m" $@
}
egreen() {
echo -e "\033[32m" $@
}
ewhite() {
echo -e "\033[37m" $@
}
echo -e "\n\nChecking config file for kali specific config options.\n\n"
errors=0
fixes=0
for c in $CONFIGS_ON $CONFIGS_OFF;do
cnt=`grep -w -c $c $FILE`
if [ $cnt -gt 1 ];then
ered "$c appears more than once in the config file, fix this"
errors=$((errors+1))
fi
if [ $cnt -eq 0 ];then
if $write ; then
ewhite "Creating $c"
echo "# $c is not set" >> "$FILE"
fixes=$((fixes+1))
else
ered "$c is neither enabled nor disabled in the config file"
errors=$((errors+1))
fi
fi
done
for c in $CONFIGS_ON;do
if grep "$c=y\|$c=m" "$FILE" >/dev/null;then
egreen "$c is already set"
else
if $write ; then
ewhite "Setting $c"
sed -i "s,# $c is not set,$c=y," "$FILE"
fixes=$((fixes+1))
else
ered "$c is not set, set it"
errors=$((errors+1))
fi
fi
done
for c in $CONFIGS_EQ;do
lhs=$(awk -F= '{ print $1 }' <(echo $c))
rhs=$(awk -F= '{ print $2 }' <(echo $c))
if grep "^$c" "$FILE" >/dev/null;then
egreen "$c is already set correctly."
continue
elif grep "^$lhs" "$FILE" >/dev/null;then
cur=$(awk -F= '{ print $2 }' <(grep "^$lhs=" "$FILE"))
ered "$lhs is set, but to $cur not $rhs."
if $write ; then
egreen "Setting $c correctly"
sed -i 's,^'"$lhs"'.*,# '"$lhs"' was '"$cur"'\n'"$c"',' "$FILE"
fixes=$((fixes+1))
fi
else
if $write ; then
ewhite "Setting $c"
echo "$c" >> "$FILE"
fixes=$((fixes+1))
else
ered "$c is not set"
errors=$((errors+1))
fi
fi
done
for c in $CONFIGS_OFF;do
if grep "$c=y\|$c=m" "$FILE" >/dev/null;then
if $write ; then
ewhite "Unsetting $c"
sed -i "s,$c=.*,# $c is not set," $FILE
fixes=$((fixes+1))
else
ered "$c is set, unset it"
errors=$((errors+1))
fi
else
egreen "$c is already unset"
fi
done
if [ $errors -eq 0 ];then
egreen "\n\nConfig file checked, found no errors.\n\n"
else
ered "\n\nConfig file checked, found $errors errors that I did not fix.\n\n"
fi
if [ $fixes -gt 0 ];then
egreen "Made $fixes fixes.\n\n"
fi
ewhite " "