Skip to content

Commit

Permalink
Merge pull request #1254 from d35ha/fix-7zip-empty-output
Browse files Browse the repository at this point in the history
Fix 7z wrong password empty output
  • Loading branch information
Ana06 authored Feb 6, 2025
2 parents 3254380 + ccf0b91 commit ceea06e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 92 deletions.
12 changes: 0 additions & 12 deletions packages/7zip-15-05.vm/7zip-15-05.vm.nuspec

This file was deleted.

16 changes: 0 additions & 16 deletions packages/7zip-15-05.vm/tools/chocolateyuninstall.ps1

This file was deleted.

12 changes: 0 additions & 12 deletions packages/7zip-nsis.vm/7zip-nsis.vm.nuspec

This file was deleted.

42 changes: 0 additions & 42 deletions packages/7zip-nsis.vm/tools/chocolateyinstall.ps1

This file was deleted.

9 changes: 4 additions & 5 deletions packages/7zip.vm/7zip.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>7zip.vm</id>
<version>0.0.0.20240425</version>
<description>Metapackage for 7zip to ensure all packages use the same 7zip version.</description>
<authors>Mandiant</authors>
<version>23.01.0.20250206</version>
<authors>myfreeer</authors>
<description>7-zip build with nsis script decompiling</description>
<dependencies>
<dependency id="common.vm" version="0.0.0.20240425"/>
<dependency id="7zip-nsis.vm" />
<dependency id="common.vm" version="0.0.0.20240425" />
</dependencies>
</metadata>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ try {
$toolName = '7z'
$category = 'Productivity Tools'

$url = 'https://sourceforge.net/projects/sevenzip/files/7-Zip/15.05/7z1505.exe/download'
$checksum = 'fa99d29283d9a6c501b70d2755cd06cf5bc3dd8e48acc73926b6e0f389885120'
$url64 = 'https://sourceforge.net/projects/sevenzip/files/7-Zip/15.05/7z1505-x64.exe/download'
$checksum64 = '6abaf04e44c87bd109df7485eb67a2d69a2e3e6e6deb9df59e5e707176c69449'
$url = 'https://github.com/myfreeer/7z-build-nsis/releases/download/23.01/7z2301-x86.exe'
$checksum = '7b1d50073e6d3631267f2bbb986fb1faffddc5fc72d6bc23e10b5920a6f365b4'
$url64 = 'https://github.com/myfreeer/7z-build-nsis/releases/download/23.01/7z2301-x64.exe'
$checksum64 = 'b7f1d8360d988808447f9af3989db7665dfec72bac83c8b6467cc35f8fe718ff'

$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
Expand All @@ -30,11 +30,20 @@ try {
$executablePath = Join-Path $toolDir "${toolName}FM.exe" -Resolve
VM-Install-Shortcut $toolName $category $executablePath

# Test integrity of the archive (which also check that the password is correct) before extraction.
$7zCommand = @'
cmd /c (7z t -pinfected "%1" || (
cmd /c start mshta vbscript:Execute^(
"msgbox ""The password is not 'infected' or the archive is corrupted!!"", vbOKOnly, ""7z Error"":close"
^) && call
)) && 7z x -pinfected "%1"
'@ -replace "`t", "" -replace "`n", ""

# Add 7z unzip with password "infected" to the right menu for the most common extensions.
# 7z can unzip other file extensions like .docx but these don't likely use the infected password.
$extensions = @(".7z", ".bzip2", ".gzip", ".tar", ".wim", ".xz", ".txz", ".zip", ".rar")
foreach ($extension in $extensions) {
VM-Add-To-Right-Click-Menu $toolName 'unzip "infected"' "`"$7zExecutablePath`" x -pinfected `"%1`"" "$executablePath" -extension $extension
VM-Add-To-Right-Click-Menu $toolName 'unzip "infected"' $7zCommand $executablePath -extension $extension
VM-Set-Open-With-Association $executablePath $extension
}
} catch {
Expand Down

0 comments on commit ceea06e

Please sign in to comment.