I hereby claim:
- I am rmbolger on github.
- I am rmbolger (https://keybase.io/rmbolger) on keybase.
- I have a public key ASBwymVX2hfBKfUWYAKBxNK-6syGE2xymydggktaYMuogQo
To claim this, I am signing this object:
| <# | |
| .SYNOPSIS | |
| A simple visualization of Advent of Code 2021 - Day 8 part 2 | |
| .EXAMPLE | |
| Get-Content .\d8.txt | .\d8-viz.ps1 | |
| Run visualization from input file | |
| .EXAMPLE |
| #Requires -Version 2.0 | |
| <# | |
| .SYNOPSIS | |
| Find copies of Let's Encrypt related chain/root certificates. | |
| .DESCRIPTION | |
| This script searches all certificate stores both for the Local Computer and all active Local User accounts with an HKEY_USERS registry hive loaded. | |
| It does not require running as administrator, but will throw warnings for registry locations it can't read. So it is suggested to run as administrator. | |
| #Requires -Version 5.1 | |
| #Requires -RunAsAdministrator | |
| [CmdletBinding()] | |
| param( | |
| [switch]$Remediate, | |
| [switch]$Quiet | |
| ) | |
| $InformationPreference = 'Continue' |
| # When working with large sets of domain names, email addresses, network CIDR ranges, | |
| # and IP addresses, the default string/lexical sorting those values is not ideal. | |
| # | |
| # Sorting numbers as strings which what happens with IP addresses and CIDR rangers | |
| # ends up putting "2" after "11" and "22" after "111" for example. | |
| # | |
| # Similarly with domain names and email addresses, I find that I often want all the | |
| # email addresses with the same domain suffix grouped together instead of all the | |
| # bob@<domain> addresses together. And I want FQDNs like <blah>.example.com to sort | |
| # together instead of all the mail.<domain> values together. |
| function Test-IPInSubnet { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory,Position=0)] | |
| [string]$IP, | |
| [Parameter(Mandatory,Position=1)] | |
| [string[]]$Subnet | |
| ) | |
| $IPval = ([ipaddress]$IP).Address |
| gc "$($env:SYSTEMROOT)\System32\config\netlogon.dns" | %{ $p = $_.Split(' '); $d = ($p[4..($p.Count-1)] -join ' '); [pscustomobject]@{name=$p[0].Trim('.').Split('.');ttl=$p[1];type=$p[3];data=$d} } | sort @{E={$a=@()+$_.name;[Array]::Reverse($a);$a}},type,data | select @{L='rec';E={$_.name[0]}},@{L='zone';E={$_.name[1..($_.name.Count-1)] -join '.'}},ttl,type,data |
I hereby claim:
To claim this, I am signing this object:
| function Get-UidFromSid | |
| { | |
| [CmdletBinding()] | |
| param( | |
| [Parameter(Mandatory=$true,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
| [System.Security.Principal.SecurityIdentifier]$sid | |
| ) | |
| Process { | |
| # convert sid to byte array |
| # Adapted from Vadims Podāns' amazing work here. | |
| # https://www.sysadmins.lv/blog-en/how-to-convert-pkcs12pfx-to-pem-format.aspx | |
| # | |
| # Also, if you need a more complete PKI PowerShell module, he has authored one here: | |
| # https://github.com/Crypt32/PSPKI | |
| # | |
| # This version of the function includes a few fixes from the module's version of the | |
| # function and changes up the output options so you get separate .crt/.key files by | |
| # default named the same as the pfx file (or thumbprint if directly referencing a cert). | |
| # -IncludeChain adds an additional -chain.pem. Relative paths are now |
| # http://stackoverflow.com/a/38729034/75772 | |
| # https://d-fens.ch/2013/12/20/nobrainer-ssl-connection-error-when-using-powershell/ | |
| if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type) | |
| { | |
| $certCallback=@" | |
| using System; | |
| using System.Net; | |
| using System.Net.Security; | |
| using System.Security.Cryptography.X509Certificates; | |
| public class ServerCertificateValidationCallback |