Skip to content

Instantly share code, notes, and snippets.

@florian-obradovic
florian-obradovic / MikroTik-Firewall-Address-List-from-Azure-IP-Ranges.ps1
Last active October 11, 2024 11:46
Get Azure IPs from a JSON file, filter for specific fields and get the IP addressPrefixes for a specific service tag. Create a MikroTik RouterOS CLI command to add the IP to an address list!
# Use Case:
# Get IPs from a JSON file, filter for specific fields and get the IP addressPrefixes for a specific service tag.
# Create a MikroTik RouterOS CLI command to add the IP to an address list!
# Azure IP Ranges and Service Tags: https://www.microsoft.com/en-us/download/details.aspx?id=56519
# Load the JSON file
$jsonData = Get-Content -Path "/Users/flo/Downloads/ServiceTags_Public_20241007.json" -Raw | ConvertFrom-Json
# Define the output file path
$outputFilePath = "/Users/flo/Downloads/Mikrotik.rsc"
@florian-obradovic
florian-obradovic / embedd-images-into-html-base64.py
Last active August 20, 2024 09:34
This Python script parses through all HTML files and replaces the external image references with embedded base64 encoded strings.
# This Python script parses through all HTML files and replaces the external image references with embedded base64 encoded strings.
## create a directory
# mkdir ~/path2convert && cd ~/path2convert
# git init # optional to revert changes
# git add -A && git commit -m "Start" # optional to revert changes
## create a virtual environment
# python3 -m venv ./
# source ./bin/activate
@florian-obradovic
florian-obradovic / check-and-remediate-vba-Fix9072568-Project-Client.ps1
Last active September 2, 2024 10:27
PowerShell Proactive Remediation to fix Project Client VBA Macros in Enterprise Global (EGlobal) caused by August 2024 Updates. Probably caused by the fix for CVE-2024-38189: Microsoft Project Remote Code Execution vulnerability.
# Script provided as is, no warranty.
# Get in touch: www.theprojectgroup.com - Your Project Experts
#
# [HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\MS Project\Settings]
# "Fix9072568"=dword:00000001
#
# Confirmed to work with August 13, 2024 - Microsoft® Project 2019 MSO (Version 2407 Build 16.0.17830.20166) 64-bit.
# Probably caused by the fix for CVE-2024-38189: Microsoft Project Remote Code Execution vulnerability
# check.ps1
try {
<#
.EXTERNALMODULEDEPENDENCIES Microsoft.Graph (v.2.0.0-preview)
.DESCRIPTION
This script monitors apple token expiration in Intune (Intune) and checks if DEP, VPP, and APNS tokens,
certificates are valided after the number of specified days.
It utilizes Microsoft.Graph (v.2.0.0-preview) module to authenticate with the system managed identity of your
Azure Automation Account.
Permissions Required: DeviceManagementServiceConfig.Read.All, DeviceManagementApps.Read.All Directory.Read.All
#!/bin/bash
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
# I customized the script written by @ninjabes to my needs
# https://forum.proxmox.com/threads/problems-migrating-lxc-from-ubuntu2004-to-proxmox.100815/post-435303
# This is currently the only workaround I know for the UID/GID mapping issues after importing rootfs exports from LXD / LXC
# Ubuntu 20.04 into proxmox 7.2-11
# The resulting containers have various permission issues and UIDs & GIDs aren't mapped correctly.
# Example: ls -alh
# total 44K
@florian-obradovic
florian-obradovic / SetCertificate_AzureApplicationProxy.ps1
Last active December 27, 2021 10:53
Exports Certificate + Secret from Azure Key Vault & assigns it to all Azure Application Proxy Applications (PowerShell)
<#
"Written" by Florian Obradovic #Not_A_Coder #not_pretty
This script exports a given certificate from Azure key vault and assigns it to all Azure Application Proxy Applications
It will NOT work in Azure Cloud Shell:
$certCollection.Import($kvSecretBytes,$null,[System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
MethodInvocationException: Exception calling "Import" with "3" argument(s): "ASN1 corrupted data."
#>
@florian-obradovic
florian-obradovic / README
Last active November 20, 2019 09:08 — forked from satmandu/mount_zfs.sh
Alternative non-bpool/rpool zpool mount systemd service for ubuntu 19.10
Big THX to Satmandu.
I just forked his scripts and added a README (https://gist.github.com/satmandu/4da5e900c2c80c93da38c76537291507)
HowTo:
create /lib/systemd/system/zpool-local.service and set your pool name (mine: tank) and the startup priority/Dependencies:
Before=smbd.service snap.lxd.daemon.service
ExecStart=+/usr/local/sbin/mount_zfs.sh tank