Skip to content

Instantly share code, notes, and snippets.

@eric-glb
Created September 27, 2023 10:56
Show Gist options
  • Save eric-glb/d468ed7fdfdb512dd9ad34913674bb75 to your computer and use it in GitHub Desktop.
Save eric-glb/d468ed7fdfdb512dd9ad34913674bb75 to your computer and use it in GitHub Desktop.
steampipe & steampipe-plugin-vanta output issue: post-processing with Perl

steampipe & steampipe-plugin-vanta output issue

Links:


steampipe query 'select os_version, 
                        installed_password_managers 
                 from vanta_computer 
                 where owner_name = '"'redacted'"

Output:

+------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+
| os_version                                                                                                 | installed_password_managers                                             |
+------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+
| \xD0\x9C\xD0\xB0\xD0\xB9\xD0\xBA\xD1\x80\xD0\xBE\xD1\x81\xD0\xBE\xD1\x84\xD1\x82 Windows 10 Pro 10.0.19044 | ["NordPass","NordPass\\xC2\\xAE Password Manager \u0026 Digital Vault"] |
+------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+

As You can see, the data is gibberish, due I guess to vanta client collecting data + vanta backend encoding issues.

I therefore post-process the data using Perl:

steampipe query --output csv 'select os_version, 
                                     installed_password_managers 
                              from vanta_computer 
                              where owner_name = '"'redacted'" \
  | perl -ple 's/\\\\/\\/g; 
               s/\\x(..)/sprintf "%s",chr(hex($1))/eg; 
               s/\\u(\d+)/sprintf "%s", pack("U", hex($1))/eg'

Output:

os_version,installed_password_managers
Майкрософт Windows 10 Pro 10.0.19044,"[""NordPass"",""NordPass® Password Manager & Digital Vault""]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment