Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathias R. Jessen IISResetMe

  • Booking.com
  • Netherlands
View GitHub Profile
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
IISResetMe / ghetto_PowerShell_OOP_sloooooow.ps1
Last active Oct 11, 2017 — forked from mattifestation/ghetto_PowerShell_OOP.ps1
A pipeline-heavy twist on a unique PowerShell coding style seen by a threat actor. This is probably as close to OOP PowerShell as you could get in the PSv2 days.
View ghetto_PowerShell_OOP_sloooooow.ps1
$MyObject = "" |Select-Object _prop1,_prop2
$MyObject |Add-Member -Name Prop1 -MemberType ScriptProperty -Value {return $this._prop1} -SecondValue {param([int]$value) $this._prop1 = $value}
$MyObject |Add-Member -Name Prop2 -MemberType ScriptProperty -Value {return $this._prop2} -SecondValue {param([int]$value) $this._prop2 = $value}
$MyObject |Add-Member -Name SumProperties -MemberType ScriptMethod -Value { return $this.Prop1 + $this.Prop2 }
$MyObject.Prop1 = 3
$MyObject.Prop2 = 2
$MyObject.SumProperties()
@IISResetMe
IISResetMe / Invoke-SyntaxISEr.ps1
Last active Jan 9, 2017 — forked from SadProcessor/Invoke-SyntaxISEr.ps1
ISE Script Explorer - Returns AST/Token/Error
View Invoke-SyntaxISEr.ps1
#requires -version 3
#######################################################
#region SyntaxISEr ####################################
## Function Invoke-SyntaxISEr
## BackBone Tool for Invoke-CyberISEr - Exported (?)
<#
.Synopsis
ISE ScriptPane Explorer
@IISResetMe
IISResetMe / Get-RSFileHash.ps1
Last active Nov 17, 2016 — forked from rodmhgl/Get-RSFileHash.ps1
Just looking to get input on the best way to handle parameter sets
View Get-RSFileHash.ps1
function Get-RSFileHash {
<#
.Synopsis
Returns an MD5 filehash when given a file path
.DESCRIPTION
Returns an MD5 filehash when given a file path
.EXAMPLE
Get-RSFileHash -Filename c:\temp\filetohash.txt
.EXAMPLE
Get-ChildItem c:\temp\*.txt | get-rsfilehash
@IISResetMe
IISResetMe / ToastNotification_Windows10.ps1
Last active Jul 10, 2016 — forked from altrive/ToastNotification_Windows10.ps1
Windows 10 toast notification sample
View ToastNotification_Windows10.ps1
function New-ToastNotification
{
param(
[Parameter(Mandatory=$true)]
[string]$Title,
[Parameter(Mandatory=$false)]
[string[]]$Message,
[Parameter(Mandatory=$false)]
View communary.ps1
param([Parameter(Position = 0)][string] $Path = 'C:\Users\grave\Downloads\ChessData-master\')
$code = @{
Name = 'ResultCounter'
Namespace = 'ChessData'
PassThru = $true
UsingNamespace = @(
'System.Collections.Concurrent',
'System.IO',
'System.Threading.Tasks'
)
View Ping-Forever.ps1
#
# Ping-Forever.ps1
#
# Modified version of alexinnes/ConstantPingToServer.ps1 (https://gist.github.com/alexinnes/b2076c88700020af3963)
#
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[string]$ComputerName,
[string]$LogDirectory = 'C:\ping logs\'
View New-JunkFile
function New-JunkFile
{
<#
.SYNOPSIS
Generates a file of a specified length, filled with random bytes
.DESCRIPTION
Generates a file of a specified length, filled with random bytes
Uses the RNGCryptoServiceProvider to randomly select each byte
View Logging_Functions.ps1
Function Log-Start{
<#
.SYNOPSIS
Creates log file
.DESCRIPTION
Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one.
Once created, writes initial logging data
.PARAMETER LogPath
You can’t perform that action at this time.