Skip to content

Commit

Permalink
🤖 Add hashcat.vm (#585)
Browse files Browse the repository at this point in the history
* Add hashcat.vm

Closes #584.

* add hashcat

* fixed vars. Combined values for cleaner path usage

* fixed installation issue. Set consoleApp true

* added 7zip dependency for install process

* removing the success failure json

* Fixed 7zip executable call and fixed working directory

* added logic to stop the install if no intel processor is detected

* Fixed 7zip executable again

* removed nested unnecessary try/catch. Using CIM instead of wmi

---------

Co-authored-by: Menn1s <[email protected]>
  • Loading branch information
vm-packages and Menn1s authored Jul 14, 2023
1 parent 968f075 commit cdf76f9
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/hashcat.vm/hashcat.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>hashcat.vm</id>
<version>6.2.6</version>
<authors>Jens Steube (jsteube)</authors>
<description>Hashcat is a fast password recovery utility.</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="7zip-15-05.vm"/>
</dependencies>
</metadata>
</package>
47 changes: 47 additions & 0 deletions packages/hashcat.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking


$toolName = 'hashcat'
$category = 'Credential Access'

$zipUrl = 'https://github.com/hashcat/hashcat/releases/download/v6.2.6/hashcat-6.2.6.7z'
$zipSha256 = '96697e9ef6a795d45863c91d61be85a9f138596e3151e7c2cd63ccf48aaa8783'
$zipName = 'hashcat-6.2.6'
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} "$toolName"
$workingDir = Join-Path "$toolDir" "$zipname"

try {

# Get the processor information
$processor = Get-CimInstance Win32_Processor


# Check if the manufacturer is Intel
if ($processor.Manufacturer -eq "GenuineIntel") {
Write-Output "Intel processor detected for hashcat."
} else {
Write-Output "Non-Intel processor detected. Hashcat will not work"
throw "Non-Intel processor detected."
}


# Download the zip file
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
url = $zipUrl
checksum = $zipSha256
checksumType = "sha256"
fileFullPath = Join-Path "${Env:USERPROFILE}\AppData\Local\Temp" ("$zipName.7z")
}
Get-ChocolateyWebFile @packageArgs
$zipPath = $packageArgs.fileFullPath
VM-Assert-Path $zipPath

7zip x $zipPath -o"$toolDir" -y
# Create a shortcut
$executablePath = Join-Path "$workingDir" "$toolName.exe" -Resolve
VM-Install-Shortcut $toolName $category $executablePath -consoleApp $true -executableDir $workingDir
} catch {
VM-Write-Log-Exception $_
}
7 changes: 7 additions & 0 deletions packages/hashcat.vm/tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$ErrorActionPreference = 'Continue'
Import-Module vm.common -Force -DisableNameChecking

$toolName = 'hashcat'
$category = 'Credential Access'

VM-Uninstall $toolName $category

0 comments on commit cdf76f9

Please sign in to comment.