The USB Ninja is an advanced USB attack development platform designed to be as simple as possible whilst leaving as many options open for development. Written in Golang, it was developed on a Raspberry Pi Zero W, but should work on any device that supports USB OTG - see the list of Supported Devices. It makes heavy use of configfs to configure and present the drivers to the host system. See the FAQ for more information.
Currently supported gadgets are:
- USB-To-Serial
- USB-To-Ethernet
- HID Emulation (currently keyboard only)
- Mass Storage
Please check out ADDED.md for details about all the new features being added!
Looking for some examples? Check out my blog at xcellerator.github.io!
Getting setup with the USBNinja is pretty simple, as long as you're happy with the Linux command-line.
You can follow the instructions below, or head over to my blog here for a more detailed guide on the first time setup!
- First of all, head over to Releases to download the latest release files. You need both
root.tar.gz
andboot.tar.gz
. - Create a new folder (doesn't matter where) to act as our working directory. You'll only need this during the first setup.
- Create two folders within this called
boot
androot
and then copyboot.tar.gz
androot.tar.gz
to the working folder.
- i.e. You should have
boot
,boot.tar.gz
,root
, androot.tar.gz
sitting in your working folder.
- Insert your MicroSD card into your computer and check whats its called under
/dev/
using a quicklsblk
. I use an SD adapter, so its calledmmcblk0
for me. - Now fire up fdisk with
sudo fdisk /dev/mmcblk0
.- Type
o
. This will wipe any existing partitions on the card. - Type
n
, thenp
for a primary partition. - Type
1
for the first partition, then ENTER for the default starting sector, then+100M
for a 100MB boot partition. - Type
t
, thenc
to set the first partition as "W95 FAT32 (LBA)". - Type
n
, thenp
for another primary partition. - Type
2
for the second partition, then ENTER twice to fill the rest of the card. - Now you can write the new partition table with
w
.
- Type
- Next, we create the filesystems on the two partitions:
sudo mkfs.vfat /dev/mmcblk0p1
sudo mkfs.ext4 /dev/mmcblk0p2
- Now, mount the two partitions to our
root
andboot
folders:sudo mount /dev/mmcblk0p1 boot
sudo mount /dev/mmcblk0p2 root
- Extract the release to the mounted partitions
sudo bsdtar -xpf boot.tar.gz
sudo bsdtar -xpf root.tar.gz
- Finally, you can
sync
(this will take a little while - don't worry!) and thensudo umount boot root
to unmount the MicroSD card. - Pop the MicroSD card back into the Raspbery Pi and boot it up! Make sure you use the "USB OTG" port on the board (the one next to the mini-HDMI port).
- After a few seconds, you should see a new serial device show up in
dmesg
. You can use eitherscreen
orminicom
to access it. E.g.sudo minicom -b 115200 -D /dev/ttyACM0
orsudo screen /dev/ttyACM0 115200
.
Note: The default login is alarm:alarm and the root account is root:root. By default the alarm user is already in the wheel group.
The other option is to just download and setup Arch Linux ARM by yourself and follow the instructions in INSTALL.md to compile the binaries from source and setup all the other services. The process is exactly the same as what was done to prepare the image.
If you want to use gadgets other than plain old serial
(and if you're here - you probably do), then all you need to do is edit usbninja/options.txt
on the first partition of the MicroSD card. This corresponds to the /boot
directory when the OS boots up.
See OPTIONS.md and GADGETS.md for more information.
I am not responsible for your actions using this software. Never engage in any activities on any machine that you do not have the express permission to do so. The USBNinja is meant to be used by professionals only.