Skip to content

Instantly share code, notes, and snippets.

View azurekid's full-sized avatar
🎯
Focusing

Rogier Dijkman azurekid

🎯
Focusing
View GitHub Profile
@azurekid
azurekid / easyeasm.sh
Created April 2, 2024 14:33
easyEASM Setup
git clone https://github.com/projectdiscovery/alterx.git
git clone https://github.com/projectdiscovery/owasp-amass/oam-tools
cd alterx/cmd/alterx; \
go build; \
mv alterx /usr/local/bin/; \
alterx -version;
@azurekid
azurekid / Get-Guid.ps1
Last active October 12, 2023 17:25
PowerShell function to create a GUID from a string value
<#
.SYNOPSIS
Generates a GUID from a given string value using MD5 hashing.
.PARAMETER Value
The string value to generate a GUID from.
.EXAMPLE
Get-Guid -Value "example string"
Returns a GUID generated from the string "example string".
@azurekid
azurekid / AccessToken.yaml
Created June 20, 2023 06:54
DevOps Pipeline to get access token from system
jobs:
- job: get_token
displayName: Collecting AccessToken
steps:
- powershell: |
$accessToken = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("azdo:$(System.AccessToken)"))
# auth headers
$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("azdo:$(System.AccessToken)")) }
write-output $($headers.value)
@azurekid
azurekid / ASIM_snippets.md
Last active June 14, 2023 07:14
ASIM snippets

KQL Snippets

This file contains useful snippets that can be used for the development of ASIM Parsers for Microsoft Sentinel

DstHostname

| extend DstHostname = case(DstHostname != "", DstHostname, DestinationIP)
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$GitBranch,
[Parameter(Mandatory = $false)]
[string]$CommitMessage = 'rebuild repository',
[Parameter(Mandatory = $false)]
[switch]$Force
function Invoke-SplitJWT {
Param
(
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
Position = 0)]
$String
)
Process {
@azurekid
azurekid / Get-GraphToken.ps1
Last active December 19, 2022 20:45
PowerShell function to create Graph Access Token
function Get-GraphToken {
[cmdletbinding()]
Param(
[Parameter(Mandatory = $True)]
[String[]]
[ValidateSet("MSGraph", "Azure", "Monitor", "MSPIM")]
$Client,
[Parameter(Mandatory = $False)]
[String]$Resource = "https://graph.microsoft.com"
@azurekid
azurekid / kql-coding-standards.md
Last active November 22, 2022 13:29
KQL Coding Standards

KQL Coding standards

This document helps to create clean and readable KQL code for parsing and detection rules.
All views are my own based on writing lots of code in PowerShell and other languages.
This is a living document that helps to create a common baseline.

Allign your code

  • Place a spaces before and after the '=' character for readability.
  • allign the code using instead of spaces. Keep the '=' character and default values alligned.
[CmdletBinding()]
param (
[Parameter()]
[switch]$IDPS,
[Parameter()]
[switch]$ThreatIntel,
[Parameter()]
[switch]$WebCategories,
@azurekid
azurekid / Set-AzTagValue.ps1
Last active September 24, 2022 18:59
Resource Tagging
$ResourceGroups = Get-AzResourceGroup
[System.Environment]::SetEnvironmentVariable('SuppressAzureRmModulesRetiringWarning', 'true', [System.EnvironmentVariableTarget]::User)
foreach ($rg in $ResourceGroups) {
# Tag ResourceGroups
$logEntry = (Get-AzLog -ResourceGroupName $rg.ResourceGroupName -StartTime (Get-Date).AddDays(-90))[-1]
$createdBy = $logEntry.Caller
$createDate = $logEntry.EventTimestamp