Guest User

FW16 dGPU setup for Kali Live USB

a guest
Aug 19th, 2024
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.72 KB | Cybersecurity | 0 0
  1. #!/bin/bash
  2.  
  3. ssid=your-wifi-network
  4. password=your-wifi-password
  5.  
  6. amdgpu=amdgpu-install_6.1.60103-1_all.deb
  7. amdurl=https://repo.radeon.com/amdgpu-install/6.1.3/ubuntu/jammy/
  8. downfold=/home/kali/Downloads/
  9. amdfold=/home/kali/Downloads/amd-package/
  10. runscript=/media/kali/8480B72A80B7221A/hashcat/run.bs
  11.  
  12.  
  13. ### Check for internet
  14. wget -q --spider http://repo.radeon.com
  15. if [ $? -eq 0 ]; then
  16.     printf "Connected to Radeon Repo, proceeding...\n"
  17. else
  18.     printf "Failed to connected to Radeon Repo, attempting wifi connection."
  19.    
  20.     sudo nmcli dev wifi connect "$ssid" password "$password"
  21.  
  22.     wget -q --spider http://repo.radeon.com
  23.     if [ $? -eq 0 ]; then
  24.         printf "Connected to Radeon Repo, proceeding...\n"
  25.     else
  26.         printf "Wifi connection failed, check connectivity."
  27.         exit
  28.     fi
  29. fi
  30.  
  31.  
  32. ### Update the sources list
  33. printf "\nAdding radeon apt repositories.\n"
  34. sudo sed -i '/radeon/d' /etc/apt/sources.list
  35. echo "deb [trusted=yes] https://repo.radeon.com/amdgpu/6.1.2/ubuntu jammy main" | sudo tee -a /etc/apt/sources.list
  36. echo "deb [trusted=yes] https://repo.radeon.com/rocm/apt/6.1.2 jammy main" | sudo tee -a /etc/apt/sources.list
  37. sudo apt update
  38.  
  39.  
  40. ### Get the amd gpu drivers
  41. if test -f ${downfold}${amdgpu}; then
  42.   printf "\nDrivers have already been downloading, removing the existing download\n"
  43.   rm ${downfold}${amdgpu}
  44. fi
  45.  
  46. printf "\nDownloading the amdgpu drivers\n"
  47. wget --directory-prefix=${downfold} ${amdurl}${amdgpu}
  48.  
  49.  
  50. ### Unpack the deb file
  51. if test -d ${amdfold}; then
  52.   printf "\nUnpackaged .deb folder already exists, removing the existing one\n"
  53.   rm -rf ${amdfold}
  54. fi
  55.  
  56. printf "\nUnpacking the amd .deb file to modify it\n"
  57. dpkg -x ${downfold}${amdgpu} ${amdfold}
  58.  
  59.  
  60. ### Modify the install script to support kali
  61. printf "\nModifying the amdgpu-install script to allow an install on kali\n"
  62. find ${amdfold}usr/bin/amdgpu-install -type f -exec sed -i 's/ubuntu|linuxmint|debian/ubuntu|linuxmint|debian|kali/g' {} \;
  63.  
  64. ### Prompt user and run install script
  65. printf "\nAbout to installing the amdgpu drivers, READ THIS:\n"
  66. printf "During the install, you will be prompted twice to restart some services, unselect the udisks2.service\n"
  67. read -p "Do you understand? [y]" -n 1 -r
  68. printf "\n"
  69. if [[ $REPLY =~ ^[Yy]$ ]]
  70. then
  71.    sudo $amdfold/usr/bin/amdgpu-install --usecase=opencl --no-dkms
  72.    
  73.    sudo apt install radeontop
  74. fi
  75.  
  76. ### Optionally, trigger script to start hashing job
  77. printf "\nTip: hashcat needs to be run as sudo to access the GPU\n"
  78. printf "     Run radeontop in another terminal to confirm GPU is being utilized\n"
  79. read -p "Would you like to proceed with hashing? [y]" -n 1 -r
  80. printf "\n"
  81. if [[ $REPLY =~ ^[Yy]$ ]]
  82. then
  83.    ${runscript}
  84. fi
  85.  
  86.  
  87.  
  88.  
Advertisement
Add Comment
Please, Sign In to add comment