ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
199 stars 153 forks source link

character 'a' is only converting into ******** (8 asterisks) in the stdout #468

Closed abhinavniet closed 1 year ago

abhinavniet commented 1 year ago
SUMMARY

I am trying to install Carbon Black agent using 'psexec' module on few windows servers. I am seeing some peculiar behavior in the Ansible stdout section. All the 'a' characters are converting into **** (8 asterisks) in the stdout. Systems affected: Windows 2012 r2 Datacenter and Windows 10 Enterprise.

And, I have observed that these two above systems are only showing this behavior, otherwise rest of other servers like Windows 2008 r2, Windows 10 pro, Windows 2012 r2 Standard, Windows 2016 Standard, Windows 2019 Standard, etc are working fine as expected. Below is a snippet that shows correct form of output for the just mentioned servers: General Info: Sensor Version[3.8.0.535] Local Scanner Version[] Disk Filter Version[Unknown] CbShared[] Policy[] FileAnalysis[] Proto[] Sensor State[Enabled]

I am not sure why Ansible interpreting the output like that and really need some help on this. If anyone has faced this or they have any idea or information on this part, please share with me. Thank you in advance!

ISSUE TYPE
COMPONENT NAME

module: psexec task: to retrieve the status of the security agent

ANSIBLE VERSION
2.9
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT

Target OS type and version: Windows 2012 R2 Datacenter 64 bit Windows 10 Enterprise 64 bit

STEPS TO REPRODUCE

run the below powershell command using psexec module: cd 'c:\Program Files\Confer' .\RepCLI.exe status

or may be try to run any other command and retrieve the output from the above mentioned affected servers.

cd 'c:\Program Files\Confer'
.\RepCLI.exe status
EXPECTED RESULTS

Below is a snippet that shows correct form of output and it was expected: General Info: Sensor Version[3.8.0.535] Local Scanner Version[] Disk Filter Version[Unknown] CbShared[] Policy[] FileAnalysis[] Proto[] Sensor State[Enabled]

ACTUAL RESULTS

after executing command using psexec module, then in the stdout, all the occurrence of character 'a' converted into **** (8 asterisks). Below is the snippet of the output (stdout) that is not coming as expected:

Gener********l Info:
    Sensor Version[3.8.0.535]
    Loc********l Sc********nner Version[]
    Disk Filter Version[Unknown]
    CbSh********red[] Policy[] FileAn********lysis[] Proto[]
    Sensor St********te[En********bled]

@jborean93 or someone please help me with this, Thanks!

jborean93 commented 1 year ago

The Python module wrapper that the psexec module is using will scan the module return values and mask any occurrence of the password it finds. It seems like your password is a thus it's converting any a into the "masked" value ********. The module has no control over this as it's done in a shared module util in Ansible https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/common/parameters.py#L868.