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:
# 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 |
# 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 |
function Get-UidFromSid | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[System.Security.Principal.SecurityIdentifier]$sid | |
) | |
Process { | |
# convert sid to byte array |
I hereby claim:
To claim this, I am signing this object:
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 |
function Test-IPInSubnet { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory,Position=0)] | |
[string]$IP, | |
[Parameter(Mandatory,Position=1)] | |
[string[]]$Subnet | |
) | |
$IPval = ([ipaddress]$IP).Address |
# I like to add these to my PowerShell profile so I can more easily sort FQDNs and CIDR network strings. | |
# The FQDN sorter will sort based on the labels in reverse order. So .com's will sort near each other, | |
# everything within the same domain will sort near each other, etc. | |
# | |
# 'a.example.org','a.example.com','example.org','example.com' | sort {[Fqdn]$_} | |
class Fqdn : IComparable | |
{ | |
[string]$Fqdn |
#Requires -Version 5.1 | |
#Requires -RunAsAdministrator | |
[CmdletBinding()] | |
param( | |
[switch]$Remediate, | |
[switch]$Quiet | |
) | |
$InformationPreference = 'Continue' |
#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. | |
<# | |
.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 |