Powershell - Manipulate data's, compare and display

Viewed 23

I need to create a verification tool for my work.

Files Description:

  • The SupportedCypher.txt file contains the Cyphers supported by the remote site.
  • The TlsCipherSuite.txt file is the result of Get-TlsCipherSuite command
  • The 00010002.txt file contains the order of local Cyphers obtained from Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002" -Name Functions

What does this tool need to perform?

Part 1 - Compare each line from TlsCipherSuite.txt to SupportedCypher.txt

For each line, write the the element checked and add Found or Not found

Then,

Part 2 - Compare each line from 00010002.txt to SupportedCypher.txt

write the element checked and if found add "<= here" at the end of the line.

Sample of SupportedCypher.txt content

TLS_CHACHA20_POLY1305_SHA256
TLS_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256

Sample of TlsCipherSuite.txt content

TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256

Sample of 00010002.txt content

TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256

Expected result

Part 1

TLS_AES_256_GCM_SHA384 - Not found
TLS_CHACHA20_POLY1305_SHA256 - found
TLS_AES_128_GCM_SHA256 - found
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - Not found
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - Not found
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - Not found
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 - Not found
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 - found

Part 2

TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256 <= here
TLS_AES_128_GCM_SHA256 <= here
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 <= here

I've no problems retrieving Cypher data but I don't know how to obtain my expected result. May you help me?

0 Answers
Related