Skip to content

Instantly share code, notes, and snippets.

View plambrechtsen's full-sized avatar

Peter Lambrechtsen plambrechtsen

View GitHub Profile
plambrechtsen /
Created January 12, 2024 02:37
Azure WVD compare to Cisco ASA
from bs4 import BeautifulSoup
import re
import requests
# Disable warnings to prevent annoying messages in the console
ASA_IP = "10.x.x.xx"
plambrechtsen / AzureSAMLCert.ps1
Created November 28, 2023 02:44
Generate Azure Self Signed Certificate for SAML
# Generate a 5 year self signed cert without KeyUsage, Subject Key Identifier and Enhanced Key Usage
# As per:
$Certificate=New-SelfSignedCertificate –Subject "SAML SSO Certificate" -CertStoreLocation Cert:\CurrentUser\My -KeyUsage None -KeyAlgorithm RSA -KeyLength 2048 -KeyExportPolicy Exportable -NotAfter (Get-Date).AddYears(5) -SuppressOid "",""
# Exported DER binary public key file
Export-Certificate -Cert $Certificate -FilePath ".\SSO.cer"
# Exported PEM text format public key file
$pemFileContent = @(
plambrechtsen / BurnToken2NFC.ps1
Last active January 25, 2024 20:23
Create random Base32 TOTP Token and burn it to a NFC Token2 Token and upload the CSV to Azure
# Time step of the OTP. 1=30s, 2=60s
$TimeStep = 2
$AzureTime = $TimeStep * 30
# Sleep timeout. 1=15s, 2=30s, 3=60s, 4=120s
$ScreenTimeout = 3
# Create 32 Bit Base32 string - From
$RNG = [Security.Cryptography.RandomNumberGenerator]::Create()
plambrechtsen /
Last active October 18, 2023 20:10
Create Cisco ASA Split Tunnel Configuration for WVD based on Azure IP Ranges and Service Tags
import urllib.request
from bs4 import BeautifulSoup
import json
# Retrieve Azure Public URL to find JSON URL in the documnet
azure_public_IP_url = ""
azure_public_IP_url_content = urllib.request.urlopen(azure_public_IP_url).read()
azure_public_IP_url_soup = BeautifulSoup(azure_public_IP_url_content, "html.parser")
azure_wvd_ip = []
plambrechtsen / BulkEmail.csv
Last active August 22, 2023 03:15
Send bulk email with outlook including send-as another account using a CSV input with PowerShell
to cc firstname fullname
peter@email.local shared@email.local; manager@email.local Peter Peter Lambrechtsen
plambrechtsen /
Last active August 16, 2023 20:24
Create self signed root CA, intermediate and leaf cert
openssl req -x509 -newkey rsa:2048 -sha256 -days 365 -nodes -keyout Root.key -out Root.pem -subj '/CN=Root CA' -addext 'subjectKeyIdentifier=hash'
openssl req -new -newkey rsa:2048 -sha256 -nodes -out Intermediate.csr -keyout Intermediate.key -subj '/CN=Intermediate CA'
# -- Intermediate.ext --
cat <<EOF > Intermediate.ext
keyUsage = digitalSignature, keyCertSign
plambrechtsen / Cisco ASAv Quick Setup
Created July 13, 2023 07:26
Cisco ASAv Local Deployment
plambrechtsen /
Created June 8, 2023 00:32
Create Self Signed Certificate with SAN and convert to PFX
openssl req -x509 -newkey rsa:2048 -sha256 -days 3560 -nodes -keyout server.key -out server.pem -subj '/CN=server' -addext 'subjectAltName = DNS:server, DNS:server.local'
openssl pkcs12 -export -inkey server.key -in server.pem -out server.pfx -passout pass:password
plambrechtsen /
Last active August 18, 2022 22:25
Convert TOTP Tokens Seeds from Base32 to Base16/HEX and vice versa based on input CSV.
Convert TOTP Base32 Seeds into Base16/Hex format and vice versa based on CSV with:
If the seed value isn't a valid Base32 then the base32 decoder will exception so assume it's Base16/Hex
import base64
import sys
filename = 'seeds.csv'
plambrechtsen /
Created March 14, 2021 08:47
Pet hub crc calculations
import crccheck
from operator import xor
from pathlib import Path
#Xor key from surepetpacket.xorkey
def tohex(ba):
return ''.join(format(x, '02x') for x in ba)