cfalta / PowerShellArmoury

A PowerShell armoury for security guys and girls
Apache License 2.0
461 stars 67 forks source link

Cant add Script #5

Closed xennn closed 3 years ago

xennn commented 3 years ago

Hello, i use your Script and add many Repos. But with some Scripts i have Problems. For example this cant be imported? https://github.com/BC-SECURITY/Invoke-ZeroLogon/blob/master/Invoke-ZeroLogon.ps1 Whats here the reason?

cfalta commented 3 years ago

Well you need to give me a hint on what the problem might be ;-) (error message or something). But a wild guess: if you just copy the sample code from config you end up with a "Branch": "dev", however this repository does not have a dev branch so it wouldn't work.

xennn commented 3 years ago

I don't get an error message. In this case, I set the GithubItem in the config. Then when I do a new New-PSArmory, the file is downloaded correctly. Get-psarmory displays the file. Then cat -raw. \ MyArmoury.ps1 | iex at this point the file does not appear to be loaded as desired. The Invoke-Zerologon command is then not available

cfalta commented 3 years ago

It seems to be an encoding issue with this specific script which uses UTF8 with BOM. I rely on the native "Invoke-RestMethod" cmdlet to download the file which parses encoding based on the response header (which is "charset=utf8" in this case), however it seems not to get the BOM correctly. Therefore the resulting script text contains an invisible character at the beginning, which in turn prevents Powershell from parsing the "function ..." statement correctly. Therefore the function cannot be loaded. I attached a screenshot to illustrate the issue.

This could probably be handled through better/manual parsing of the HTTP content but, to be honest, I'll not add this in the near future ;-). I'll keep your input on my list of future features though.

Merry Christmas!

Screenshot 2020-12-23 140128

xennn commented 3 years ago

Okay, now I have a clue, or I know how to check it. A workaround would be to correct the file and host the file yourself in a repo. It's nice that you now have this in mind in case the tool is updated. But I have to praise it, I like PSArmoury very much. Also that you can integrate Sharp applications. I also wish you a Merry Christmas!

cfalta commented 3 years ago

Thank you, thats good to hear :-) let me know if you have any other feature requests.

cfalta commented 3 years ago

Fixed with PSAmoury 1.5 - give it a try :-)