Mode switcher for USB armory
USB armory is a flash drive sized secure computing device with an ARM processor. You may purchase it with a micro-SD card, on which a Debian is preinstalled. The preinstalled configuration enables a network connection from the host device. But should you want a different network configuration, for example one sharing Internet connexion from the host computer (look at these instructions), you will need this script to do it without much editing:
#!/bin/sh | |
# | |
# Function switcher for USB armory | |
if [ $# -eq 0 -o $# -eq 1 -a \( "$1" != "stick" -a "$1" != "stick-win" -a "$1" != "stick-mac" -a "$1" != "host" \) ] | |
then | |
echo "Usage: $0 stick|stick-win|stick-mac|host" | |
exit 1 | |
fi | |
if [ `id -u` -ne 0 ] | |
then | |
sudo bash $0 "$@" | |
exit | |
fi | |
if [ $1 = "stick" ] | |
then | |
echo Switching to stick | |
ln -sf /boot/imx53-usbarmory-default-4.14.52-0.dtb /boot/imx53-usbarmory.dtb | |
sed -i -e 's/\(.*\)address .*$/\1address 10.0.0.1/' /etc/network/interfaces | |
sed -i -e 's/\(.*\)gateway .*$/\1gateway 10.0.0.2/' /etc/network/interfaces | |
elif [ $1 = "stick-win" ] | |
then | |
echo Switching to stick for Windows | |
ln -sf /boot/imx53-usbarmory-default-4.14.52-0.dtb /boot/imx53-usbarmory.dtb | |
sed -i -e 's/\(.*\)address .*$/\1address 192.168.137.200/' /etc/network/interfaces | |
sed -i -e 's/\(.*\)gateway .*$/\1gateway 192.168.137.1/' /etc/network/interfaces | |
elif [ $1 = "stick-mac" ] | |
then | |
echo Switching to stick for MacOSX | |
ln -sf /boot/imx53-usbarmory-default-4.14.52-0.dtb /boot/imx53-usbarmory.dtb | |
sed -i -e 's/\(.*\)address .*$/\1address 192.168.2.200/' /etc/network/interfaces | |
sed -i -e 's/\(.*\)gateway .*$/\1gateway 192.168.2.1/' /etc/network/interfaces | |
elif [ $1 = "host" ] | |
then | |
echo Switching to host | |
ln -sf /boot/imx53-usbarmory-host-4.14.52-0.dtb /boot/imx53-usbarmory.dtb | |
sed -i -e 's/\(.*\)wpa-ssid .*$/\1wpa-ssid SSID_of_a_wifi_network' /etc/network/interfaces | |
sed -i -e 's/\(.*\)wpa-psk .*$/\1wpa-psk PASSWORD_of_a_wifi_network' /etc/network/interfaces | |
fi |
The last configuration, host
, was created for using with host adapter and a wi-fi USB adapter (I used this one). After installing the packages wireless-tools
and realtek-firmware
and a little configuration in the file /etc/network/interfaces
, it just worked. Of course, you will need to replace the strings SSID_of_a_wifi_network
and PASSWORD_of_a_wifi_network
with appropriate values to connect to your wi-fi network automatically; use wpa_passphrase
to generate wi-fi password hashes.