mandiant / commando-vm

Complete Mandiant Offensive VM (Commando VM), a fully customizable Windows-based pentesting virtual machine distribution. commandovm@mandiant.com
https://www.mandiant.com/resources/blog/commando-vm-windows-offensive-distribution
Apache License 2.0
6.88k stars 1.28k forks source link

BUG Install ruby.devkit2 #259

Closed kutroc31 closed 3 years ago

kutroc31 commented 3 years ago

Request install ruby.devkit2 https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe and respone Forbidden! Can't install it!

GeneralBison commented 3 years ago

The bintray repo no longer exists, you can find the same files elsewhere. I solved the issue by cloning the ruby2.devkit repo locally and changing the URL of the binary. Forked it here: https://github.com/GeneralBison/chocolatey-packages

kutroc31 commented 3 years ago

Many thanks. I got it

cryptic-hunter commented 3 years ago

Can someone explain in a bit more detail about how the issue was solved? Can't understand the fix.

GeneralBison commented 3 years ago

Can someone explain in a bit more detail about how the issue was solved? Can't understand the fix.

The binaries for the ruby2.devkit package are no longer available at the link listed in ferventcoder's repo. I've forked the repo and corrected the link so you can either point chocolatey at the repo, download the nuspec file locally or fork the repo yourself if you don't trust mine

https://github.com/GeneralBison/chocolatey-packages/commit/8e1cbf67ae1618e80498e5bfd9d54095c2dc4000

s1nglethr3ad commented 3 years ago

@GeneralBison, I still cannot get this to work. I changed the file to your fix and chocolatey still reaches out to dl.bintray.

GeneralBison commented 3 years ago

You might have to clear the cache. You can also check the choco logs to figure out where it's getting the bintray url from.

s1nglethr3ad commented 3 years ago

@GeneralBison, I tried your recommendation, something is overwriting the .ps1 and nuspec file back to the original location which is weird. Below is the log output.

`021-06-15 15:20:05,838 3964 [DEBUG] - ---------------------------Script Execution--------------------------- 2021-06-15 15:20:05,838 3964 [DEBUG] - Running 'ChocolateyScriptRunner' for ruby2.devkit v4.7.2.2013022403 with packageScript 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1', packageFolder:'C:\ProgramData\chocolatey\lib\ruby2.devkit', installArguments: '', packageParameters: '', 2021-06-15 15:20:05,838 3964 [DEBUG] - Running 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1' 2021-06-15 15:20:05,885 3964 [DEBUG] - Running Get-BinRoot 2021-06-15 15:20:05,885 3964 [INFO ] - Get-BinRoot is going to be deprecated in v1 and removed in v2. It has been replaced with Get-ToolsLocation (starting with v0.9.10), however many packages no longer require a special separate directory since package folders no longer have versions on them. Some do though and should continue to use Get-ToolsLocation. 2021-06-15 15:20:05,900 3964 [DEBUG] - Running Get-PackageParameters 2021-06-15 15:20:05,900 3964 [DEBUG] - Parsing $env:ChocolateyPackageParameters and $env:ChocolateyPackageParametersSensitive for parameters 2021-06-15 15:20:05,900 3964 [INFO ] - Chocolatey is installing DevKit to C:\Tools\DevKit2 2021-06-15 15:20:05,916 3964 [INFO ] - Please wait... 2021-06-15 15:20:08,948 3964 [DEBUG] - Running Get-ChocolateyWebFile -url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe' -url64bit 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' -checksum '9383f12958aafc425923e322460a84de' -checksum64 'ce99d873c1acc8bffc639bd4e764b849' -checksumType 'md5' -packageName 'ruby2.devkit' -fileFullPath 'C:\Users\S1NGLE~1\AppData\Local\Temp\chocolatey\ruby.devkit\ruby.devkitInstall.exe' 2021-06-15 15:20:08,948 3964 [DEBUG] - Running Get-ProcessorBits -compare '64' 2021-06-15 15:20:08,963 3964 [DEBUG] - CPU is 64 bit 2021-06-15 15:20:08,963 3964 [DEBUG] - Setting url to 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' and bitPackage to 64 2021-06-15 15:20:08,979 3964 [DEBUG] - Running Get-WebHeaders -url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' -ErrorAction 'Stop' 2021-06-15 15:20:09,010 3964 [DEBUG] - Setting the UserAgent to 'chocolatey command line' 2021-06-15 15:20:09,025 3964 [DEBUG] - Request Headers: 2021-06-15 15:20:09,025 3964 [DEBUG] - 'Accept':'/' 2021-06-15 15:20:09,025 3964 [DEBUG] - 'User-Agent':'chocolatey command line' 2021-06-15 15:20:10,448 3964 [INFO ] - Attempt to get headers for https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe failed. The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden." 2021-06-15 15:20:10,448 3964 [INFO ] - Downloading ruby2.devkit 64 bit from 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' 2021-06-15 15:20:10,463 3964 [DEBUG] - Running Get-WebFile -url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' -fileName 'C:\Users\S1NGLE~1\AppData\Local\Temp\chocolatey\ruby.devkit\ruby.devkitInstall.exe' -options 'System.Collections.Hashtable' 2021-06-15 15:20:10,479 3964 [DEBUG] - Setting request timeout to 30000 2021-06-15 15:20:10,479 3964 [DEBUG] - Setting read/write timeout to 2700000 2021-06-15 15:20:10,479 3964 [DEBUG] - Setting the UserAgent to 'chocolatey command line' 2021-06-15 15:20:12,886 3964 [DEBUG] - Running Write-ChocolateyFailure -packageName 'ruby2.devkit' -failureMessage 'The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden."' 2021-06-15 15:20:12,886 3964 [WARN ] - WARNING: Write-ChocolateyFailure is deprecated and will be removed in v2. If you are the package maintainer, please use 'throw $_.Exception' instead. 2021-06-15 15:20:12,901 3964 [ERROR] - ERROR: The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden." 2021-06-15 15:20:12,901 3964 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '404'. 2021-06-15 15:20:12,901 3964 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a'] 2021-06-15 15:20:12,948 3964 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116' 2021-06-15 15:20:13,011 3964 [DEBUG] - Capturing package files in 'C:\ProgramData\chocolatey\lib\ruby2.devkit' 2021-06-15 15:20:13,011 3964 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\ruby2.devkit\ruby2.devkit.nupkg' with checksum '58E54F46B805097C3C32B28DFCABD39F' 2021-06-15 15:20:13,011 3964 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\ruby2.devkit\ruby2.devkit.nuspec' with checksum 'F41ED1ADF7F6DDB7D21F8DEDC52982C3' 2021-06-15 15:20:13,011 3964 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1' with checksum '713BFF62B54D67E5FCB11CEDD767720C' 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\ruby2.devkit.4.7.2.2013022403.arguments". 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\ruby2.devkit.4.7.2.2013022403.extra". 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\ruby2.devkit.4.7.2.2013022403.version". 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\ruby2.devkit.4.7.2.2013022403.sxs". 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey.chocolatey\ruby2.devkit.4.7.2.2013022403.pin". 2021-06-15 15:20:13,026 3964 [DEBUG] - Attempting to delete directory "C:\ProgramData\chocolatey\lib-bad\ruby2.devkit". 2021-06-15 15:20:13,026 3964 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers... 2021-06-15 15:20:13,026 3964 [ERROR] - The install of ruby2.devkit was NOT successful. 2021-06-15 15:20:13,041 3964 [ERROR] - Error while running 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1'. See log for details. 2021-06-15 15:20:13,041 3964 [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\ruby2.devkit' to 'C:\ProgramData\chocolatey\lib-bad\ruby2.devkit' 2021-06-15 15:20:15,055 3964 [DEBUG] - Attempting to delete file "C:\Users\s1nglethr3ad\AppData\Local\NuGet\Cache\ruby2.devkit.4.7.2.2013022403.nupkg". 2021-06-15 15:20:15,055 3964 [WARN ] - Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). 2021-06-15 15:20:15,070 3964 [INFO ] - 2021-06-15 15:20:15,070 3964 [ERROR] - Failures 2021-06-15 15:20:15,070 3964 [ERROR] - - ruby2.devkit (exited 404) - Error while running 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1'. See log for details. 2021-06-15 15:20:15,070 3964 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers... 2021-06-15 15:20:15,085 3964 [DEBUG] - Exiting with 404

GeneralBison commented 3 years ago

How are you trying to install it? It looks like it's just using the default repo, it's got to be getting the bintray link from somewhere

s1nglethr3ad commented 3 years ago

@GeneralBison

I tried choco install ruby2.devkit and by re-running the install.ps1 script for finishing install for commando vm. Both error out the same way.

GeneralBison commented 3 years ago

Download the package manually and point choco install at the local nuspec

s1nglethr3ad commented 3 years ago

I'll give that a try, thank you for the help!

s1nglethr3ad commented 3 years ago

@GeneralBison, worked, thank you!