Skip to content

Instantly share code, notes, and snippets.

@RezaAmbler
RezaAmbler / junos_log_tally.py
Last active May 2, 2025 17:54
junos_log_tally.py – Small, self-contained Python 3 tool that scans any mix of Junos syslog files or directories, counts each message mnemonic found, and prints a nice fixed-width table with the mnemonic, hit-count, and the full description pulled from Juniper’s System_Log_Messages CSV. Highlights: • accepts multiple paths (files or directories,…
#!/usr/bin/env python3
"""
junos_log_tally.py
==================
Counts Junos syslog message mnemonics inside one or more log files/directories
and prints them as NAME / COUNT / DESCRIPTION.
• Reads the official Juniper “System Log Messages” spreadsheet exported to CSV
(column headers must include NAME and DESCRIPTION).
• Accepts any number of log paths (files or directories) and walks directories
@RezaAmbler
RezaAmbler / VMWareReport.ps1
Created November 27, 2024 18:07
PowerCLI VMWare Report Script
# Initialize an empty array to store the results
$resultArray = @()
# Retrieve a list of all VMs from vCenter
$vmlist = Get-VM
# Select 4 random VMs from the list for processing
$testList = $vmlist | Get-Random -Count 4
# Loop through the randomly selected VMs
@RezaAmbler
RezaAmbler / network-imix-perf-test.sh
Created November 22, 2024 20:10
# network-imix-perf-test.sh Automated network testing script that generates concurrent TCP/UDP traffic using IMIX patterns. Features configurable bandwidth (50-450 Mbps), multiple packet sizes, and comprehensive logging.
#!/bin/bash
###################################################################################
# Network Testing Script
#
# This script performs comprehensive network testing using iperf3 with both TCP and UDP
# protocols. It supports IMIX packet sizes and various bandwidth configurations.
###################################################################################
# Configuration file and logging setup
@RezaAmbler
RezaAmbler / libre_lldp_topo_report.py
Created October 31, 2024 20:29
Generator PDF report of LLDP connections from LibreNMS
#!/usr/bin/python
"""
Network Topology Visualization Generator
This script generates a PDF file representing the network topology using CDP (Cisco Discovery Protocol)
and LLDP (Link Layer Discovery Protocol) data from LibreNMS. It visualizes network device connections
using the Graphviz library to create a directed graph representation.
Requirements:
- requests: For API interactions
@RezaAmbler
RezaAmbler / libre_lldp_mismatch.py
Created October 31, 2024 20:27
search for lldp mismatches
#!/usr/bin/env python3
# Standard library imports
import requests
# Authentication and API Configuration
# Replace **** with actual authentication token in production
AUTH_TOKEN = "****"
# API endpoint URLs
@RezaAmbler
RezaAmbler / listDevicesLibre.sh
Created October 31, 2024 20:13
libre list devices
#!/bin/bash
# Define the API URL and token (use the updated base URL)
API_URL="http://dfw1anetlnms01/api/v0/devices/"
API_TOKEN="*****"
# Fetch device names and save to a text file
curl -s -H "X-Auth-Token: $API_TOKEN" "$API_URL" | jq -r '.devices[].hostname' > /tmp/devices_list.txt
echo "Device names have been saved to //tmp/devices_list.txt"
@RezaAmbler
RezaAmbler / auto_dns_object_group_update.py
Created October 17, 2024 21:22
automaticallyt update cisco object group based off DNS returned output
# Import required libraries
import dns.resolver # For DNS resolution
from netmiko import ConnectHandler # For SSH connections to network devices
import getpass # For secure password input
# Configuration details for the Cisco device
cisco_device = {
'device_type': 'cisco_ios', # Specifies that we're connecting to a Cisco IOS device
'host': '10.1.2.3', # IP address of the Cisco device
}
@RezaAmbler
RezaAmbler / juniper_copy_firmware.py
Created October 17, 2024 18:29
copy firmware files to juniper boxes and validate md5
#!/usr/bin/env python3
"""
Juniper Firmware Transfer Utility
This script performs parallel SCP transfers of firmware files to multiple Juniper devices
and verifies the transfer using MD5 checksums.
Usage:
1. Install required libraries:
pip install paramiko
@RezaAmbler
RezaAmbler / bash_copy_files_juniper.sh
Created October 17, 2024 18:16
Copy TGZ files to Juniper Boxes - Prep for Ugprade
#!/bin/bash
# Array of target Juniper systems
# Replace these with your actual target systems
systems=("10.1.2.3" "juniper2.example.com" "juniper3.example.com")
# Prompt for username and password
# Note: Storing passwords in plain text is not secure. Consider using SSH keys instead.
read -p "Enter your username: " username
read -s -p "Enter your password: " password
@RezaAmbler
RezaAmbler / whois-checker.py
Created October 15, 2024 23:00
Whois checkers
#claud.ai
import subprocess
import ipaddress
import re
def whois_lookup(ip_prefix):
try:
result = subprocess.run(['whois', ip_prefix], capture_output=True, text=True, timeout=10)
return result.stdout
except subprocess.TimeoutExpired: