-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The PowerShell Problem #5
Comments
You could add support for Use-RawPipeline in the meantime. |
Hey @ImportTaste, the way I understand |
Doing some extremely simple tests with
There are also cmdlets to read raw binary streams from file, and dump them again back to file. PS> run emit M7EwMzVzBkI3IwNTczM3cyMg2wQA | run b64 | run zl | run hex | 2ps
Hello World
PS> run emit "Once upon a time, at the foot of a great mountain ..." | run aes "pbkdf2[32,s4lty]:swordfish" --iv md5:X -R | run ccp md5:X | run aes "pbkdf2[32,s4lty]:swordfish" --iv cut:0:16 | 2ps
Once upon a time, at the foot of a great mountain ...
PS> run emit .\CyberChef_v9.32.3.zip | run xtzip "["| run dump "cyberchef_extracted/{path}" "]" | 2ps
PS> Get-ChildItem .\cyberchef_extracted\ -Name
assets
images
modules
ChefWorker.js.LICENSE.txt
CyberChef_v9.32.3.html
DishWorker.js.LICENSE.txt
InputWorker.js.LICENSE.txt
LoaderWorker.js.LICENSE.txt
ZipWorker.js.LICENSE.txt Of course, certain characters which Powershell uses as part of its shell language, such as BTW, I think that my tests above bypass your PowerShell check in > emit M7EwMzVzBkI3IwNTczM3cyMg2wQA | b64 | zl | hex
(00:18:30) failure in zl: exception of type ValueError; could not detect any zlib stream. |
Alright. Still not sure how to handle this in the most graceful manner. I can fix As a side note, when I work with all-text input/output, I don't always have to quote
|
Yes, I don't think there's any way for binref units to inspect their environment in such a way that they can tell when they are being run under Another way to handle this would be to display a very prominent warning as a post-install step on Windows systems spelling out the issues with piping binary data in Powershell, and either listing the workarounds (use |
Also, Powershell versions after 6 are now available on Mac and Linux, and officially supported. I think the number of people who actually use it as their day-to-day interactive shell on those platforms is extremely small, though, and the people who are doing that likely know the limitations. |
It's easy enough to tell if the module is loaded through Get-Module. If it is loaded, it just needs to run different commands. |
I don't think there is any way to run Right now I am leaning heavily towards treating a PowerShell parent process as a critical error, i.e. abort execution with a short explanation of why that is currently not supported. There are just too many ways this can go wrong unless our band-aid is completely flawless, and I am not confident I can make it so. |
Alright, I had another idea about a better band-aid yesterday, and implemented it in 03436e2. This works a lot better now, and there is a warning displayed by default which can be disabled through an environment variable: |
Oh yes, I like that! Not sure why I had not thought of that before.. 😅 |
This was implemented in 504f015. I have changed the names of the variables a bit and added information to the warning message:
I will push out a new release now. |
There is a PR open in PowerShell that would (hopefully) fix this: PowerShell/PowerShell#17857 |
Alright! The PR that fixes this in PowerShell has been merged, the next PowerShell preview should support this. I am very excited to try that out. |
Noting from PowerShell/PowerShell#1908 (comment) that the following command will be required to enable this experimental PowerShell feature:
|
In PowerShell 7.4.0-preview.4, refinery now works as expected after running:
Since it will probably be quite a while before this is in an mainstream PowerShell release, I'm afraid we have to keep this issue open - but at least there is now a way to make it work inside some version of PowerShell. |
Alright, this is now fully supported in PowerShell 7.4. 351e953 adds somewhat hacky code to support this, but I do consider the issue closed at this point since refinery can now work in PowerShell simply by installing the latest version. |
In fcc36d8, I added some extremely weak PowerShell support, this was improved slightly in 504f015. The main issues are the following:
Our current workaround is to:
If either of the above two PowerShell issues are ever resolved in a way that supports the binary refinery design, the workaround should be removed because it introduces an unnecessary encoding step.
The text was updated successfully, but these errors were encountered: