Skip to content

Instantly share code, notes, and snippets.

@natesubra
Created June 6, 2023 03:55
Show Gist options
  • Save natesubra/5617121d64bb4a8885dc2f291f2804d4 to your computer and use it in GitHub Desktop.
Save natesubra/5617121d64bb4a8885dc2f291f2804d4 to your computer and use it in GitHub Desktop.
Quick powershell port of inflate.py
#Requires -Version 5.0
# Credit: https://github.com/njcve/inflate.py
param(
[Parameter(Mandatory = $true)]
[string] $InputFile,
[Parameter(Mandatory = $true)]
[string] $OutputFile,
[Parameter(Mandatory = $true)]
[int] $InflateSize = 100
)
$bytesToAppend = $InflateSize * 1024 * 1024
$padding = New-Object byte[] $bytesToAppend
try {
Copy-Item -Path $inputFile -Destination $OutputFile -Force
$mode = [System.IO.FileMode]::Append
$stream = [System.IO.File]::Open($OutputFile, $mode)
$bw = [System.IO.BinaryWriter]::new($stream)
$bw.Write($padding)
$bw.Flush()
$bw.Dispose()
$stream.Dispose()
} catch {
Write-Error $_.Exception.Message
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment