redcanaryco / invoke-atomicredteam

Invoke-AtomicRedTeam is a PowerShell module to execute tests as defined in the [atomics folder](https://github.com/redcanaryco/atomic-red-team/tree/master/atomics) of Red Canary's Atomic Red Team project.
MIT License
818 stars 194 forks source link

$session variable in Invoke-AtomicTest.ps1 is not initialized? #42

Closed ironmanstittsville closed 4 years ago

ironmanstittsville commented 4 years ago

Please forgive my noobness.

I was working on the subject file and noticed that there is a Parameter that can be passed into the function called $Session.

That variable is used 2 times in the file.

I see a variable called $session that is used 8 times in the function but is never initialized.

I think that the passed in parameter called $Session is intended to be used throughout in the function but it has been mis-spelled as $session in 8 places.

This is, of course, a very easy fix but the testing is beyond my available time.

I'm very new to Powershell so I might be missing something. Perhaps someone can confirm my finding? I would appreciate knowing that I'm not crazy. At least about this 8-D

clr2of8 commented 4 years ago

Ha ha, no worries. PowerShell is case-insentive by default so a variable $session is the same as $Session, so this is OK. Also, PowerShell is weird in another way in that variables initialized anywhere can be used throughout the session without explicitly passing them as a function parameter. Happy to discuss further on slack if you have more questions. :)