Skip to content

Instantly share code, notes, and snippets.

@jurbanek
jurbanek / Fix-HvNetwork.ps1
Last active November 1, 2022 15:53
Hyper-V Network Fix
<#
.SYNOPSIS
Apply a defined IP network to the Hyper-V Default Switch
.DESCRIPTION
Apply a defined IP network to the Hyper-V Default Switch
After host restart, the Hyper-V Default Switch IP network changes to a non-deterministic value. The Default Switch
provides DHCP and NAT services to allow VM's to communicate to the outside and Internet. The changing IP network
presents challenges for VM's with static IP addresses on the Default Switch.
@jurbanek
jurbanek / Expedition Group Partition.ps1
Created April 3, 2022 19:17
Expedition Group Partition
# Expedition XML file
$InFilePath = 'C:\Users\jfu\Downloads\MT-MSAEXT.xml'
# Expedition XML file address-group XPath (including the /entry on the end)
$InFileXPath = '/config/devices/entry[@name="localhost.localdomain"]/vsys/entry[@name="vsys1"]/address-group/entry'
# PAN-OS address-group(s) with more than this number of members will be split
$InMaxMember = 2500
# Output file to write XML
$OutFilePath = 'C:\Users\jfu\Downloads\Output.xml'
# New PAN-OS address-group(s) split with no more than this many members
$OutMaxMember = 1500
@jurbanek
jurbanek / SetUserIdServiceAccount.ps1
Created December 4, 2020 17:26
CONCEPT CODE ONLY to reset Palo Alto Networks Windows User-ID Agent service account credentials
<#
CONCEPT CODE ONLY to reset Palo Alto Networks Windows User-ID Agent service account credentials
Modifies the service's "log on" credentials
The "new credentials" can be obtained via a password vault API, other automation, or simple
Get-Credential. This concept uses Get-Credential for concept ease
Assume running locally on Windows server running the Windows User-ID Agent. Can be adapted to run
remotely (consider replacing Get-WmiObject with Get-CimInstance and using the -ComputerName parameter)
Additional error handing and logic is advisable for production use cases
#>
@jurbanek
jurbanek / userChrome.css
Created November 19, 2020 16:57
Tree Style Tab userChrome.css modification to hide standard horizontal tab bar and Tree Style Tab's unnecessary sidebar header
/*
Windows: C:\Users\<YourUsername>\AppData\Roaming\Mozilla\Firefox\Profiles\<YourFirefoxProfile>\chrome
Notes: If minimize, maximize, and close buttons are no longer visible, enable the Title Bar or Menu Bar in Firefox Customize.
macOS: /Users/<YourUsername>/Library/Application Support/Firefox/Profiles/<YourFirefoxProfile>/chrome
Notes: If minimize, maximize, and close buttons overlap other controls, add the Flexible Space in Firefox Customize.
*/
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Hide horizontal tab toolbar */
@jurbanek
jurbanek / CortexXdrEndpointStatus.py
Created November 11, 2020 21:42
Connected status percentage for Cortex XDR agents
import sys
import requests
import json
import datetime, time
import threading
# EDIT THIS INFO
host = "https://api-????.xdr.??.paloaltonetworks.com/"
headers = {
'Content-Type': 'application/json',
'x-xdr-auth-id': '??',
@jurbanek
jurbanek / custom.css
Last active May 27, 2020 01:12
Custom figure-lightbox shortcode for Hugo
.lightbox {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
width: 100vw;
height: 100vh;
# One evening after too many drinks in a townie bar someone claimed the Xerox effect
# (Generation Loss) on computer filesystem file copy. I asserted they did not understand
# one of the foundational disparities between digital and analog systems -- EXACT replication.
# See https://en.wikipedia.org/wiki/Generation_loss
# See https://en.wikipedia.org/wiki/Analog_signal#Noise
$CopyStart = 1
$Copies = 100
$File = 'http3-explained-en.pdf'