View Scan-LOLDrivers.ps1
This file contains 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 Scan-LOLDrivers { | |
param( | |
[Parameter(Mandatory = $true)] | |
[string]$path | |
) | |
Add-Type -TypeDefinition @" | |
using System; | |
using System.Security.Cryptography; | |
using System.Security.Cryptography.X509Certificates; |
View Set-ADPrincipalRedirection.ps1
This file contains 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 Set-ADPrincipalRedirection { | |
param( | |
[Parameter(Mandatory)] | |
$Domain, | |
[string] | |
$ComputersOU, | |
[string] | |
$UsersOU |
View ConvertFrom-WildcardPattern.ps1
This file contains 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 ConvertFrom-WildcardPattern { | |
param( | |
[Parameter(Mandatory, ValueFromPipeline)] | |
[WildcardPattern]$InputObject | |
) | |
begin { | |
$pctrProp = [WildcardPattern]. | |
GetMember('PatternConvertedToRegex', [Reflection.BindingFlags]'NonPublic, Instance') | |
} |
View Get-PSRStaticInvocationHistory.ps1
This file contains 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
Get-PSReadLineOption |Get-Content -LiteralPath { $_.HistorySavePath } |ForEach-Object { | |
if($_.EndsWith('`')){ | |
$last += "{0}`r`n" -f $_.Remove($_.Length - 1) | |
}else{ | |
"${last}${_}" | |
$last = $null | |
} | |
} |Where-Object {$_ -like '*::*'} |ForEach-Object { | |
# parse history entry as powershell script |
View half_a_record_typer.ps1
This file contains 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
using namespace System.Reflection | |
using namespace System.Reflection.Emit | |
using namespace System.Runtime.CompilerServices | |
# We'll attempt to construct a subset of the functionality of: | |
# public record TestRecord(int M1, string M2); | |
# | |
# Namely, we'll generate: | |
# - property getters (`get_M1()`, `get_M2()`), | |
# - a public constructor (`TestRecord(int, int);`), |
View MeasureCallstackPenalty.ps1
This file contains 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 target { | |
param($Caller = $((Get-PSCallStack)[0].Command)) | |
"'$Caller' called!" | |
} | |
function volunteerID { | |
target -Caller $MyInvocation.MyCommand | |
} |
View Find-VulnerableSchemas.ps1
This file contains 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
# Dictionary to hold superclass names | |
$superClass = @{} | |
# List to hold class names that inherit from container and are allowed to live under computer object | |
$vulnerableSchemas = [System.Collections.Generic.List[string]]::new() | |
# Resolve schema naming context | |
$schemaNC = (Get-ADRootDSE).schemaNamingContext | |
# Enumerate all class schemas |
View flatten.ps1
This file contains 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
using namespace System.Collections | |
function flatten | |
{ | |
param( | |
[IDictionary]$Dictionary, | |
[string]$KeyDelimiter = ':' | |
) | |
$newDict = @{} |
View stackoverflow-font-hack.css
This file contains 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
body *:not(code) { font-family: arial !important; } | |
code {font-family: monospace !important;} |
NewerOlder