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

Can't seem to get it to work #1

Closed dududuarte closed 6 years ago

dududuarte commented 6 years ago

I embeded "shutdown -s -t 0" into a .jpeg and output into .png But when i open the .png nothing executes

DeeLMind commented 6 years ago

So do I

legit4n6 commented 6 years ago

I am unable to get it to even produce the output png file. <<-- I got it to embed the script, I just didn't do it right the first time... it was late :)

lfcow commented 6 years ago

The issue I had was "Index was outside the bounds of the array"

I solved this by using a larger input file.

Castaldio86 commented 6 years ago

+1

tried it in jpg and png files between 500KB and 25MB

And a .ps1 containing

& "C:\Windows\System32\calc.exe"

maysam-h commented 6 years ago

everytime I run the outliner, I get this issue. I double check this command, but all the brackets has a closing. any help please, thanks in advance.

image

tasox commented 6 years ago

I had the same problem with @maysam-h

I found how to fix "missing closing }" error. You have to put in the end of your script function ";" NOT only in the one line script by PSImage.

For Example:

function CheckWinRM([string]$ip) {

Test-WSMan -ComputerName $ip

};

maysam-h commented 6 years ago

@tasox thanks for the tip. But it does not work for me. I even updated to make sure I have the updates after the last commit. Here is a screenshot of the commands I invoke. is there anything I am missing please? Thanks in advance.

image

tasox commented 6 years ago

@maysam-h in your batchfile.ps1 you have some functions right? Try in the end of every function to put ";"

For Example:

function test { };

But now you have a different error from previous. Please check very carefully your "batchfile.ps1" and find somewhere in your code "&" character because this character produce this error.

maysam-h commented 6 years ago

@tasox It seems to be strange because my batch file does not have a function or '&'. Here is a contents of my batch file.

`echo off ::creating some test fodlers

mkdir ali-here mkdir ali-here2 mkdir ali-here3 exit`

I assume its the oneliner because the error says "At Line:1 char:309" which is exactly the bracket after "IEX".

peewpw commented 6 years ago

These all look like errors in the source scripts. Please open a new issue if you cannot generate a one-liner for a working script.

closing.