#!/usr/local/bin/bash # Copyright (c) 2018-2021, diyIT.org # All rights reserved. # # BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License") # https://diyit.org/license/ # # # ./kali.sh under tmux # disabled for now exit # clean cached state bhyvectl --destroy --vm=kali while true do bhyve -c 2 -m 4G -A -H -P \ -s 0,hostbridge \ -s 3,ahci-cd \ -s 4,virtio-blk,/dev/zvol/ship/raw/kali \ -s 5,virtio-net,tap86,mac=00:0A:0B:0C:0D:86 \ -s 7,virtio-net,tap4886,mac=00:0A:0B:0C:8D:86 \ -s 8,virtio-net,tap1086,mac=00:0A:0B:0C:8D:86 \ -s 9,virtio-net,tap2086,mac=00:0A:0B:0C:9D:86 \ -s 29,fbuf,tcp=0.0.0.0:5986,w=1280,h=720 \ -s 30,xhci,tablet \ -s 31,lpc -l com1,/dev/nmdm86A \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \ kali bhyve_exit=$? # bhyve returns the following status codes: # 0 - VM has been reset # 1 - VM has been powered off # 2 - VM has been halted # 3 - VM generated a triple fault # all other non-zero status codes are errors # if [ $bhyve_exit = 1 ] || [ $bhyve_exit = 2 ] then break fi echo `date` - restarting kali in 5 seconds - press ctrl-c to stop sleep 5 done exit $? #-s 3,ahci-cd,/mnt/linux/kali-linux-2020.4-installer-amd64.iso \ ##-s 6,virtio-blk,/dev/zvol/ship/raw/kali_data \ # bhyvectl --get-all --vm=kali # cu -l /dev/nmdm86B # (This uses cu() so press ~+Ctrl-D to exit) #on base system: #zfs create -V 128G -o refreservation=none ship/raw/kali ##zfs create -V 128G -o refreservation=none ship/raw/kali_data # Install VNC # curl -o turbovnc_2.2.5_amd64.deb https://sourceforge.net/projects/turbovnc/files/2.2.5/turbovnc_2.2.5_amd64.deb/download# # sudo apt install gdebi-core # sudo gdebi turbovnc_2.2.5_amd64.deb # sudo killall Xvnc; /opt/TurboVNC/bin/vncserver -name kali -geometry 1920x1080 :4 # systemctl enable ssh.service; service ssh start