-
Notifications
You must be signed in to change notification settings - Fork 229
/
kali1.sh
executable file
·3407 lines (2936 loc) · 172 KB
/
kali1.sh
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#-Metadata----------------------------------------------------#
# Filename: kali.sh (Update: 2015-07-20) #
#-Info--------------------------------------------------------#
# Personal post-install script for Kali Linux. #
#-Author(s)---------------------------------------------------#
# g0tmilk ~ https://blog.g0tmi1k.com/ #
#-Operating System--------------------------------------------#
# Designed for: Kali Linux 1.1.0a [x64] (VM - VMware) #
# Tested on: Kali Linux 1.0.0 - 1.1.0a [x64 & x84 & mini] #
#-Licence-----------------------------------------------------#
# MIT License ~ http://opensource.org/licenses/MIT #
#-Notes-------------------------------------------------------#
# Run as root, just after a fresh/clean install of Kali. #
# --- #
# By default it will set the time zone & keyboard to UK/GB. #
# --- #
# Command line arguments: #
# --burp = Automates configuring Burp Proxy (Free) #
# --dns = Use Google's DNS and locks permissions #
# --hold = Disable updating certain packages (e.g. msf) #
# --openvas = Installs & configures OpenVAS vuln scanner #
# --osx = Configures Apple keyboard layout #
# #
# e.g. # bash kali.sh --osx --burp --openvas #
# --- #
# Incomplete/buggy/hidden stuff - search for '***'. #
# --- #
# TODO: External resoureces, check http 200 - else error out #
# --- #
# ** This script is meant for _ME_. ** #
# ** EDIT this to meet _YOUR_ requirements! ** #
# ** Wasn't designed with customization in mind. ** #
#-------------------------------------------------------------#
if [ 1 -eq 0 ]; then # This is never true, thus it acts as block comments ;)
### One liner - Grab the latest version and execute! ###########################
wget -qO /tmp/kali.sh https://raw.github.com/g0tmi1k/os-scripts/master/kali.sh && bash /tmp/kali.sh --osx --dns --burp --openvas --hold
################################################################################
## Shorten URL: >>> wget -qO- http://bit.do/postkali | bash <<<
## Alt Method: curl -s -L -k https://raw.github.com/g0tmi1k/kali-postinstall/master/kali_postinstall.sh > kali.sh | nohup bash
################################################################################
fi
#-Defaults-------------------------------------------------------------#
##### Location information
keyboardApple=false # Using a Apple/Macintosh keyboard? Change to anything other than 'false' to enable [ --osx ]
keyboardlayout="gb" # Great Britain
timezone="Europe/London" # London, Europe
##### Optional steps
hardenDNS=false # Set static & lock DNS name server [ --dns ]
freezeDEB=false # Disable updating certain packages (e.g. Metasploit) [ --hold ]
burpFree=false # Disable configuring Burp Proxy Free (for Burp Pro users...) [ --burp ]
openVAS=false # Install & configure OpenVAS (not everyone wants it...) [ --openvas ]
##### (Optional) Enable debug mode?
#set -x
##### (Cosmetic) Colour output
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
BLUE="\033[01;34m" # Heading
BOLD="\033[01;01m" # Highlight
RESET="\033[00m" # Normal
#-Arguments------------------------------------------------------------#
##### Read command line arguments
for x in $( tr '[:upper:]' '[:lower:]' <<< "$@" ); do
if [ "${x}" == "--osx" ]; then
keyboardApple=true
elif [ "${x}" == "--dns" ]; then
hardenDNS=true
elif [ "${x}" == "--hold" ]; then
freezeDEB=true
elif [ "${x}" == "--burp" ]; then
burpFree=true
elif [ "${x}" == "--openvas" ]; then
openVAS=true
else
echo -e ' '$RED'[!]'$RESET' Unknown option: '${x} 1>&2
exit 1
fi
done
#-Start----------------------------------------------------------------#
##### Check if we are running as root - else this script will fail (hard!)
if [[ $EUID -ne 0 ]]; then
echo -e ' '$RED'[!]'$RESET' This script must be run as root. Quitting...' 1>&2
exit 1
else
echo -e " $BLUE[*]$RESET Kali Linux post-install script"
fi
##### Fixing display output for GUI programs when connecting via SSH
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
##### Fixing NetworkManager issues
echo -e "\n $GREEN[+]$RESET Fixing NetworkManager issues"
service network-manager stop
#--- Fix 'device not managed' issue
file=/etc/network/interfaces; [ -e "$file" ] && cp -n $file{,.bkup} # ...or: /etc/NetworkManager/NetworkManager.conf
echo "iface lo inet loopback" > "$file" #sed -i '/iface lo inet loopback/q' "$file" # ...or: sed -i 's/managed=.*/managed=true/' "$file"
#service network-manager restart
#--- Fix 'network disabled' issue
rm -f /var/lib/NetworkManager/NetworkManager.state
#--- Wait a little while before trying to connect out again (just to make sure)
sleep 3
service network-manager restart
sleep 10
for i in {1..10}; do ping -c 1 -W $i www.google.com &>/dev/null && break; done
if [[ "$?" -ne 0 ]]; then
echo -e ' '$RED'[!]'$RESET' Possible DNS issues(?). Trying DHCP "fix".' 1>&2
chattr -i /etc/resolv.conf 2>/dev/null
dhclient
sleep 15
_TMP=true
_CMD="$(ping -c 1 8.8.8.8 &>/dev/null)"
if [[ "$?" -ne 0 && "$_TMP" == true ]]; then
_TMP=false
echo -e ' '$RED'[!]'$RESET' No Internet access. Manually fix the issue & re-run the script.' 1>&2
fi
_CMD="$(ping -c 1 www.google.com &>/dev/null)"
if [[ "$?" -ne 0 && "$_TMP" == true ]]; then
_TMP=false
echo -e ' '$RED'[!]'$RESET' Possible DNS issues(?). Manually fix the issue & re-run the script.' 1>&2
fi
if [[ "$_TMP" == false ]]; then
(dmidecode | grep -iq virtual) && echo -e $YELLOW'[i]'$RESET' VM Detected. Try switching network adapter mode (NAT/Bridged).'
echo -e ' '$RED'[!]'$RESET' Quitting...' 1>&2
exit 2
fi
fi
##### Enabling default network repositories ~ http://docs.kali.org/general-use/kali-linux-sources-list-repositories & Fix 'KEYEXPIRED 1425567400'
echo -e "\n $GREEN[+]$RESET Enabling default network repositories ~ if they were not selected during install"
#--- Fixing old keys
#find /var/cache/apt/ -type f -delete
find /var/lib/apt/lists/ -type f -delete # Bug fix: https://forums.kali.org/showthread.php?24687-Problem-with-apt-get-update&p=42558&viewfull=1#post42558
apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 7D8D0BF6 #gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 # http://docs.kali.org/introduction/download-official-kali-linux-images
#--- Add network repositories
file=/etc/apt/sources.list; [ -e "$file" ] && cp -n $file{,.bkup}
([[ -e "$file" && "$(tail -c 1 $file)" != "" ]]) && echo >> "$file"
grep -q 'kali main non-free contrib' "$file" 2>/dev/null || echo "deb http://http.kali.org/kali kali main non-free contrib" >> "$file"
grep -q 'kali/updates main contrib non-free' "$file" 2>/dev/null || echo "deb http://security.kali.org/kali-security kali/updates main contrib non-free" >> "$file"
#grep -q 'kali-proposed-updates main contrib non-free' "$file" 2>/dev/null || echo -e "deb http://repo.kali.org/kali kali-proposed-updates main contrib non-free\ndeb-src http://repo.kali.org/kali kali-proposed-updates main contrib non-free" >> "$file"
#--- Disable CD repositories
sed -i '/kali/ s/^\( \|\t\|\)deb cdrom/#deb cdrom/g' "$file"
#--- Update
apt-get -qq update
apt-get -y -qq install kali-archive-keyring # Fixing old keys
##### Installing kernel headers
echo -e "\n $GREEN[+]$RESET Installing kernel headers"
apt-get -y -qq install gcc make "linux-headers-$(uname -r)"
if [[ $? -ne 0 ]]; then
echo -e ' '$RED'[!]'$RESET' There was an issue installing kernel headers' 1>&2
echo -e $YELLOW'[i]'$RESET' Are you using the latest kernel?'
fi
##### (Optional) Checking to see if Kali is in a VM. If so, install "Virtual Machine Addons/Tools" for a "better" virtual experiment
if [ -e "/etc/vmware-tools" ]; then
echo -e '\n'$RED'[!]'$RESET' VMware Tools is already installed. Skipping...' 1>&2
elif (dmidecode | grep -iq vmware); then
##### Installing virtual machines tools ~ http://docs.kali.org/general-use/install-vmware-tools-kali-guest
echo -e "\n $GREEN[+]$RESET Installing virtual machines tools"
#--- VM -> Install VMware Tools. Note: you may need to apply a patch: https://github.com/offensive-security/kali-vmware-tools-patches
mkdir -p /mnt/cdrom/
umount -f /mnt/cdrom 2>/dev/null
sleep 2
mount -o ro /dev/cdrom /mnt/cdrom 2>/dev/null; _mount=$? # This will only check the first CD drive (if there are multiple bays)
sleep 2
file=$(find /mnt/cdrom/ -maxdepth 1 -type f -name 'VMwareTools-*.tar.gz' -print -quit)
([[ "$_mount" == 0 && -z "$file" ]]) && echo -e ' '$RED'[!]'$RESET' Incorrect CD/ISO mounted' 1>&2
if [[ "$_mount" == 0 && -n "$file" ]]; then # If there is a CD in (and its right!), try to install native Guest Additions
echo -e $YELLOW'[i]'$RESET' Patching & using "native VMware tools"'
apt-get -y -qq install gcc make "linux-headers-$(uname -r)" git
git clone git://github.com/rasa/vmware-tools-patches.git /tmp/vmware-tools-patches
cp -f /mnt/cdrom/VMwareTools-*.tar.gz /tmp/vmware-tools-patches/downloads/
pushd /tmp/vmware-tools-patches/ >/dev/null
bash untar-and-patch-and-compile.sh
popd >/dev/null
#cp -f /mnt/cdrom/VMwareTools-*.tar.gz /tmp/
#tar -zxf /tmp/VMwareTools-* -C /tmp/
#pushd /tmp/vmware-tools-distrib/ >/dev/null
#echo -e '\n' | timeout 300 perl vmware-install.pl # Press ENTER for all the default options, wait for 5 minutes to try and install else just quit
#popd >/dev/null
umount -f /mnt/cdrom 2>/dev/null
else # The fallback is 'open vm tools' ~ http://open-vm-tools.sourceforge.net/about.php
echo -e ' '$RED'[!]'$RESET' VMware Tools CD/ISO isnt mounted' 1>&2
echo -e $YELLOW'[i]'$RESET' Skipping "Native VMware Tools", switching to "Open VM Tools" instead'
apt-get -y -qq install open-vm-toolbox
fi
#--- Slow mouse? ~ http://docs.kali.org/general-use/install-vmware-tools-kali-guest
#apt-get -y -qq install xserver-xorg-input-vmmouse
elif [ -e "/etc/init.d/vboxadd" ]; then
echo -e '\n'$RED'[!]'$RESET' Virtualbox Guest Additions is already installed. Skipping...' 1>&2
elif (dmidecode | grep -iq virtualbox); then
##### (Optional) Installing Virtualbox Guest Additions. Note: Need VirtualBox 4.2.xx+ (http://docs.kali.org/general-use/kali-linux-virtual-box-guest)
echo -e "\n $GREEN[+]$RESET (Optional) Installing Virtualbox Guest Additions"
#--- Devices -> Install Guest Additions CD image...
mkdir -p /mnt/cdrom/
umount -f /mnt/cdrom 2>/dev/null
sleep 1
mount -o ro /dev/cdrom /mnt/cdrom 2>/dev/null; _mount=$? # Only checks first CD drive (if multiple)
if [[ "$_mount" == 0 && ! -e /mnt/cdrom/VBoxLinuxAdditions.run ]]; then
echo -e ' '$RED'[!]'$RESET' Incorrect CD/ISO mounted. Skipping...' 1>&2
elif [[ "$_mount" == 0 ]]; then
apt-get -y -qq install gcc make "linux-headers-$(uname -r)"
cp -f /mnt/cdrom/VBoxLinuxAdditions.run /tmp/
chmod -f 0755 /tmp/VBoxLinuxAdditions.run
/tmp/VBoxLinuxAdditions.run --nox11
umount -f /mnt/cdrom 2>/dev/null
fi
fi
###### Checking display resolutions - just for post-install setup ***
#echo -e "\n $GREEN[+]$RESET Checking possible display resolutions"
#export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
#current_res=$(xrandr | awk '/\*/ {print $1}')
#if [[ $current_res == "800x600" ]]; then
# echo -e $YELLOW'[i]'$RESET' Setting display resolution (1152x864) - Only until next reboot!'
# (xrandr | grep -q 1152x864) && xrandr --size 1152x864
#fi
##### Checking to see if there is a second ethernet card (if so, set an static IP address)
ifconfig eth1 &>/dev/null
if [[ $? == 0 ]]; then
##### Setting a static IP address (192.168.155.175/24) on eth1
echo -e "\n $GREEN[+]$RESET Setting a static IP address (192.168.155.175/24) on eth1"
ifconfig eth1 192.168.155.175/24
file=/etc/network/interfaces; [ -e "$file" ] && cp -n $file{,.bkup}
grep -q '^iface eth1 inet static' "$file" 2>/dev/null || cat <<EOF >> "$file"
auto eth1
iface eth1 inet static
address 192.168.155.175
netmask 255.255.255.0
gateway 192.168.155.1
EOF
fi
##### Setting static & protecting DNS name servers. Note: May cause issues with forced values (e.g. captive portals etc)
if [ "$hardenDNS" != "false" ]; then
echo -e "\n $GREEN[+]$RESET Setting static & protecting DNS name servers"
file=/etc/resolv.conf; [ -e "$file" ] && cp -n $file{,.bkup}
chattr -i "$file" 2>/dev/null
#--- Remove duplicate results
#uniq "$file" > "$file.new"; mv $file{.new,}
#--- Use OpenDNS DNS
#echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' > "$file"
#--- Use Google DNS
echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' > "$file"
#--- Add domain
#echo -e "domain $domainName\n#search $domainName" >> "$file"
#--- Protect it
chattr +i "$file" 2>/dev/null
else
echo -e ' '$RED'[!]'$RESET' Skipping DNS (missing --dns)...' 1>&2
fi
###### Updating hostname (to 'kali') - but not domain name ***
#echo -e "\n $GREEN[+]$RESET Updating hostname (to 'kali')"
#hostname="kali"
##--- Change it now
#hostname "$hostname"
##--- Make sure it sticks after reboot
#file=/etc/hostname; [ -e "$file" ] && cp -n $file{,.bkup}
#echo "$(hostname)" > "$file"
##--- Set host file
#file=/etc/hosts; [ -e "$file" ] && cp -n $file{,.bkup}
#sed -i 's/127.0.1.1.*/127.0.1.1 '$hostname'/' "$file" #echo -e "127.0.0.1 localhost.localdomain localhost\n127.0.0.1 $hostname.$domainname $hostname" > "$file" #$(hostname) $domainname
##--- Check
##hostname; hostname -f
##### Updating location information - set either value to "" to skip.
echo -e "\n $GREEN[+]$RESET Updating location information ~ keyboard layout & time zone ($keyboardlayout & $timezone)"
[ "$keyboardApple" != "false" ] && echo -e "\n $GREEN[+]$RESET Applying Apple hardware profile"
#keyboardlayout="gb" # Great Britain
#timezone="Europe/London" # London, Europe
#--- Configure keyboard layout
if [ ! -z "$keyboardlayout" ]; then
file=/etc/default/keyboard; #[ -e "$file" ] && cp -n $file{,.bkup}
sed -i 's/XKBLAYOUT=".*"/XKBLAYOUT="'$keyboardlayout'"/' "$file"
[ "$keyboardApple" != "false" ] && sed -i 's/XKBVARIANT=".*"/XKBVARIANT="mac"/' "$file" # Enable if you are using Apple based products.
#dpkg-reconfigure -f noninteractive keyboard-configuration #dpkg-reconfigure console-setup #dpkg-reconfigure keyboard-configuration -u # Need to restart xserver for effect
fi
#--- Changing time zone
[ -z "$timezone" ] && timezone=Etc/UTC #Etc/GMT vs Etc/UTC vs UTC
echo "$timezone" > /etc/timezone #Etc/GMT vs Etc/UTC vs UTC vs Europe/London
ln -sf "/usr/share/zoneinfo/$(cat /etc/timezone)" /etc/localtime
#--- Setting locale
#sed -i 's/^# en_/en_/' /etc/locale.gen #en_GB en_US
#locale-gen
##echo -e 'LC_ALL=en_US.UTF-8\nLANG=en_US.UTF-8\nLANGUAGE=en_US:en' > /etc/default/locale
#dpkg-reconfigure -f noninteractive tzdata
##locale -a # Check
#--- Installing ntp
apt-get -qq update
apt-get -y -qq install ntp ntpdate
#--- Configuring ntp
#file=/etc/default/ntp; [ -e "$file" ] && cp -n $file{,.bkup}
#grep -q "interface=127.0.0.1" "$file" || sed -i "s/NTPD_OPTS='/NTPD_OPTS='--interface=127.0.0.1 /" "$file"
#--- Update time
ntpdate -b -s -u pool.ntp.org
#--- Start service
service ntp restart
#--- Remove from start up
update-rc.d ntp remove 2>/dev/null
#--- Check
#date
#--- Only used for stats at the end
start_time=$(date +%s)
if [ "$freezeDEB" != "false" ]; then
##### Don't ever update these packages
echo -e "\n $GREEN[+]$RESET Don't ever update these packages:"
for x in metasploit metasploit-framework metasploit-common; do
echo -e " $YELLOW[i]$RESET + $x"
echo "$x hold" | dpkg --set-selections # To update: echo "$x install" | dpkg --set-selections
done
fi
##### Updating OS from repositories
echo -e "\n $GREEN[+]$RESET Updating OS from repositories (this may take a while depending on your Internet connection & Kali version/age)"
for FILE in clean autoremove; do apt-get -y -qq "$FILE"; done # Clean up clean remove autoremove autoclean
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update && apt-get -y -qq dist-upgrade --fix-missing
#--- Enable bleeding edge ~ http://www.kali.org/kali-monday/bleeding-edge-kali-repositories/
#file=/etc/apt/sources.list; [ -e "$file" ] && cp -n $file{,.bkup}
#grep -q 'kali-bleeding-edge' "$file" 2>/dev/null || echo -e "\n\n## Bleeding edge\ndeb http://repo.kali.org/kali kali-bleeding-edge main" >> "$file"
#apt-get -qq update && apt-get -y -qq upgrade
#--- Check kernel stuff
_TMP=$(dpkg -l | grep linux-image- | grep -vc meta)
if [[ "$_TMP" -gt 1 ]]; then
echo -e "\n $YELLOW[i]$RESET Detected multiple kernels installed"
#echo -e " $YELLOW[i]$RESET Clean up: apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')" # DO NOT RUN IF NOT USING THE LASTEST KERNEL!
TMP=$(dpkg -l | grep linux-image | grep -v meta | sort -t '.' -k 2 -g | tail -n 1 | grep "$(uname -r)")
[[ -z "$_TMP" ]] && echo -e ' '$RED'[!]'$RESET' You are not using the latest kernel' 1>&2 && echo -e " $YELLOW[i]$RESET You have it downloaded & installed, just not using it. You need to **reboot**"
fi
#--- Kali's default tools ~ https://www.kali.org/news/kali-linux-metapackages/
apt-get -y -qq install kali-linux-full
###### Settings services to listen to listen to loopback interface ***
#echo -e "\n $GREEN[+]$RESET Settings services to listen to listen to loopback interface"
#--- Configuring ntp
#file=/etc/default/ntp; [ -e "$file" ] && cp -n $file{,.bkup}
#grep -q "interface=127.0.0.1" "$file" || sed -i "s/^NTPD_OPTS='/NTPD_OPTS='--interface=127.0.0.1 /" "$file"
#service ntp restart
#--- Configuring rpcbind
#file=/etc/default/rpcbind; [ -e "$file" ] && cp -n $file{,.bkup}
#if [ -e "$file" ]; then grep -q "127.0.0.1" "$file" || sed -i 's/OPTIONS="/OPTIONS="-h 127.0.0.1 /' "$file"; else echo 'OPTIONS="-w -h 127.0.0.1"' > "$file"; fi
#service ntp rpcbind
#--- Configuring nfs
#file=/etc/default/rpcbind; [ -e "$file" ] && cp -n $file{,.bkup}
#grep -q "--name 127.0.0.1" "$file" || sed -i 's/^STATDOPTS=/STATDOPTS="--name 127.0.0.1"/' "$file"
#service nfs-common restart
##### Fixing audio issues
echo -e "\n $GREEN[+]$RESET Fixing audio issues"
#--- PulseAudio warnings
#file=/etc/default/pulseaudio; [ -e "$file" ] && cp -n $file{,.bkup}
#sed -i 's/^PULSEAUDIO_SYSTEM_START=.*/PULSEAUDIO_SYSTEM_START=1/' "$file"
#--- Unmute on startup
apt-get -y -qq install alsa-utils
#--- Set volume now
amixer set Master unmute >/dev/null
amixer set Master 50% >/dev/null
##### Configuring GRUB
echo -e "\n $GREEN[+]$RESET Configuring GRUB ~ boot manager"
(dmidecode | grep -iq virtual) && grubTimeout=1 || grubTimeout=5
file=/etc/default/grub; [ -e "$file" ] && cp -n $file{,.bkup}
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT='$grubTimeout'/' "$file" # Time out (lower if in a virtual machine, else possible dual booting)
sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=""/' "$file" # TTY resolution #GRUB_CMDLINE_LINUX_DEFAULT="vga=0x0318 quiet" (crashes VM/vmwgfx)
update-grub
###### Disabling login manager (console login - non GUI) ***
#echo -e "\n $GREEN[+]$RESET Disabling login (console login - non GUI)"
#--- Disable GUI login screen
#apt-get -y -qq install chkconfig
#chkconfig gdm3 off # ...or: mv -f /etc/rc2.d/S19gdm3 /etc/rc2.d/K17gdm #file=/etc/X11/default-display-manager; [ -e "$file" ] && cp -n $file{,.bkup} #echo /bin/true > "$file"
#--- Enable auto (gui) login
#file=/etc/gdm3/daemon.conf; [ -e "$file" ] && cp -n $file{,.bkup}
#sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = true/' "$file"
#sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' "$file"
#--- Shortcut for when you want to start GUI
#ln -sf /usr/sbin/gdm3 /usr/bin/startx
###### Configuring startup (randomize the hostname, eth0 & wlan0s MAC address) ***
#echo -e "\n $GREEN[+]$RESET Configuring startup (randomize the hostname, eth0 & wlan0s MAC address)"
#--- Start up
#file=/etc/rc.local; [ -e "$file" ] && cp -n $file{,.bkup}
#grep -q "macchanger" "$file" 2>/dev/null || sed -i 's#^exit 0#for INT in eth0 wlan0; do\n ifconfig $INT down\n '$(whereis macchanger)' -r $INT \&\& sleep 3\n ifconfig $INT up\ndone\n\n\nexit 0#' "$file"
#grep -q "hostname" "$file" 2>/dev/null || sed -i 's#^exit 0#'$(whereis hostname)' $(cat /dev/urandom | tr -dc "A-Za-z" | head -c8)\nexit 0#' "$file"
#--- On demand (*** kinda broken)
##file=/etc/init.d/macchanger; [ -e "$file" ] && cp -n $file{,.bkup}
##echo -e '#!/bin/bash\nfor INT in eth0 wlan0; do\n echo "Randomizing: $INT"\n ifconfig $INT down\n macchanger -r $INT\n sleep 3\n ifconfig $INT up\n echo "--------------------"\ndone\nexit 0' > "$file"
##chmod -f 0500 "$file"
#--- Auto on interface change state (untested)
##file=/etc/network/if-pre-up.d/macchanger; [ -e "$file" ] && cp -n $file{,.bkup}
##echo -e '#!/bin/bash\n[ "$IFACE" == "lo" ] && exit 0\nifconfig $IFACE down\nmacchanger -r $IFACE\nifconfig $IFACE up\nexit 0' > "$file"
##chmod -f 0500 "$file"
##### Configuring GNOME 3
echo -e "\n $GREEN[+]$RESET Configuring GNOME 3 ~ desktop environment"
#--- Move bottom panel to top panel
gsettings set org.gnome.gnome-panel.layout toplevel-id-list "['top-panel']"
dconf write /org/gnome/gnome-panel/layout/objects/workspace-switcher/toplevel-id "'top-panel'"
dconf write /org/gnome/gnome-panel/layout/objects/window-list/toplevel-id "'top-panel'"
#--- Panel position
dconf write /org/gnome/gnome-panel/layout/toplevels/top-panel/orientation "'top'" #"'right'" # Issue with window-list
#--- Panel ordering
dconf write /org/gnome/gnome-panel/layout/objects/menu-bar/pack-type "'start'"
dconf write /org/gnome/gnome-panel/layout/objects/menu-bar/pack-index 0
dconf write /org/gnome/gnome-panel/layout/objects/window-list/pack-type "'start'" # "'center'"
dconf write /org/gnome/gnome-panel/layout/objects/window-list/pack-index 5 #0
dconf write /org/gnome/gnome-panel/layout/objects/workspace-switcher/pack-type "'end'"
dconf write /org/gnome/gnome-panel/layout/objects/clock/pack-type "'end'"
dconf write /org/gnome/gnome-panel/layout/objects/user-menu/pack-type "'end'"
dconf write /org/gnome/gnome-panel/layout/objects/notification-area/pack-type "'end'"
dconf write /org/gnome/gnome-panel/layout/objects/workspace-switcher/pack-index 1
dconf write /org/gnome/gnome-panel/layout/objects/clock/pack-index 2
dconf write /org/gnome/gnome-panel/layout/objects/user-menu/pack-index 3
dconf write /org/gnome/gnome-panel/layout/objects/notification-area/pack-index 4
#--- Enable auto hide
#dconf write /org/gnome/gnome-panel/layout/toplevels/top-panel/auto-hide true
#--- Add top 10 tools to toolbar
dconf load /org/gnome/gnome-panel/layout/objects/object-10-top/ << EOF
[instance-config]
menu-path='applications:/Kali/Top 10 Security Tools/'
tooltip='Top 10 Security Tools'
[/]
object-iid='PanelInternalFactory::MenuButton'
toplevel-id='top-panel'
pack-type='start'
pack-index=4
EOF
dconf write /org/gnome/gnome-panel/layout/object-id-list "$(dconf read /org/gnome/gnome-panel/layout/object-id-list | sed "s/]/, 'object-10-top']/")"
#--- Show desktop
dconf load /org/gnome/gnome-panel/layout/objects/object-show-desktop/ << EOF
[/]
object-iid='WnckletFactory::ShowDesktopApplet'
toplevel-id='top-panel'
pack-type='end'
pack-index=0
EOF
dconf write /org/gnome/gnome-panel/layout/object-id-list "$(dconf read /org/gnome/gnome-panel/layout/object-id-list | sed "s/]/, 'object-show-desktop']/")"
#--- Fix icon top 10 shortcut icon
#convert /usr/share/icons/hicolor/48x48/apps/k.png -negate /usr/share/icons/hicolor/48x48/apps/k-invert.png
#/usr/share/icons/gnome/48x48/status/security-medium.png
#--- Enable only two workspaces
gsettings set org.gnome.desktop.wm.preferences num-workspaces 2 #gconftool-2 --type int --set /apps/metacity/general/num_workspaces 2 #dconf write /org/gnome/gnome-panel/layout/objects/workspace-switcher/instance-config/num-rows 4
gsettings set org.gnome.shell.overrides dynamic-workspaces false
#--- Smaller title bar
#sed -i '/title_vertical_pad/s/value="[0-9]\{1,2\}"/value="0"/g' /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml
#sed -i 's/title_scale=".*"/title_scale="small"/g' /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml
gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Droid Bold 10' # 'Cantarell Bold 11'
gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false
#--- Hide desktop icon
dconf write /org/gnome/nautilus/desktop/computer-icon-visible false
#--- Add "open with terminal" on right click menu
apt-get -y -qq install nautilus-open-terminal
#--- Enable num lock at start up (might not be smart if you're using a smaller keyboard (laptop?))
apt-get -y -qq install numlockx
file=/etc/gdm3/Init/Default; [ -e "$file" ] && cp -n $file{,.bkup} #/etc/rc.local
grep -q '^/usr/bin/numlockx' "$file" 2>/dev/null || sed -i 's#exit 0#if [ -x /usr/bin/numlockx ]; then\n /usr/bin/numlockx on\nfi\nexit 0#' "$file" # GNOME
#--- Change wallpaper & login (happens later)
#wget -q "http://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_A.png" -P /usr/share/wallpapers/
#gsettings set org.gnome.desktop.background picture-uri 'file:///usr/share/wallpapers/kali-wp-june-2014_1920x1080_A.png'
#cp -f /usr/share/wallpapers/kali-wp-june-2014_1920x1080_A.png /usr/share/images/desktop-base/login-background.png
#--- Restart GNOME panel to apply/take effect (need to restart xserver for effect)
#timeout 30 killall -q -w gnome-panel >/dev/null && gnome-panel& # Still need to logoff!
##### Installing & configuring XFCE 4
echo -e "\n $GREEN[+]$RESET Installing & configuring XFCE 4 ~ desktop environment"
apt-get -y -qq install curl
apt-get -y -qq install xfce4 xfce4-places-plugin
#apt-get -y -qq install shiki-colors-xfwm-theme # theme
#--- Configuring xfce 4
mv -f /usr/bin/startx{,-gnome}
ln -sf /usr/bin/startx{fce4,}
mkdir -p /root/.config/xfce4/{desktop,menu,panel,xfconf,xfwm4}/
mkdir -p /root/.config/xfce4/panel/launcher-1{5,6,7,9}
mkdir -p /root/.config/xfce4/xfconf/xfce-perchannel-xml/
mkdir -p /root/.themes/
cat <<EOF > /root/.config/xfce4/desktop/icons.screen0.rc
[Wastebasket]
row=2
col=0
[File System]
row=1
col=0
[Home]
row=0
col=0
EOF
cat <<EOF > /root/.config/xfce4/panel/places-23.rc
show_button_icon=true
show_button_label=false
label=Places
show_icons=true
show_volumes=true
mount_open_volumes=false
show_bookmarks=true
show_recent=true
show_recent_clear=true
show_recent_number=10
search_cmd=
EOF
cat <<EOF > /root/.config/xfce4/panel/xfce4-mixer-plugin-24.rc
card=PlaybackES1371AudioPCI97AnalogStereoPulseAudioMixer
track=Master
command=xfce4-mixer
EOF
cat <<EOF > /root/.config/xfce4/panel/launcher-15/13684522587.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Iceweasel
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Iceweasel Web Browser
Exec=iceweasel %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=iceweasel
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Iceweasel
StartupNotify=true
X-XFCE-Source=file:///usr/share/applications/iceweasel.desktop
EOF
cat <<EOF > /root/.config/xfce4/panel/launcher-16/13684522758.desktop
[Desktop Entry]
Version=1.0
Type=Application
Exec=exo-open --launch TerminalEmulator
Icon=utilities-terminal
StartupNotify=false
Terminal=false
Categories=Utility;X-XFCE;X-Xfce-Toplevel;
OnlyShowIn=XFCE;
Name=Terminal Emulator
Name[en_GB]=Terminal Emulator
Comment=Use the command line
Comment[en_GB]=Use the command line
X-XFCE-Source=file:///usr/share/applications/exo-terminal-emulator.desktop
EOF
cat <<EOF > /root/.config/xfce4/panel/launcher-17/13684522859.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Geany
Name[en_GB]=Geany
GenericName=Integrated Development Environment
GenericName[en_GB]=Integrated Development Environment
Comment=A fast and lightweight IDE using GTK2
Comment[en_GB]=A fast and lightweight IDE using GTK2
Exec=geany %F
Icon=geany
Terminal=false
Categories=GTK;Development;IDE;
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
StartupNotify=true
X-XFCE-Source=file:///usr/share/applications/geany.desktop
EOF
cat <<EOF > /root/.config/xfce4/panel/launcher-19/136845425410.desktop
[Desktop Entry]
Version=1.0
Name=Application Finder
Name[en_GB]=Application Finder
Comment=Find and launch applications installed on your system
Comment[en_GB]=Find and launch applications installed on your system
Exec=xfce4-appfinder
Icon=xfce4-appfinder
StartupNotify=true
Terminal=false
Type=Application
Categories=X-XFCE;Utility;
X-XFCE-Source=file:///usr/share/applications/xfce4-appfinder.desktop
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-appfinder.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-appfinder" version="1.0">
<property name="category" type="string" value="All"/>
<property name="window-width" type="int" value="640"/>
<property name="window-height" type="int" value="480"/>
<property name="close-after-execute" type="bool" value="true"/>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-desktop" version="1.0">
<property name="desktop-icons" type="empty">
<property name="file-icons" type="empty">
<property name="show-removable" type="bool" value="true"/>
<property name="show-trash" type="bool" value="false"/>
<property name="show-filesystem" type="bool" value="false"/>
<property name="show-home" type="bool" value="false"/>
</property>
</property>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-keyboard-shortcuts" version="1.0">
<property name="commands" type="empty">
<property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="<Alt>F2" type="string" value="xfrun4"/>
<property name="<Primary><Alt>t" type="string" value="/usr/bin/exo-open --launch TerminalEmulator"/>
<property name="<Primary><Alt>Delete" type="string" value="xflock4"/>
<property name="<Primary>Escape" type="string" value="xfdesktop --menu"/>
<property name="<Super>p" type="string" value="xfce4-display-settings --minimal"/>
<property name="override" type="bool" value="true"/>
<property name="<Primary>space" type="string" value="xfce4-appfinder"/>
</property>
</property>
<property name="xfwm4" type="empty">
<property name="custom" type="empty">
<property name="<Alt><Control>End" type="string" value="move_window_next_workspace_key"/>
<property name="<Alt><Control>Home" type="string" value="move_window_prev_workspace_key"/>
<property name="<Alt><Control>KP_1" type="string" value="move_window_workspace_1_key"/>
<property name="<Alt><Control>KP_2" type="string" value="move_window_workspace_2_key"/>
<property name="<Alt><Control>KP_3" type="string" value="move_window_workspace_3_key"/>
<property name="<Alt><Control>KP_4" type="string" value="move_window_workspace_4_key"/>
<property name="<Alt><Control>KP_5" type="string" value="move_window_workspace_5_key"/>
<property name="<Alt><Control>KP_6" type="string" value="move_window_workspace_6_key"/>
<property name="<Alt><Control>KP_7" type="string" value="move_window_workspace_7_key"/>
<property name="<Alt><Control>KP_8" type="string" value="move_window_workspace_8_key"/>
<property name="<Alt><Control>KP_9" type="string" value="move_window_workspace_9_key"/>
<property name="<Alt><Shift>Tab" type="string" value="cycle_reverse_windows_key"/>
<property name="<Alt>Delete" type="string" value="del_workspace_key"/>
<property name="<Alt>F10" type="string" value="maximize_window_key"/>
<property name="<Alt>F11" type="string" value="fullscreen_key"/>
<property name="<Alt>F12" type="string" value="above_key"/>
<property name="<Alt>F4" type="string" value="close_window_key"/>
<property name="<Alt>F6" type="string" value="stick_window_key"/>
<property name="<Alt>F7" type="string" value="move_window_key"/>
<property name="<Alt>F8" type="string" value="resize_window_key"/>
<property name="<Alt>F9" type="string" value="hide_window_key"/>
<property name="<Alt>Insert" type="string" value="add_workspace_key"/>
<property name="<Alt>space" type="string" value="popup_menu_key"/>
<property name="<Alt>Tab" type="string" value="cycle_windows_key"/>
<property name="<Control><Alt>d" type="string" value="show_desktop_key"/>
<property name="<Control><Alt>Down" type="string" value="down_workspace_key"/>
<property name="<Control><Alt>Left" type="string" value="left_workspace_key"/>
<property name="<Control><Alt>Right" type="string" value="right_workspace_key"/>
<property name="<Control><Alt>Up" type="string" value="up_workspace_key"/>
<property name="<Control><Shift><Alt>Left" type="string" value="move_window_left_key"/>
<property name="<Control><Shift><Alt>Right" type="string" value="move_window_right_key"/>
<property name="<Control><Shift><Alt>Up" type="string" value="move_window_up_key"/>
<property name="<Control>F1" type="string" value="workspace_1_key"/>
<property name="<Control>F10" type="string" value="workspace_10_key"/>
<property name="<Control>F11" type="string" value="workspace_11_key"/>
<property name="<Control>F12" type="string" value="workspace_12_key"/>
<property name="<Control>F2" type="string" value="workspace_2_key"/>
<property name="<Control>F3" type="string" value="workspace_3_key"/>
<property name="<Control>F4" type="string" value="workspace_4_key"/>
<property name="<Control>F5" type="string" value="workspace_5_key"/>
<property name="<Control>F6" type="string" value="workspace_6_key"/>
<property name="<Control>F7" type="string" value="workspace_7_key"/>
<property name="<Control>F8" type="string" value="workspace_8_key"/>
<property name="<Control>F9" type="string" value="workspace_9_key"/>
<property name="<Shift><Alt>Page_Down" type="string" value="lower_window_key"/>
<property name="<Shift><Alt>Page_Up" type="string" value="raise_window_key"/>
<property name="<Super>Tab" type="string" value="switch_window_key"/>
<property name="Down" type="string" value="down_key"/>
<property name="Escape" type="string" value="cancel_key"/>
<property name="Left" type="string" value="left_key"/>
<property name="Right" type="string" value="right_key"/>
<property name="Up" type="string" value="up_key"/>
<property name="override" type="bool" value="true"/>
</property>
</property>
<property name="providers" type="array">
<value type="string" value="xfwm4"/>
<value type="string" value="commands"/>
</property>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-mixer.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-mixer" version="1.0">
<property name="active-card" type="string" value="PlaybackES1371AudioPCI97AnalogStereoPulseAudioMixer"/>
<property name="volume-step-size" type="uint" value="5"/>
<property name="sound-card" type="string" value="PlaybackES1371AudioPCI97AnalogStereoPulseAudioMixer"/>
<property name="sound-cards" type="empty">
<property name="PlaybackES1371AudioPCI97AnalogStereoPulseAudioMixer" type="array">
<value type="string" value="Master"/>
</property>
</property>
<property name="window-height" type="int" value="400"/>
<property name="window-width" type="int" value="738"/>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-panel" version="1.0">
<property name="panels" type="uint" value="1">
<property name="panel-0" type="empty">
<property name="position" type="string" value="p=6;x=0;y=0"/>
<property name="length" type="uint" value="100"/>
<property name="position-locked" type="bool" value="true"/>
<property name="plugin-ids" type="array">
<value type="int" value="1"/>
<value type="int" value="15"/>
<value type="int" value="16"/>
<value type="int" value="17"/>
<value type="int" value="21"/>
<value type="int" value="23"/>
<value type="int" value="19"/>
<value type="int" value="3"/>
<value type="int" value="24"/>
<value type="int" value="6"/>
<value type="int" value="2"/>
<value type="int" value="5"/>
<value type="int" value="4"/>
<value type="int" value="25"/>
</property>
<property name="background-alpha" type="uint" value="90"/>
</property>
</property>
<property name="plugins" type="empty">
<property name="plugin-1" type="string" value="applicationsmenu">
<property name="button-icon" type="string" value="kali-menu"/>
<property name="show-button-title" type="bool" value="false"/>
<property name="show-generic-names" type="bool" value="true"/>
<property name="show-tooltips" type="bool" value="true"/>
</property>
<property name="plugin-2" type="string" value="actions"/>
<property name="plugin-3" type="string" value="tasklist"/>
<property name="plugin-4" type="string" value="pager">
<property name="rows" type="uint" value="1"/>
</property>
<property name="plugin-5" type="string" value="clock">
<property name="digital-format" type="string" value="%R, %A %d %B %Y"/>
</property>
<property name="plugin-6" type="string" value="systray">
<property name="names-visible" type="array">
<value type="string" value="networkmanager applet"/>
</property>
</property>
<property name="plugin-15" type="string" value="launcher">
<property name="items" type="array">
<value type="string" value="13684522587.desktop"/>
</property>
</property>
<property name="plugin-16" type="string" value="launcher">
<property name="items" type="array">
<value type="string" value="13684522758.desktop"/>
</property>
</property>
<property name="plugin-17" type="string" value="launcher">
<property name="items" type="array">
<value type="string" value="13684522859.desktop"/>
</property>
</property>
<property name="plugin-21" type="string" value="applicationsmenu">
<property name="custom-menu" type="bool" value="true"/>
<property name="custom-menu-file" type="string" value="/root/.config/xfce4/menu/top10.menu"/>
<property name="button-icon" type="string" value="security-medium"/>
<property name="show-button-title" type="bool" value="false"/>
<property name="button-title" type="string" value="Top 10"/>
</property>
<property name="plugin-19" type="string" value="launcher">
<property name="items" type="array">
<value type="string" value="136845425410.desktop"/>
</property>
</property>
<property name="plugin-22" type="empty">
<property name="base-directory" type="string" value="/root"/>
<property name="hidden-files" type="bool" value="false"/>
</property>
<property name="plugin-23" type="string" value="places"/>
<property name="plugin-24" type="string" value="xfce4-mixer-plugin"/>
<property name="plugin-25" type="string" value="showdesktop"/>
</property>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-settings-editor.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-settings-editor" version="1.0">
<property name="window-width" type="int" value="600"/>
<property name="window-height" type="int" value="380"/>
<property name="hpaned-position" type="int" value="200"/>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfwm4" version="1.0">
<property name="general" type="empty">
<property name="activate_action" type="string" value="bring"/>
<property name="borderless_maximize" type="bool" value="true"/>
<property name="box_move" type="bool" value="false"/>
<property name="box_resize" type="bool" value="false"/>
<property name="button_layout" type="string" value="O|SHMC"/>
<property name="button_offset" type="int" value="0"/>
<property name="button_spacing" type="int" value="0"/>
<property name="click_to_focus" type="bool" value="true"/>
<property name="focus_delay" type="int" value="250"/>
<property name="cycle_apps_only" type="bool" value="false"/>
<property name="cycle_draw_frame" type="bool" value="true"/>
<property name="cycle_hidden" type="bool" value="true"/>
<property name="cycle_minimum" type="bool" value="true"/>
<property name="cycle_workspaces" type="bool" value="false"/>
<property name="double_click_time" type="int" value="250"/>
<property name="double_click_distance" type="int" value="5"/>
<property name="double_click_action" type="string" value="maximize"/>
<property name="easy_click" type="string" value="Alt"/>
<property name="focus_hint" type="bool" value="true"/>
<property name="focus_new" type="bool" value="true"/>
<property name="frame_opacity" type="int" value="100"/>
<property name="full_width_title" type="bool" value="true"/>
<property name="inactive_opacity" type="int" value="100"/>
<property name="maximized_offset" type="int" value="0"/>
<property name="move_opacity" type="int" value="100"/>
<property name="placement_ratio" type="int" value="20"/>
<property name="placement_mode" type="string" value="center"/>
<property name="popup_opacity" type="int" value="100"/>
<property name="mousewheel_rollup" type="bool" value="true"/>
<property name="prevent_focus_stealing" type="bool" value="false"/>
<property name="raise_delay" type="int" value="250"/>
<property name="raise_on_click" type="bool" value="true"/>
<property name="raise_on_focus" type="bool" value="false"/>
<property name="raise_with_any_button" type="bool" value="true"/>
<property name="repeat_urgent_blink" type="bool" value="false"/>
<property name="resize_opacity" type="int" value="100"/>
<property name="restore_on_move" type="bool" value="true"/>
<property name="scroll_workspaces" type="bool" value="true"/>
<property name="shadow_delta_height" type="int" value="0"/>
<property name="shadow_delta_width" type="int" value="0"/>
<property name="shadow_delta_x" type="int" value="0"/>
<property name="shadow_delta_y" type="int" value="-3"/>
<property name="shadow_opacity" type="int" value="50"/>
<property name="show_app_icon" type="bool" value="false"/>
<property name="show_dock_shadow" type="bool" value="true"/>
<property name="show_frame_shadow" type="bool" value="false"/>
<property name="show_popup_shadow" type="bool" value="false"/>
<property name="snap_resist" type="bool" value="false"/>
<property name="snap_to_border" type="bool" value="true"/>
<property name="snap_to_windows" type="bool" value="false"/>
<property name="snap_width" type="int" value="10"/>
<property name="theme" type="string" value="Shiki-Colors-Light-Menus"/>
<property name="title_alignment" type="string" value="center"/>
<property name="title_font" type="string" value="Sans Bold 9"/>
<property name="title_horizontal_offset" type="int" value="0"/>
<property name="title_shadow_active" type="string" value="false"/>
<property name="title_shadow_inactive" type="string" value="false"/>
<property name="title_vertical_offset_active" type="int" value="0"/>
<property name="title_vertical_offset_inactive" type="int" value="0"/>
<property name="toggle_workspaces" type="bool" value="false"/>
<property name="unredirect_overlays" type="bool" value="true"/>
<property name="urgent_blink" type="bool" value="false"/>
<property name="use_compositing" type="bool" value="true"/>
<property name="workspace_count" type="int" value="2"/>
<property name="wrap_cycle" type="bool" value="true"/>
<property name="wrap_layout" type="bool" value="true"/>
<property name="wrap_resistance" type="int" value="10"/>
<property name="wrap_windows" type="bool" value="true"/>
<property name="wrap_workspaces" type="bool" value="false"/>
<property name="workspace_names" type="array">
<value type="string" value="Workspace 1"/>
<value type="string" value="Workspace 2"/>
<value type="string" value="Workspace 3"/>
<value type="string" value="Workspace 4"/>
</property>
</property>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xsettings" version="1.0">
<property name="Net" type="empty">
<property name="ThemeName" type="empty"/>
<property name="IconThemeName" type="empty"/>
<property name="DoubleClickTime" type="int" value="250"/>
<property name="DoubleClickDistance" type="int" value="5"/>
<property name="DndDragThreshold" type="int" value="8"/>
<property name="CursorBlink" type="bool" value="true"/>
<property name="CursorBlinkTime" type="int" value="1200"/>
<property name="SoundThemeName" type="string" value="default"/>
<property name="EnableEventSounds" type="bool" value="false"/>
<property name="EnableInputFeedbackSounds" type="bool" value="false"/>
</property>
<property name="Xft" type="empty">
<property name="DPI" type="empty"/>
<property name="Antialias" type="int" value="-1"/>
<property name="Hinting" type="int" value="-1"/>
<property name="HintStyle" type="string" value="hintnone"/>
<property name="RGBA" type="string" value="none"/>
</property>
<property name="Gtk" type="empty">
<property name="CanChangeAccels" type="bool" value="false"/>
<property name="ColorPalette" type="string" value="black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90"/>
<property name="FontName" type="string" value="Sans 10"/>
<property name="IconSizes" type="string" value=""/>
<property name="KeyThemeName" type="string" value=""/>
<property name="ToolbarStyle" type="string" value="icons"/>
<property name="ToolbarIconSize" type="int" value="3"/>
<property name="IMPreeditStyle" type="string" value=""/>
<property name="IMStatusStyle" type="string" value=""/>
<property name="MenuImages" type="bool" value="true"/>
<property name="ButtonImages" type="bool" value="true"/>
<property name="MenuBarAccel" type="string" value="F10"/>
<property name="CursorThemeName" type="string" value=""/>
<property name="CursorThemeSize" type="int" value="0"/>
<property name="IMModule" type="string" value=""/>
</property>
</channel>
EOF
cat <<EOF > /root/.config/xfce4/menu/top10.menu
<Menu>
<Name>Top 10</Name>
<DefaultAppDirs/>
<Directory>top10.directory</Directory>
<Include>
<Category>top10</Category>
</Include>
</Menu>
EOF
#--- Get shiki-colors-light theme
curl --progress -k -L "http://xfce-look.org/CONTENT/content-files/142110-Shiki-Colors-Light-Menus.tar.gz" > /tmp/Shiki-Colors-Light-Menus.tar.gz #***!!! hardcoded path!
tar zxf /tmp/Shiki-Colors-Light-Menus.tar.gz -C /root/.themes/
xfconf-query -c xsettings -p /Net/ThemeName -s "Shiki-Colors-Light-Menus"
xfconf-query -c xsettings -p /Net/IconThemeName -s "gnome-brave"
#--- Enable compositing
xfconf-query -c xfwm4 -p /general/use_compositing -s true
#--- Fix gnome keyring issue
file=/etc/xdg/autostart/gnome-keyring-pkcs11.desktop; #[ -e "$file" ] && cp -n $file{,.bkup}
grep -q "XFCE" "$file" || sed -i 's/^OnlyShowIn=*/OnlyShowIn=XFCE;/' "$file"
#--- Disable user folders
apt-get -y -qq install xdg-user-dirs
xdg-user-dirs-update
file=/etc/xdg/user-dirs.conf; [ -e "$file" ] && cp -n $file{,.bkup}
sed -i 's/^enable=.*/enable=False/' "$file" #sed -i 's/^XDG_/#XDG_/; s/^#XDG_DESKTOP/XDG_DESKTOP/;' /root/.config/user-dirs.dirs
rm -rf /root/{Documents,Music,Pictures,Public,Templates,Videos}/
xdg-user-dirs-update
#--- Get new desktop wallpaper
mkdir -p /usr/share/wallpapers/
curl --progress -k -L "http://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_A.png" > /usr/share/wallpapers/kali_blue_3d_a.png #***!!! hardcoded paths!
curl --progress -k -L "http://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_B.png" > /usr/share/wallpapers/kali_blue_3d_b.png
curl --progress -k -L "http://www.kali.org/images/wallpapers-01/kali-wp-june-2014_1920x1080_G.png" > /usr/share/wallpapers/kali_black_honeycomb.png
curl --progress -k -L "http://imageshack.us/a/img17/4646/vzex.png" > /usr/share/wallpapers/kali_blue_splat.png
curl --progress -k -L "http://em3rgency.com/wp-content/uploads/2012/12/Kali-Linux-faded-no-Dragon-small-text.png" > /usr/share/wallpapers/kali_black_clean.png
curl --progress -k -L "http://www.hdwallpapers.im/download/kali_linux-wallpaper.jpg" > /usr/share/wallpapers/kali_black_stripes.jpg
curl --progress -k -L "http://fc01.deviantart.net/fs71/f/2011/118/e/3/bt___edb_wallpaper_by_xxdigipxx-d3f4nxv.png" > /usr/share/wallpapers/kali_bt_edb.jpg
_TMP="$(find /usr/share/wallpapers/ -maxdepth 1 -type f \( -name 'kali_*' -o -empty \) | xargs -n1 file | grep -i 'HTML\|empty' | cut -d ':' -f1)"
for FILE in $(echo $_TMP); do
rm -f "$FILE"
done
[[ -e "/usr/share/wallpapers/kali_default-1440x900.jpg" ]] && ln -sf /usr/share/wallpapers/kali/contents/images/1440x900.png /usr/share/wallpapers/kali_default-1440x900.jpg
#--- Change desktop wallpaper (single random pick - on each install). Note: For now...
wallpaper=$(shuf -n1 -e /usr/share/wallpapers/kali_*) #wallpaper=/usr/share/wallpapers/kali_blue_splat.png
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-show -s true
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "$wallpaper"
#--- Change login wallpaper
cp -f "$wallpaper" /usr/share/images/desktop-base/login-background.png