Closed gwillcox-r7 closed 3 years ago
@bwatters-r7 @smcintyre-r7 Any chance one of you would be able to take a look into landing this PR? Its not a very complex one so hopefully it shouldn't take too long to land; only bit that might take a little longer is potentially reworking the RSpec checks since I'm new to that.
I ran and verified that the unit tests pass. I also loaded this into Metasploit to ensure it wasn't going to cause any issues there as well. It looks like this will be dead code until a module or library is updated to use it but it seems reasonable enough so I'll go ahead and land it.
This is largely based off of the work of @wo4haoren's PR at https://github.com/rapid7/rex-powershell/pull/24 which I unfortunately had to close as it came from his
master
branch, however I take no credit for the work he has done so far. All this PR does is expand his work a little bit to add in support for specifying any version of PowerShell to be run, instead of just version 2.0, and also adds in an RSpec test.I have never done RSpec before though so this check may be entirely wrong. I tried to model it off of what I saw the rest of the
spec/rex/powershell/command_spec.rb
file doing but it may be completely wrong. Would appreciate input on that.For testing please verify the code looks correct and that the RSpec tests run as expected.