This file has been truncated, but you can view the full file.
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
| "\n mutation ToggleTrigger($input: TriggerUpdateInput!) {\n updateTrigger(trigger: $input) {\n id\n enabled\n }\n }\n": { | |
| kind: "Document", | |
| definitions: [{ | |
| kind: "OperationDefinition", | |
| operation: "mutation", | |
| name: { | |
| kind: "Name", | |
| value: "ToggleTrigger" | |
| }, |
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
| # It should really be a dynamic group but if hindsight was foresight we would all be millionaires | |
| # POST https://graph.microsoft.com/beta/deviceManagement/configurationPolicies/{policyId}/assign | |
| $policyId = "{policyId}" | |
| $groupId = "{groupId}" | |
| $body = @{ | |
| assignments = @( | |
| @{ | |
| "@odata.type" = "#microsoft.graph.deviceManagementConfigurationPolicyAssignment" | |
| target = @{ | |
| "@odata.type" = "#microsoft.graph.groupAssignmentTarget" |
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
| # BinaryFormatter back with vengence (it never left) because System Admins are too lazy to use PS Core. 'muh ISE' - die in a hole | |
| [System.AppContext]::SetSwitch('Switch.System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization', $true) # Final working version. | |
| Add-Type @' | |
| using System; | |
| using System.Runtime.Serialization; | |
| using System.Diagnostics; | |
| [Serializable] | |
| public class MaliciousPayload : ISerializable { | |
| public MaliciousPayload() { } |
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
| # Setup-DevEnvironment.ps1 | |
| # Find the latest Visual Studio installation | |
| $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | |
| $vsPath = & $vswhere -latest -property installationPath | |
| if (-not $vsPath) { | |
| Write-Error "Visual Studio installation not found. Please ensure Visual Studio Build Tools are installed." | |
| exit 1 | |
| } |
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 chk_wsl { | |
| Add-Type @" | |
| using System; | |
| using System.Runtime.InteropServices; | |
| public class User32 { | |
| [DllImport("user32.dll")] | |
| public static extern IntPtr GetForegroundWindow(); | |
| [DllImport("user32.dll")] |
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
| # From PwSh | |
| # Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux | |
| # $userenv = [System.Environment]::GetEnvironmentVariable("Path", "User") | |
| # [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User") | |
| # wsl --shutdown | |
| # wsl --update | |
| # winget install --interactive --exact dorssel.usbipd-win | |
| # usbipd list |
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 Format-StackTrace | |
| { | |
| param ( | |
| [Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
| [System.Management.Automation.ErrorRecord]$ErrorRecord, | |
| [switch]$RawOutput | |
| ) | |
| process |
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 ReturnDelegatedToken | |
| { | |
| $request=Invoke-MgGraphRequest -Method GET -Uri 'https://graph.microsoft.com/v1.0/me' -OutputType HttpResponseMessage | |
| $B=$request.RequestMessage.Headers.Authorization.Scheme | |
| $AT=$request.RequestMessage.Headers.Authorization.Parameter | |
| return @{ | |
| Authorization = "$B $AT" | |
| 'User-Agent' = 'Mozilla/5.0, (Windows NT 10.0; Microsoft Windows 10.0.26100; en-NL), PowerShell/7.4.5, Invoke-MgGraphRequest' | |
| 'Accept-Encoding' = 'gzip' |
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 Replace-Secret { | |
| <# | |
| .SYNOPSIS | |
| Replaces a specified string (such as a secret) in a file with a new string. | |
| .DESCRIPTION | |
| This function reads a file, replaces all occurrences of a specified old string with a new string, and writes the changes back to the file. | |
| .PARAMETER FilePath | |
| The path to the file where the replacement should occur. |
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
| class StringSlicer { | |
| [string]$StringValue | |
| StringSlicer([string]$initialValue) { | |
| $this.StringValue = $initialValue | |
| } | |
| [string] Slice([int]$start, [int]$length) { | |
| if ($length -eq 0 -or $start -ge $this.StringValue.Length) { | |
| return '' |
NewerOlder