rapid7 / metasploitable3

Metasploitable3 is a VM that is built from the ground up with a large amount of security vulnerabilities.
Other
4.78k stars 1.15k forks source link

[install_openjdk6.bat] download error #532

Open zwq871482439 opened 3 years ago

zwq871482439 commented 3 years ago

Issue Description

the error message is "Unable to connect to the remote server", but I tried to download the file from the VM with the link https://github.com/downloads/alexkasko/openjdk-unofficial-builds/openjdk-1.6.0-unofficial-b27-windows-amd64.zip, and the browser can access and download the file, so I'm confused with why the script has that error.

Host System

Command Output

vmware-iso: C:\Users\vagrant>attrib -r +s C:\wamp\www\wordpress ==> vmware-iso: Provisioning with shell script: D:\0000_VM_iso\metasploitable3-master\packer\templates/../../scripts/installs/install_openjdk6.bat vmware-iso: vmware-iso: C:\Users\vagrant>powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://github.com/downloads/alexkasko/openjdk-unofficial-builds/openjdk-1.6.0-unofficial-b27-windows-amd64.zip', 'C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip')" 0<NUL ==> vmware-iso: Exception calling "DownloadFile" with "2" argument(s): "Unable to connect to ==> vmware-iso: the remote server" ==> vmware-iso: At line:1 char:96 ==> vmware-iso: + ... pe]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://g ... ==> vmware-iso: + ~~~~~~~~~~~~~ ==> vmware-iso: + CategoryInfo : NotSpecified: (:) [], MethodInvocationException ==> vmware-iso: + FullyQualifiedErrorId : WebException ==> vmware-iso: ==> vmware-iso: ==> vmware-iso: ERROR: The system cannot find the file specified. ==> vmware-iso: C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip ==> vmware-iso: vmware-iso: vmware-iso: C:\Users\vagrant>cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip" -oC:\openjdk6" ==> vmware-iso: vmware-iso: ==> vmware-iso: ==> vmware-iso: System ERROR: ==> vmware-iso: The system cannot find the file specified. vmware-iso: 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 vmware-iso: vmware-iso: Scanning the drive for archives: ==> vmware-iso: Provisioning step had errors: Running the cleanup provisioner, if present... ==> vmware-iso: Stopping virtual machine... ==> vmware-iso: Deleting output directory... Build 'vmware-iso' errored after 33 minutes 49 seconds: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Wait completed after 33 minutes 49 seconds

==> Some builds didn't complete successfully and had errors: --> vmware-iso: Script exited with non-zero exit status: 2.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

parzival0037 commented 1 year ago

I faced a similar issue with the batch file.

Update install_openjdk6.bat due to deprecated url & jdk6 to jdk7. The vagrant .\build1.ps1 script fails due to this install_openjdk6.bat script failing. The file was not updated in the past 5 years and the jdk repo URL has changed by alexkasko Link to repo: https://github.com/alexkasko/openjdk-unofficial-builds/.

The file itself is present on bitbucket itself now. Link to the latest repo: https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-windows-amd64-installer.zip

Fixed the batch script to latest url. The script dosen't fail now.

Update the install_openjdk6.bat file with this script. Present in C:\dir_to_metasploit_dir\metasploitable3-master\scripts\installs

powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-windows-amd64-installer.zip', 'C:\Windows\Temp\openjdk-1.7.0-u80-unofficial-windows-amd64-installer.zip')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\openjdk-1.7.0-u80-unofficial-windows-amd64-installer.zip" -oC:\openjdk7"

Error message:


C:\Users\someuser\OneDrive - College\Desktop\NETS>powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://github.com/downloads/alexkasko/openjdk-unofficial-builds/openjdk-1.6.0-unofficial-b27-windows-amd64.zip', 'C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip')"   0<NUL
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (502) Bad Gateway."
At line:1 char:96
+ ... pe]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://g ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

C:\Users\someuser\OneDrive - College\Desktop\NETS>cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip" -oC:\openjdk6"

7-Zip 21.02 alpha (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-05-06

Scanning the drive for archives:

ERROR: Access is denied.
C:\Windows\Temp\openjdk-1.6.0-unofficial-b27-windows-amd64.zip
parzival0037 commented 1 year ago

Posted pull request #595