Skip to content

Instantly share code, notes, and snippets.

View DavidWittman's full-sized avatar

David Wittman DavidWittman

View GitHub Profile
@DavidWittman
DavidWittman / wireshark-analysis.md
Last active January 4, 2024 17:14
Outline for Packet Analysis with Wireshark

Packet Analysis with Wireshark

Links

Common filters

Source IP is 192.168.1.1

ip.src == 192.168.1.1

@DavidWittman
DavidWittman / notes.md
Created February 22, 2012 18:54
A Brief Introduction to Fabric

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@DavidWittman
DavidWittman / supermicro-ipmi-mac-address.md
Last active August 17, 2023 08:05
Pull the LAN1/eth0 MAC address from SuperMicro IPMI

You can find the MAC address for LAN1/eth0 (not the BMC MAC) via the SuperMicro IPMI interface by running the following command:

$ ipmitool -U $IPMI_USER -P $IPMI_PASS -H $IPMI_HOST raw 0x30 0x21 | tail -c 18

The eth0 MAC address will be output in this format:

00 25 90 f0 be ef
@DavidWittman
DavidWittman / iptables-nat.md
Created September 29, 2012 20:38
iptables n'at

iptables n'at

Source NAT

Source NAT changes the source address in IP header of a packet. It may also change the source port in the TCP/UDP headers. The typical usage is to change the a private (rfc1918) address/port into a public address/port for packets leaving your network. Available only in the POSTROUTING chain in iptables.

Syntax

iptables -t nat -A POSTROUTING -i eth1 -j SNAT --to-source 1.2.3.4[:port]

Example

@DavidWittman
DavidWittman / mongo-ansible.py
Last active April 18, 2023 18:16
MongoDB-backed dynamic inventory script for Ansible
#!/usr/bin/env python
#
# MongoDB-backed dynamic inventory script for Ansible
# http://docs.ansible.com/intro_dynamic_inventory.html
import os
from argparse import ArgumentParser
import pymongo
@DavidWittman
DavidWittman / audit_iam_accounts.py
Created April 14, 2016 22:34
Parses the output from AWS credential reports and displays users which have been inactive for 60+ days.
#!/usr/bin/env python
# Parses the output from AWS credential reports and displays
# users which have been inactive for 60+ days.
#
# Usage:
# audit_iam_accounts.py credential_report.csv <days>
#
import csv
#!/usr/bin/env bash
# Loads and mounts an ISO over SMB via the
# SuperMicro IPMI web interface
#
# usage: supermicro-mount-iso.sh <ipmi-host> <smb-host> <path>
# e.g.: supermicro-mount-iso.sh 10.0.0.1 10.0.0.2 '\foo\bar\windows.iso'
set -x
@DavidWittman
DavidWittman / supermicro-java-console.sh
Last active March 13, 2022 04:06
Retrieves the plaintext JNLP for the iKVM console from a SuperMicro IPMI webserver
#!/usr/bin/env bash
# Retrieves the plaintext JNLP from a SuperMicro IPMI webserver
# Usage: supermicro-java-console.sh <hostname>
# supermicro-java-console.sh 10.1.2.34 > login.jnlp
set -x
HOST="$1"
IPMI_USER=${IPMI_USER:-ADMIN}
@DavidWittman
DavidWittman / vlan-check.sh
Last active January 27, 2022 20:02
Validates the VLAN configuration on an interface by creating a tagged subinterface, assigning the next available address, and sending a ping to the provided gateway IP address.
#!/usr/bin/env bash
# vlan-check.sh
#
# Validates the VLAN configuration on an interface
# by creating a tagged subinterface, assigning the
# next available address, and sending a ping to the
# provided gateway IP address.
#
# Supports Ubuntu and RHEL/CentOS. I think.
@DavidWittman
DavidWittman / supermicro-bmc-reset.sh
Created September 11, 2014 22:24
Issues a reset of the SuperMicro BMC via the web interface
#!/usr/bin/env bash
# Issues a reset of the SuperMicro BMC via the web interface
#
# usage: supermicro-bmc-reset.sh <ipmi-host>
# e.g.: supermicro-bmc-reset.sh 10.0.0.1
#
set -x