Tuesday, September 18, 2012

Powershell non alpha numeric


Powershell


To finish my trip through the world of non alpha numeric code I tried to make a non alpha numeric Python or non alpha numeric Batch script but I wasn't able to do so.

So I switched to Powershell and I have to say, it was too easy.
Here's the short script to execute an ls (just copy&paste it into a open powershell):

$___++;++$___;
_;
$__="$?";
&($__[$___++]+$__[$___++])


The short explanation:


$___++;++$___; # Like in bash, it creats a variable with the number 1, then increase it to 2
_; #make an error
$__="$?"; # In $? is the return code of the command before, saved as true or false. This gets casted to an string
&($__[$___++]+$__[$___++]) # & is like eval, execute a string as command. Now we access the l and the s in false and heres the ls


I didn't have a look how to make other commands, but I think it would be possible.

Have a nice day