This file contains 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
# Azure Policy: Tagging Based on Resource Group Name | |
# Objective: | |
# This policy aims to enforce tagging conventions based on the name of the resource group. If a resource group (or its contained resources) matches a specified naming pattern, a designated tag with a corresponding value will be applied. | |
# | |
# Parameters: | |
# tagName: The name of the tag you want to apply. | |
# tagValue: The value associated with the aforementioned tag. | |
# rgNamePattern: A naming pattern that resource groups should match. For instance, if you want to target resource groups that start with "azurebatch", you'd use "azurebatch*". | |
# applyToResources: A boolean parameter that dictates whether the tagging should be applied only to the resource group itself or also to the resources contained within the matching resource group. | |
# |
This file contains 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
// The idea behind this is that you can do a terraform plan -out test.tfplan and then take the output that's printed | |
// and copy/paste it into your code, then use these commands to clean it up so it's usable code. | |
// In newer versions of Terraform you can do a terraform plan -generate-config to do this a different way, so check that out too. | |
// Uses this exctension: https://marketplace.visualstudio.com/items?itemName=ArturoDent.find-and-transform&ssr=false#overview | |
"findInCurrentFile": { | |
"replaceHyphenPrefix": { | |
"title": "Replace Terraform Plan output hyphen prefix...", // will appear in the Command Palette | |
"find": "^(\\s+)- ", | |
"replace": "$1", | |
"isRegex": true, |
This file contains 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 New-AesKey { | |
Param( | |
[Int]$KeySize = 256, | |
[Switch]$AsString | |
) | |
$aesManaged = New-Object "System.Security.Cryptography.AesManaged" | |
$aesManaged.KeySize = $KeySize | |
$aesManaged.GenerateKey() | |
If($AsString) { | |
Return [System.Convert]::ToBase64String($aesManaged.Key) |
This file contains 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
#!/bin/bash | |
# File: create_azure_vpn_client_cert.sh | |
# Author: David Frazer | |
# Date: 12/13/2022 | |
# NOTE: This script expects a CA root cert and CA root key to exist at the following paths: | |
# "${ORGNAME}_cacert.pem" | |
# "${ORGNAME}_cakey.pem" | |
# OPTIONAL: Set this to 1 to create a PFX for the user |
This file contains 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
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles' | Select -Property * | %{ $Key = $_.PSChildName; $Name = $_.Name -Replace "HKEY_LOCAL_MACHINE","HKLM:"; $Category_Num = Get-ItemPropertyValue "$Name" -Name Category; If($Category_Num -eq 0){ $Category='Public' } ElseIf($Category_Num -eq 1){ $Category='Private' } ElseIf($Category_Num -eq 2){$Category = 'Domain'}; $ProfileName = Get-ItemPropertyValue "$Name" -Name ProfileName; ""|Select @{N='ProfileName';E={$ProfileName}},@{N="ProfileCategory";E={$Category} }} | Sort ProfileCategory |
This file contains 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
SELECT CASE cnt | |
WHEN 2 THEN "TRUE" | |
ELSE "FALSE" | |
END "Vulnerable" | |
FROM | |
(SELECT name, | |
start_type, | |
COUNT(name) AS cnt | |
FROM services | |
WHERE name = 'NTDS' or (name = 'Spooler' and start_type <> 'DISABLED')) |
This file contains 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
Get-Content .\main.yml | Where-Object { $_ -and ($_ -notmatch "^\s*(\-|#)" )} | Foreach-Object { ($_ -Split ": ") -Join ','} | ConvertFrom-CSV -Header Name, DefaultVaue | ConvertTo-CSV |
This file contains 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
$Cert = New-SelfSignedCertificate -DnsName "maravedi.github.io" -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "Code Signing Certificate" | |
$TempFilePath = "exported_cert.cer" | |
Export-Certificate -FilePath $TempFilePath -Cert $Cert | |
$CertFromFile = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($TempFilePath) | |
$RootStore = Get-Item cert:\LocalMachine\Root | |
$RootStore.Open("ReadWrite") | |
$RootStore.Add($CertFromFile) | |
$RootStore.Close() | |
Remove-Item $TempFilePath -Confirm:$False |
This file contains 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 Get-Employee { | |
param( | |
[String]$Username, | |
[String]$ProxyAddressesFilter | |
) | |
If($Username) { | |
Get-ADUser -Identity $Username -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber | |
} Else { | |
Get-ADUser -Filter "proxyAddresses -like `"*$($ProxyAddressesFilter)*`"" -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber |
This file contains 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
description = [[ | |
This script stores the following nmap output into a sqlite3 database: Hostname, IP, port number, protocol (tcp/udp), service, version, cpe, and OS (if it can be determined) | |
Both, database file name and table name can be passed to the script via arguments (see @args or @example), data will always be appended to an existing table. Non-existant database files or table | |
s are created during the scan. Nmap's regular output (-o) will not be modified in any way. | |
Dependencies: luasql (http://keplerproject.org/luasql) | |
For Debian-based distributions: | |
sudo apt-get install lua-sql-sqlite3 |
NewerOlder