This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script to duplicate and edit the smartcard logon certificate template for easy testing | |
$certca = @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class CertCA | |
{ | |
public const uint CA_FLAG_ENUM_ALL_TYPES = 0x00000004; | |
public const uint CT_FIND_LOCAL_SYSTEM = 0x00000002; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-PortKnock | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[string] $HostName, | |
[Parameter(Mandatory=$true,Position=1)] | |
[Int32[]] $Sequence, | |
[Parameter(Mandatory=$false,Position=2)] | |
[Int32] $Delay = 500 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace UrlMon.InternetSecurityZones | |
{ | |
using System; | |
using System.Runtime.InteropServices; | |
/* | |
* About URL Security Zones | |
* https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms537183(v=vs.85) | |
* | |
* CoInternetCreateSecurityManager function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enumerate RDP USB devices like mstsc does | |
$RdpUsbDeviceExcludedClassGuids = @( | |
'{4d36e96b-e325-11ce-bfc1-08002be10318}', # Keyboard | |
'{4d36e972-e325-11ce-bfc1-08002be10318}', # Net | |
'{4d36e968-e325-11ce-bfc1-08002be10318}', # Display | |
'{4d36e967-e325-11ce-bfc1-08002be10318}', # DiskDrive | |
'{4d36e965-e325-11ce-bfc1-08002be10318}', # CDROM | |
'{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}', # Bluetooth | |
'{745a17a0-74d3-11d0-b6fe-00a0c90f57da}', # HIDClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RdpLogonEvent | |
{ | |
[CmdletBinding()] | |
param( | |
[Int32] $Last = 10 | |
) | |
$RdpInteractiveLogons = Get-WinEvent -FilterHashtable @{ | |
LogName='Security' | |
ProviderName='Microsoft-Windows-Security-Auditing' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Common variables | |
$CAFullName = "IT Help Ninja" | |
$CAFilePrefix = "it-help" | |
$CADnsSuffix = "ad.it-help.ninja" | |
$CertsPath = "~\Documents\certs" | |
New-Item -Path $CertsPath -ItemType Directory -ErrorAction SilentlyContinue | Out-Null | |
# Offline Root CA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Certificate ::= SEQUENCE { | |
tbsCertificate TBSCertificate, | |
signatureAlgorithm AlgorithmIdentifier, | |
signature BIT STRING } | |
| |
TBSCertificate ::= SEQUENCE { | |
version [0] Version DEFAULT v1, | |
serialNumber CertificateSerialNumber, | |
signature AlgorithmIdentifier, | |
issuer Name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-PascalCase | |
{ | |
[OutputType('System.String')] | |
param( | |
[Parameter(Position=0)] | |
[string] $Value | |
) | |
# https://devblogs.microsoft.com/oldnewthing/20190909-00/?p=102844 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CoreProperties(324): | |
ServerName (String) | |
ServerNetBiosName (String) | |
ServerFqdn (String) | |
ServerAddressesToConnect (none) | |
UserSpecifiedServerName (String) | |
UserName (String) | |
Domain (String) | |
Password (SecureString) | |
AlternateShell (String) |