Reboot, and you should have support for a simple USB host device (image stored in /root/backingstore.img), USB ethernet, serial port, etc. Hopefully this is helpful to people, and please let me know if there are obvious improvements (I'm new to the USB gadget interface, and there are probably some gotchas). Confirmed working on a MBP Retina with OS X Yosemite.
#!/bin/bash
# assumes a disk image exists here...
FILE=/root/backingstore.img
N="usb0"
modprobe -r g_ether
modprobe usb_f_mass_storage
modprobe usb_f_acm
modprobe usb_f_hid
modprobe usb_f_rndis
modprobe usb_f_ecm
modprobe usb_f_serial
cd /sys/kernel/config/usb_gadget/
mkdir -p usbarmory
cd usbarmory
#echo '' > UDC
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
mkdir -p strings/0x409
echo "fedcba9876543210" > strings/0x409/serialnumber
echo "Inverse Path" > strings/0x409/manufacturer
echo "USB Armory" > strings/0x409/product
mkdir -p functions/acm.$N
mkdir -p functions/ecm.$N
mkdir -p functions/hid.$N
mkdir -p functions/mass_storage.$N
# first byte of address must be even
HOST="1a:55:89:a2:69:42" # "HostPC"
SELF="1a:55:89:a2:69:41" # "BadUSB"
echo $HOST > functions/ecm.$N/host_addr
echo $SELF > functions/ecm.$N/dev_addr
echo 1 > functions/mass_storage.$N/stall
echo 0 > functions/mass_storage.$N/lun.0/cdrom
echo 0 > functions/mass_storage.$N/lun.0/ro
echo 0 > functions/mass_storage.$N/lun.0/nofua
echo $FILE > functions/mass_storage.$N/lun.0/file
echo 1 > functions/hid.0/protocol
echo 1 > functions/hid.0/subclass