Repo for the paper "USB Devices phoning home"
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config_files Add dnsmasq config. Jul 15, 2015

Repo for the paper "USB Devices phoning home"


General information about our armory setup


  • add sudo group
  • uncomment sudo group line (visudo)
  • add users with groups, add users to sudo group


  • Default config in /etc/systemd/network/

  • Changed default IP to and gateway to

  • Host-Script to NAT network traffic for the armory:

    /sbin/ip l s usb0 up
    /sbin/ip addr add dev usb0
    /sbin/iptables -t nat -A POSTROUTING -s -o wlan0 -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward

Installed Packages

  • dnsmasq

  • inotify-tools

  • vim

  • base-devel

  • screen

  • tmux

  • wget

  • go:

    # cd /opt
    # git clone
    # cd go
    # git checkout go1.4.2
    # cd src
    # ./all.bash
    • The file file_test.go had to be deleted from src/net as the test failed (see source)

    • Add Go env settings to /etc/profile

      export GOROOT
      export GOPATH
      export PATH

USB Gadget

Switched from g_cdc to g_multi because it includes g_mass_storage. Using the PID and VID of a SAMSUNG N7000 to make Windows 8 load the necessary drivers.

# cd /etc/modprobe.d/
# echo 'options g_multi dev_addr=de:ad:be:ef:00:01 iManufacturer="Android" idVendor=0x04e8 idProduct=0x6864 file="/root/pendrive.img"' > gadget-deadbeef_multi.conf
# dd if=/dev/zero bs=1M count=128 of=/root/pendrive.img
# use fdisk to create one partition in pendrive.img
# and use mkfs.vat -F 32 to give it a FAT32 filesystem
# cd /etc/modules-load.d/
# mv gadget-deadbeef.conf
# echo 'g_multi' > gadget-deadbeef_multi.conf

Rebuild g_multi without ecm cdc support for better windows compatibility:

svn co
make oldconfig && make prepare
make scripts
make menuconfig # enable usb gadget drivers and enable only rndis for g_multi
make -C /full/path/linux-armv7/src/linux-4.1/ M=/full/path/linux-armv7/src/linux-4.1/drivers/usb/gadget/legacy/
cp linux-armv7/src/linux-4.1/drivers/usb/gadget/legacy/g_multi.ko /lib/modules/$(uname -r)/kernel/drivers/usb/gadget/
sudo depmod -a


Enable them by running:

# systemctl daemon-reload