Skip to content

Instantly share code, notes, and snippets.

Mathias R. Jessen IISResetMe

  • Netherlands
Block or report user

Report or block IISResetMe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
IISResetMe / Get-LMHash.ps1
Last active Mar 15, 2019
LMHash generator in written in PowerShell
View Get-LMHash.ps1
function Get-WeakDESEncryptor {
Creates a DESCryptoProviderService encryptor from a potentially unsafe key
DESCryptoProviderService.GetEncryptor() attempts to ensure that 0-keys can't be used. This function bypasses the protection and creates a DES encryptor from a potentially unsafe key and an empty initialization vector
PS C:\> $DESProvider = [System.Security.Cryptography.DESCryptoServiceProvider]::new()
PS C:\> $encryptor = Get-WeakDESEncryptor -CSP $DESProvider -Key @(,0*8)
IISResetMe / TypoHijack.ps1
Last active Mar 14, 2019
Hijack a subset of non-existing commands in PowerShell
View TypoHijack.ps1
$ExecutionContext.InvokeCommand.CommandNotFoundAction = {
param([string]$CommandName, [System.Management.Automation.CommandLookupEventArgs]$evtArgs)
if($CommandName -like '*glue*'){
$evtArgs.CommandScriptBlock = {
Write-Host "Eating glue because of $CommandName ..." -ForegroundColor Green
$evtArgs.StopSearch = $true
IISResetMe / PinnedHandle.cs
Created Mar 11, 2019
Disposable pinned GCHandle
View PinnedHandle.cs
using System;
using System.Runtime.InteropServices;
namespace IISResetMe.SafeHandles
/// <summary>Disposable pinned memory handles, useful for non-blittable type references passed to unmanaged code</summary>
public class GCPinnedHandle : IDisposable
private GCHandle gcHandle;
View Join-Uri.ps1
function Join-Uri
[Parameter(Mandatory = $true, Position = 0)]
[Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)]
View RegisterCompleter.ps1
# define an argument completer
$completer = {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
if($null -eq $script:_listOfArgCompletions){
# download list and populate $script:_listOfArgComplettions
$script:_listOfArgCompletions = @('Apples','Oranges','Nectarines')
$script:_listOfArgCompletions -like "$wordToComplete*" |ForEach-Object {
View Add-GroupMembership.ps1
function Add-GroupMembership
[Parameter(Mandatory=$true, ValueFromPipeline=$true, ParameterSetName = 'Pipeline')]
[Parameter(Mandatory=$true, Position=0, ParameterSetName = 'Explicit')]
View RandomSortOrder.ps1
$Sentence = 'PowerShell is super cool and awesome'
3..6 |ForEach-Object {
$words = -split $Sentence |Select -First $_
$target = $words -join ' '
$avg = $(1..20 |ForEach-Object {
$c = 0
$guess = ($words |Sort-Object {Get-Random}) -join ' '
View ValidateScopeAttribute.cs
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Management.Automation.Internal;
using System.Management.Automation.Language;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
IISResetMe / Resolve-MemberChain.ps1
Created Feb 12, 2019
Recursively dereference powershell instance members without actually resorting to recursion
View Resolve-MemberChain.ps1
function Resolve-MemberChain
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[Parameter(Mandatory = $true, Position = 0)]
[Parameter(Mandatory = $false)]
You can’t perform that action at this time.