Skip to content

Instantly share code, notes, and snippets.

View dwallraff's full-sized avatar

Dave Wallraff dwallraff

View GitHub Profile
@dwallraff
dwallraff / cdp_dump.sh
Created December 23, 2015 23:10
TCPDump command to sniff Cisco CDP packets
tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
#CDP packets offer some additional insight to the network you're on:
#The information contained in CDP announcements varies by the type of device and the version of the operating system running on it. Information contained includes the operating system version, hostname, every address for every protocol configured on the port where CDP frame is sent eg. IP address, the port identifier from which the announcement was sent, device type and model, duplex setting, VTP domain, native VLAN, power draw (for Power over Ethernet devices), and other device specific information.
#You tcpdump output might look something like (IP address XX'd out):
#14:42:57.087609 CDPv2, ttl: 180s, checksum: 692 (unverified), length 358
# Device-ID (0x01), length: 11 bytes: 'Public_DMZ'
# Address (0x02), length: 13 bytes: IPv4 (1) XXX.XXX.XX.X
# Port-ID (0x03), length: 16 bytes: 'FastEthernet0/21'
# Capability (0x04), length: 4 bytes: (0x00000028): L2 Switc
@dwallraff
dwallraff / ccdb.sql
Last active February 25, 2016 00:52
CCDB Service removal
psql -h localhost -p 2544 -U admin ccdb
SELECT id,name FROM service_instances;
DELETE FROM service_instances WHERE id=X;
If that fails:
SELECT * FROM service_instance_operations WHERE service_instance_id=X;
DELETE FROM service_instance_operations WHERE service_instance_id=X;
DELETE FROM service_instances WHERE id=X;
@dwallraff
dwallraff / get_cns.sh
Last active March 8, 2016 16:48
Get CNs from all certs in a manifest
sed -n -e '/BEGIN CERTIFICATE/,/END CERTIFICATE/ p' <file> | sed -e 's/^ *//g' | sed -e 's/-----END CERTIFICATE-----/-----END CERTIFICATE-----,./' | tr , '\n' | while read -d $'.' var; do echo "$var" | openssl x509 -text -noout; done | grep "Subject:"
@dwallraff
dwallraff / check_stemcell_version.sh
Last active March 2, 2016 22:07
Script to compare your deployed (single) stemcell with the current version of the stemcell
#!/bin/bash
WEB=$(curl -v --silent https://bosh.io/d/stemcells/bosh-azure-hyperv-centos-7-go_agent 2>&1 | grep Location | awk '{print $3}' | cut -d '/' -f 5 | cut -d '-' -f 3)
CUR=$(bosh stemcells 2> /dev/null | grep bosh | awk '{print $6}' | tr -d '*')
if (( $WEB > $CUR )); then
echo "Update stemcell"
else
echo "Stemcell is fine"
fi
@dwallraff
dwallraff / temp.cnf
Last active December 20, 2016 18:53
Temp openssl conf file for Multiple SAN Self-Signed SSL Cert (used in https://gist.github.com/dwallraff/60cd13d68c7de76335a3)
[ req ]
distinguished_name = req_distinguished_name
req_extensions = server_req_extensions
prompt = no
[ req_distinguished_name ]
C = <Your country> # Only 2 characters
ST = <Your state> # Only 2 characters
L = <Your city>
O = <Your org>
@dwallraff
dwallraff / create_cert.sh
Last active September 26, 2019 17:27
Commands to create a self-signed SSL cert or CSRs using the openssl conf from https://gist.github.com/dwallraff/c1ed31291ac7cf19304b
##### Commands to generate SSL certs/artifcts
# Download the temp.cnf file using the wget command below
# Edit temp.cnf and add your information
# Run the uncommented out commands to generate a self-signed cert (cert.pem) and private key (keyfile.pem)
wget https://gist.githubusercontent.com/dwallraff/c1ed31291ac7cf19304b/raw/e06feacbb85ac63659e6c1c40c70d5481522b390/temp.cnf
# Generate a new keyfile. A 2048 bit key size is TOTALLY fine. Jack it up to 4096 and wait if you must...
openssl genrsa -out keyfile.key 2048
@dwallraff
dwallraff / kill_it.sh
Created March 8, 2016 21:59
ApacheBench load testing
apt-get install apache2-utils
# ab -n <num_requests> -c <concurrency> <addr>:<port><path>
ab -n 1000 -c 100 http://localhost:4567/
@dwallraff
dwallraff / azure_limit.sh
Created March 21, 2016 18:41
Azure list region limits
azure vm list-usage <region>
@dwallraff
dwallraff / Stemcell change log
Last active September 7, 2016 20:59
CloudFoundry stemcell change log
http://boshartifacts.cloudfoundry.org/file_collections?type=stemcells
@dwallraff
dwallraff / Release change log
Last active September 7, 2016 20:59
CloudFoundry release change log
http://boshartifacts.cloudfoundry.org/file_collections?type=releases