Skip to content

Instantly share code, notes, and snippets.

View DavidWittman's full-sized avatar

David Wittman DavidWittman

View GitHub Profile
@DavidWittman
DavidWittman / supermicro-psblock-fix.expect
Last active January 27, 2022 20:02
This expect script secures SuperMicro IPMI implementations which are vulnerable to viewing the IPMI password in plaintext on port 49152.
#!/usr/bin/expect -f
# This script secures SuperMicro IPMI implementations which are vulnerable
# to viewing the IPMI password in plaintext on port 49152. It does this by
# using the shell available in some SuperMicro BMCs to drop traffic to port
# 49152 in iptables.
#
# See http://blog.cari.net/carisirt-yet-another-bmc-vulnerability-and-some-added-extras/
# for more details on the vulnerability.
#
@DavidWittman
DavidWittman / hubot.conf
Created March 6, 2012 05:55
Hubot Upstart Script
# hubot
description "Hubot Campfire bot"
author "David Wittman <david@wittman.com>"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/opt/hubot/'
@DavidWittman
DavidWittman / http-get.nse
Created April 6, 2012 06:19
Nmap HTTP GET request script
description = [[
Issues an arbitrary HTTP GET request
]]
---
-- @usage
-- nmap --script http-get [--script-args http-get.path=/status] -p <port> <host>
-- @args http-get.path The path to request (defaults to /)
-- http-get.match String to match in the HTTP response (incl. headers)
-- @output
@DavidWittman
DavidWittman / check_peer_interfaces.py
Last active April 3, 2021 19:12
Checks to see if two interfaces are on the same network on Linux. Useful when bonding interfaces.
#!/usr/bin/env python
# check_peer_interfaces.py
# Author: David Wittman <david@wittman.com>
#
# Checks to see if two interfaces are on the same network by sending a
# unique broadcast packet out of the first interface and listening for that
# packet on the second interface.
#
# Assumes that you're running a Linux variant, and that both interfaces
@DavidWittman
DavidWittman / ansible-dynamic-inventory-converter.py
Created April 12, 2016 22:42
Script for converting Ansible dynamic inventory to static files. It's not perfect, but it'll get you 90% of the way there.
#!/usr/bin/env python
# Converts Ansible dynamic inventory sources to static files
# Input is received via stdin from the dynamic inventory file
# ex:
# ec2.py --list | ansible-dynamic-inventory-converter.py
import json
import os
import sys
@DavidWittman
DavidWittman / merge-s3-parts.sh
Created December 23, 2015 16:47
Script to merge .part files from Amazon S3
#!/usr/bin/env bash
if [[ $# -ne 1 ]]; then
echo "Merge matching *.part files in a directory"
echo
echo "usage: $0 <directory>"
exit 1
fi
DIRECTORY="$1"
@DavidWittman
DavidWittman / ms120-020.py
Created April 5, 2012 17:05
MS12-020/CVE-2012-0002 Vulnerability Tester
#!/usr/bin/env python
"""
MS12-020/CVE-2012-0002 Vulnerability Tester
based on sleepya's version @ http://pastebin.com/Ks2PhKb4
"""
import socket
import struct
import sys

Create a Windows OpenStack VM with VirtualBox

0. Obtain Windows ISO

  • Use an existing ISO or copy from a CD with dd if=/dev/cdrom of=image.iso

1. Boot VirtualBox VM from Windows ISO

  • Qcow disk type
  • 40GB Root Disk
  • Load your Windows ISO to the Primary CD drive
  • Add a secondary CD drive and attach the VirtIO ISO to it
@DavidWittman
DavidWittman / clouddns-export.py
Last active December 12, 2018 01:06
Exports all domains for a Rackspace Cloud account in BIND9 format
#!/usr/bin/env python
import json
import os
import time
import clouddns
USERNAME = ''
APIKEY = ''
@DavidWittman
DavidWittman / python-nested_list_comprehensions.md
Created July 26, 2012 20:08
Nested list comprehensions in Python

Nested list comprehensions in Python

For some reason or another, I'm always second guessing myself when writing nested list comprehensions. Here's a quick example to clarify what's going behind the scenes:

>>> words = ["foo", "bar", "baz"]
>>> [letter for word in words for letter in word]
['f', 'o', 'o', 'b', 'a', 'r', 'b', 'a', 'z']