-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashcat-setup-notes-for-Ubuntu-with-Windows-remoting.txt
263 lines (165 loc) · 8.2 KB
/
hashcat-setup-notes-for-Ubuntu-with-Windows-remoting.txt
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
# Hashcat setup adapted from:
https://arminreiter.com/2020/11/using-azure-vm-to-crack-passwords/
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
# PSremoting steps use
https://github.com/darkoperator/Posh-SSH
lsb_release -a
## GPU Driver installation
# GCP
From: https://cloud.google.com/compute/docs/gpus/install-drivers-gpu
curl https://raw.githubusercontent.com/GoogleCloudPlatform/compute-gpu-installation/main/linux/install_gpu_driver.py --output install_gpu_driver.py
sudo python3 install_gpu_driver.py
The script takes some time to run. It might restart your VM. If the VM restarts, run the script again to continue the installation.
Verify the installation. See Verifying the GPU driver install.
# OpenCL
sudo apt install intel-opencl-icd
# Other platforms
Check correct urls at: http://developer.download.nvidia.com/compute/cuda/repos/ for
- cuda-repo-ubuntu****_amd64.deb
- keys (exact URL will be provided by this command:
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_10.2.89-1_amd64.deb
CUDA_REPO_PKG=cuda-repo-ubuntu1604_10.2.89-1_amd64.deb
wget -O /tmp/${CUDA_REPO_PKG} http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get install cuda # HCK
sudo apt-get install cuda-drivers
sudo apt-get install nvidia-cuda-toolkit
sudo reboot
# Before moving on to hashcat, make sure GPU(s) are visible
nvidia-smi
# Output from nvidia-smi:
Tue Sep 14 14:32:38 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA Tesla K80 Off | 00000001:00:00.0 Off | 0 |
| N/A 72C P0 65W / 149W | 0MiB / 11441MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
# Install latest version of Hashcat (check https://hashcat.net/hashcat/ to get latest version number)
sudo apt-get install p7zip-full
cd /opt
HASHCAT_VER=hashcat-6.2.4
sudo wget https://hashcat.net/files/${HASHCAT_VER}.7z
sudo 7z x ${HASHCAT_VER}.7z
sudo chmod -R a+rxw ${HASHCAT_VER} # Improve this
sudo rm ${HASHCAT_VER}.7z
cd ${HASHCAT_VER}
# make a link using short name
sudo ln -s hashcat.bin hashcat
# Chec for GPU recognition
sudo ./hashcat.bin -I
hashcat (v6.2.4) starting in backend information mode
CUDA Info:
==========
CUDA.Version.: 11.3
Backend Device ID #1
Name...........: NVIDIA Tesla K80
Processor(s)...: 13
Clock..........: 823
Memory.Total...: 11441 MB
Memory.Free....: 11382 MB
PCI.Addr.BDFe..: 0001:00:00.0
OpenCL Info:
============
OpenCL Platform ID #1
Vendor..: NVIDIA Corporation
Name....: NVIDIA CUDA
Version.: OpenCL 3.0 CUDA 11.3.55
Backend Device ID #2
Type...........: GPU
Vendor.ID......: 32
Vendor.........: NVIDIA Corporation
Name...........: NVIDIA Tesla K80
Version........: OpenCL 3.0 CUDA
Processor(s)...: 13
Clock..........: 823
Memory.Total...: 11441 MB (limited to 2860 MB allocatable in one block)
Memory.Free....: 11328 MB
OpenCL.Version.: OpenCL C 1.2
Driver.Version.: 465.19.01
PCI.Addr.BDF...: 00:00.0
# benchmark on NTLM
# grant write perms so that the .pid, .induct and other temp files can be written without sudo (assuming we have stopped with the a+rxw perms from above)
## make more elegant!!!
#sudo chmod -R 757 /opt/${HASHCAT_VER}/
sudo chmod -R a+r /opt/${HASHCAT_VER}/
sudo touch show.log
sudo chmod a+rw show.log
sudo touch benchmark.pid
sudo chmod a+rwx benchmark.pid
mkdir wordlists
cd wordlists
wget http://thehackerplaybook.com/get.php?type=THP-password -O list
7z x list
rm list
cd ..
mkdir rules
cd rules
wget https://raw.githubusercontent.com/NotSoSecure/password_cracking_rules/master/OneRuleToRuleThemAll.rule
cd ..
# Drop a file with a test hash at x.txt
vi ~/in.txt
./hashcat -m 1000 -O --outfile ~/out.txt -r rules/OneRuleToRuleThemAll.rule ~/in.txt wordlists/40GB_CleanUpFile.txt
# in another SSH session, check performance/usage of the GPU
nvidia-smi
Thu Nov 4 14:17:07 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.29.05 Driver Version: 495.29.05 CUDA Version: 11.5 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla P100-PCIE... On | 00000000:00:04.0 Off | 0 |
| N/A 73C P0 160W / 250W | 5899MiB / 16280MiB | 97% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 34753 C ./hashcat 5897MiB |
+-----------------------------------------------------------------------------+
# When the test run completes (and the potfile and other temp files have been created) grant access to non-admin users.
ls /opt/${HASHCAT_VER}/hashcat.*
sudo chmod a+rx /opt/${HASHCAT_VER}/kernels/*
sudo chmod a+rw /opt/${HASHCAT_VER}/hashcat.log
sudo chmod a+rw /opt/${HASHCAT_VER}/hashcat.potfile
sudo chmod a+rw /opt/${HASHCAT_VER}/hashcat.dictstat2
# Remoting setup - ON WINDOWS JOB HOST
# On Windows client
# Install OpenSSH
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH.Client*'} | Add-WindowsCapability -Online
- OR -
See DISM batch file in this folder
Make sure ssh.exe is in your path.
c:\Windows\System32\OpenSSH\ssh.exe
# on Ubuntu server (using direct download method)
https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1#installation-via-direct-download---ubuntu-1604
sudo wget https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell_7.1.4-1.ubuntu.16.04_amd64.deb
sudo dpkg -i powershell_7.1.4-1.ubuntu.16.04_amd64.deb
# Ignore dependency errors from above ^^. Next command resolves
sudo apt-get install -f
# Add the following (commented) line to the sshd config (near SFTP line)
# Subsystem powershell /usr/bin/pwsh -sshs -NoLogo
sudo vi /etc/ssh/sshd_config
sudo systemctl restart sshd.
# Test from client
$SessionParams = @{SSHTransport = $true; UserName = "$env:USERNAME@$env:USERDNSDOMAIN"; HostName = "SRV1"; }