Skip to content

Instantly share code, notes, and snippets.

@exeral
exeral / lldp-parser.py
Created October 30, 2025 16:17
LLDP parser
import struct
import sys
import json # Importing json module for JSON formatting
def byte_to_int(b):
"""Handles byte to integer conversion for Python 2 and 3 compatibility."""
return ord(b) if isinstance(b, str) else b
def mac_address_format(byte_sequence):
"""Format MAC address bytes for both Python 2 and 3."""
@exeral
exeral / dns.ps1
Last active August 28, 2024 03:22
pull Windows DNS from WSL
# Discover things and create an $Entries object.
$NetworkInterfaces = Get-NetIPInterface -AddressFamily IPv4 | Where-Object ConnectionState -EQ 'Connected' | Where-Object NlMtu -LT 9001
$DNSServerAddresses = Get-DnsClientServerAddress -AddressFamily IPv4
$DNSClients = Get-DnsClient
$Entries = $NetworkInterfaces | ForEach-Object {
[PSCustomObject]@{
'InterfaceAlias' = $_.InterfaceAlias
'InterfaceIndex' = $_.InterfaceIndex
'InterfaceMetric' = $_.InterfaceMetric