Skip to content

Instantly share code, notes, and snippets.

View felickz's full-sized avatar
:octocat:
ALL YOUR REBASE ARE BELONG TO US.

Chad Bentz felickz

:octocat:
ALL YOUR REBASE ARE BELONG TO US.
View GitHub Profile
@felickz
felickz / Get-AzPublicIps.ps1
Created February 6, 2021 03:41
Az Powershell to inventory all Public IP in available subscriptions
#Get all IPs for accessible subscriptions
#Only Enabled Subs
$subscriptionList = Get-AzSubscription | where-object State -eq "Enabled"
$all = $null
foreach($sub in $subscriptionList)
{
$context = Set-AzContext -Subscription $sub.Id -Tenant $sub.TenantId
@felickz
felickz / LogAnalytics-SecurityEvents-ByType.KQL
Created January 7, 2021 21:02
Query to analyze which Azure Sentinel SecurityEvent event types you are capturing to fine tune your logging data ingestion
//https://docs.microsoft.com/en-us/azure/sentinel/connect-windows-security-events
let Minimal = dynamic ([1102, 4624, 4625, 4657, 4663, 4688, 4700, 4702, 4719, 4720, 4722, 4723, 4724, 4727, 4728, 4732, 4735, 4737, 4739, 4740, 4754, 4755, 4756, 4767, 4799, 4825, 4946, 4948, 4956, 5024, 5033, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8222]);
let Common = dynamic( [1, 299, 300, 324, 340, 403, 404, 410, 411, 412, 413, 431, 500, 501, 1100, 1102, 1107, 1108, 4608, 4610, 4611, 4614, 4622, 4624, 4625, 4634, 4647, 4648, 4649, 4657, 4661, 4662, 4663, 4665, 4666, 4667, 4688, 4670, 4672, 4673, 4674, 4675, 4689, 4697, 4700, 4702, 4704, 4705, 4716, 4717, 4718, 4719, 4720, 4722, 4723, 4724, 4725, 4726, 4727, 4728, 4729, 4733, 4732, 4735, 4737, 4738, 4739, 4740, 4742, 4744, 4745, 4746, 4750, 4751, 4752, 4754, 4755, 4756, 4757, 4760, 4761, 4762, 4764, 4767, 4768, 4771, 4774, 4778, 4779, 4781, 4793, 4797, 4798, 4799, 4800, 4801, 4802, 4803, 4825, 4826, 4870, 4886, 4887, 4888, 4893, 4898, 4902, 4904, 4905, 4907, 4931, 4932, 49
@felickz
felickz / GetAzKeyVaultKeyModulus.ps1
Last active January 7, 2021 21:03
Get the RSA modulus from key in Azure Keyvault
$($(Get-AzKeyVaultKey -VaultName $Vault -Name $Name).Key.ToString() | ConvertFrom-Json).n
@felickz
felickz / GetPrivateIpForVmSSInstances.ps1
Created October 24, 2020 01:13
Get Private Ip for each instance of a VM Scaleset
$VmIps=@{}; Get-AzVmSS | %{ $VmSS = $_; (Get-AzNetworkInterface -VirtualMachineScaleSetName $VmSS.Name -ResourceGroupName $VmSS.ResourceGroupName ) | %{ $nics = $_; $nics| %{ [string[]]$VmIps[(Get-AzVmSsVm -VMScaleSetName $VmSS.Name -ResourceGroupName $VmSS.ResourceGroupName -InstanceId $_.VirtualMachine.Id.tostring().split('/')[-1]).OsProfile.ComputerName]+=$_.IpConfigurations.PrivateIpAddress} } }; $VmIps
@felickz
felickz / fix-wsl2-dns-resolution
Last active October 5, 2020 15:43 — forked from coltenkrauter/fix-wsl2-dns-resolution
Fix DNS resolution in WSL2
1. Create a file: /etc/wsl.conf.
2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away
[network]
generateResolvConf = false
3. In a cmd window, run wsl --shutdown
4. Restart WSL2
5. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file: `rm /etc/resolv.conf`
6. Put the following line in the file
@felickz
felickz / postman-oauth-token-decode.js
Created August 8, 2019 17:11
Postman Test syntax to decode and validate an Application JWT token from Azure AD with Scopes(roles)
function jwtDecode(t) {
let token = {};
token.raw = t;
token.header = JSON.parse(atob(t.toString().split('.')[0]));
token.payload = JSON.parse(atob(t.toString().split('.')[1]));
return (token);
}
console.log("JWT Decode");
var jwt = jwtDecode(pm.response.json().access_token);
@felickz
felickz / Get-TeslaApiToken.ps1
Last active August 8, 2019 17:14
PowerShell script to get an AT / RT from the Tesla authorization server
$uri = 'https://owner-api.teslamotors.com/oauth/token'
$email = "a@b.com"
$pw = "pw123!"
$json = @{
grant_type = "password"
client_id = "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384"
client_secret = "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3"
email = "$email"
password = "$pw"
@felickz
felickz / SoftwareInventory.ps1
Created February 23, 2017 19:50
Software inventory for Windows
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | where { -not [str
ing]::IsNullOrEmpty($_.DisplayName) }
@felickz
felickz / JsonPointerPropertyExtractionRule.cs
Last active October 12, 2016 12:18 — forked from LockTar/JsonPropertyExtractionRule.cs
An RFC 6901 JSON Pointer extraction rule for Visual Studio webtest that extracts a value from a JSON response
using Microsoft.VisualStudio.TestTools.WebTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.ComponentModel;
using Tavis;
namespace Extensions.ExtractionRules
{
/// <summary>
@felickz
felickz / RunAsDifferentUser.ps1
Last active April 4, 2016 14:47
Powershell command to open powershell as a different user
#http://powershell.com/cs/blogs/tips/archive/2010/10/28/running-programs-as-different-user.aspx
Start-Process powershell -LoadUserProfile -Credential (Get-Credential)