# AutoGadgetFS | USB Testing Made Easy

**URL:** <https://onehack.st/t/autogadgetfs-usb-testing-made-easy/195678>\
**Category:** Tools & Scripts\
**Tags:** learning, tools, freebies\
**Created:** [July 30, 2021, 9:13am UTC](https://onehack.st/t/autogadgetfs-usb-testing-made-easy/195678 "2021-07-30T09:13:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueHacker](https://onehack.st/user_avatar/onehack.st/bluehacker/32/174721_2.png) [@BlueHacker](https://onehack.st/u/BlueHacker)\
**Post date:** [July 30, 2021, 9:13am UTC](https://onehack.st/t/autogadgetfs-usb-testing-made-easy/195678/1 "2021-07-30T09:13:16Z")

</div>

[![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/agfslogos.png)](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/agfslogos.png)

[![PayPal Donations](https://camo.githubusercontent.com/c8a8b9a64aae0987f33a44f83c10638512408414/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d446f6e617465266c6162656c3d446f6e617465266d6573736167653d546f253230737570706f7274253230746865253230646576656c6f706d656e742532306f662532304147465326636f6c6f723d626c7565)](https://www.paypal.me/autogadgetfs)

## Table of Contents

1. [What’s AutoGadgetFS ?](https://github.com/ehabhussein/AutoGadgetFS#About)
2. [Requirments](https://github.com/ehabhussein/AutoGadgetFS#Requirments)
3. [The Setup](https://github.com/ehabhussein/AutoGadgetFS#Scenarios)a. [Device testing only](https://github.com/ehabhussein/AutoGadgetFS#Dot)b. [Minimal agfs in the middle setup](https://github.com/ehabhussein/AutoGadgetFS#MMITM)c. [Complete agfs in the middle setup with debugging support](https://github.com/ehabhussein/AutoGadgetFS#FMITM)
4. [USB Device class support](https://github.com/ehabhussein/AutoGadgetFS#Usbdev)
5. [Capabilities](https://github.com/ehabhussein/AutoGadgetFS#Caps)
6. [RoadMap](https://github.com/ehabhussein/AutoGadgetFS#Road)
7. [Installation](https://github.com/ehabhussein/AutoGadgetFS#Installation)a. [Linux](https://github.com/ehabhussein/AutoGadgetFS#Linux)b. [Raspberry Pi Zero with WIFI](https://github.com/ehabhussein/AutoGadgetFS#Rasp)
8. [AutogadgetFS tutorial](https://github.com/ehabhussein/AutoGadgetFS#Tutorial)
9. [ScreenShots](https://github.com/ehabhussein/AutoGadgetFS#Screens)
10. [Youtube Playlist](https://github.com/ehabhussein/AutoGadgetFS#Youtube)
11. [Slack](https://github.com/ehabhussein/AutoGadgetFS#Slack)
12. [Supported by](https://github.com/ehabhussein/AutoGadgetFS#Support)
13. [Buy me a coffee ☕](https://github.com/ehabhussein/AutoGadgetFS#Donate)
14. [Contact me](https://github.com/ehabhussein/AutoGadgetFS#Contact)
15. [Want to contribute ?](https://github.com/ehabhussein/AutoGadgetFS#Cont)

### What’s AutoGadgetFS ?

AutoGadgetFS is an open source framework that allows users to assess USB devices and their associated hosts/drivers/software without an in-depth knowledge of the USB protocol. The tool is written in Python3 and utilizes RabbitMQ and WiFi access to enable researchers to conduct remote USB security assessments from anywhere around the globe. By leveraging ConfigFS, AutoGadgetFS allows users to clone and emulate devices quickly, eliminating the need to dig deep into the details of each implementation. The framework also allows users to create their own fuzzers on top of it.

### Requirments:

- 💻 Host machine running Linux (Debian/Ubuntu/Kali)
- 🥧 Raspberry Pi Zero with WIFI support
- 🎯 Target machine options:
  - Virtual Machine
  - Standalone machine

- 🔌 2 x USB micro cables
- 🔱 Target USB device
- 🐞 Hardware debugger ( Optional )

### The Setup:

Device testing only:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/devtest.jpeg)

Minimal agfs in the middle setup:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/scenario1.jpeg)

Complete agfs in the middle setup with debugging support:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/scenario2.jpeg)

### USB Device class support:

[✔] USB HID Devices fully supported (Man in the middle)

[⚠] Device only testing .. All USB devices (NO Man in the middle)

[⏳] Future releases… All USB devices (Man in the middle)

### Capabilities:

1. Find, Select and Attach to a USB device with ease.
2. Emulate any USB HID device .
3. Perform AGFS in the middle sniffing for HID devices ( save communication to disk ).
4. Device sniffing ( Any device ).
5. Multiple Fuzzers allow you to Fuzz a device or a host.
6. Random fuzzers ( with fixed or random length packets ).
7. Smart Fuzzers that learn from previous USB communications.
8. Describe Fuzzer to tell the Fuzzer which bytes to Fuzz leaving the rest of the packet the same.
9. Gadget Fuzzer.
10. Sequential Fuzzer.
11. Control transfer Enumerator.
12. Replay of packets from a file.
13. Replay of packets from a saved USBLyzer capture.
14. Visual way of presenting packets to allow ease of reverse engineering of the communication.
15. Alerts for device in DFU mode, or if the device leaks information.
16. USB device and host can be anywhere on the internet.
17. Monitor sudden interface changes.

### RoadMap:

1. Sniff control transfer requests to a device and reply to them.
2. MITM and emulate all types of devices.
3. Console/QT based interface.
4. More Interfaces/endpoints support on the RPI zero W.
5. Support more boards like the greatfet.
6. Move to a custom board.
7. Work on making raspberry pi have full support for usb device emulation with all interfaces.
8. correlate sent and received packets via sequence numbers.

### Installation:

### Linux Machine:

- Note: WSL/WSL2 is not supported due to issues with USB pass-through.
- Install Python3, ipython3 ,git, pip and rabbitMQ server

sudo apt install python3 ipython3 git python3-pip rabbitmq-server dfu-util sudo service rabbitmq-server start

- Clone the repository

git clone [https://github.com/ehabhussein/AutoGadgetFS](https://github.com/ehabhussein/AutoGadgetFS) cd AutoGadgetFS

- Install the requirements

sudo -H pip3 install -r requirements.txt

- Downgrade prompt toolkit for better ipython experience:

sudo python3 -m pip install prompt-toolkit~=2.0

- Enable the web interface for rabbitMQ

sudo rabbitmq-plugins enable rabbitmq\_management [http://localhost:15672/](http://localhost:15672/) to reach the web interface

- login to the web interface with the credentials _guest:guest_
  - NOTE: if you are not installing rabbitMQ on `localhost` add the following user and login with it:

sudo rabbitmqctl add\_user autogfs usb4ever sudo rabbitmqctl set\_user\_tags autogfs administrator

- Upload the rabbitMQ configuration file
  - In the overview tab scroll to the bottom to import definitions
  - Upload the file found in: _rabbitMQbrokerconfig/rabbitmq-Config.json_

sudo service rabbitmq-server restart

- Test the installation

sudo ipython3 Python 3.7.7 (default, Apr 1 2020, 13:48:52) Type ‘copyright’, ‘credits’ or ‘license’ for more information IPython 7.9.0 – An enhanced Interactive Python. Type ‘?’ for help. In [1]: import libagfs In [2]: x = libagfs.agfs() \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* AutoGadgetFS: USB testing made easy \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Enter IP address of the rabbitmq server: 127.0.0.1 In [3]: exit sudo `python3` agfsconsole.py \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* AutoGadgetFS: USB testing made easy \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Enter IP address of the rabbitmq server: 127.0.0.1 Give your project a name?!:

- Patch Pyusb langID ( Not needed unless you get pyusb errors for langID ):
  - Edit the file `/usr/local/lib/python3/dist-packages/usb/util.py`
    - make changes to the `def get_string` method to look like below:

if 0 == len(langids): return “Error Reading langID” #raise ValueError(“The device has no langid”) if langid is None: langid = langids[0] elif langid not in langids: return “Error Reading langID” #raise ValueError(“The device does not support the specified langid”)

```
* If you prefer to use `patch` apply the following patch to the file: `AutoGadgetFS/pyusb_patches/pyusb_langid.patch`

```

### Raspberry Pi Zero W:

- Obtain a copy of [Raspian Lite Edition](https://downloads.raspberrypi.org/raspios_lite_armhf_latest)
  - Burn the Image to the SD card using [BalenaEtcher](https://www.balena.io/etcher/)

- Mount the SD card on your machine and make the following changes:
  - In the `/path/to/sdcard/boot/config.txt` file add to the very end of the file:

enable\_uart=1 dtoverlay=dwc2

- In the `/path/to/sdcard/boot/cmdline.txt` add right after `rootwait`

modules-load=dwc2

- it should look like this make sure its on the same line:

console=serial0,115200 console=tty1 root=PARTUUID=6c586e13-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2

- Enable ssh:
  - in the `/path/to/sdcard/boot` directory create an empty file name ssh:

sudo touch /path/to/sdcard/boot/ssh

- Enable Wifi:
  - in the `/path/to/sdcard/boot` directory create an file named `wpa_supplicant.conf`:

sudo vim /path/to/sdcard/boot/wpa\_supplicant.conf

- Add the following contents:

ctrl\_interface=DIR=/var/run/wpa\_supplicant GROUP=netdev update\_config=1 country=US network={ ssid=“” psk=“” key\_mgmt=WPA-PSK }

- Unmount the SD card and place it back into the Raspberry Pi Zero and power it on.
- Copy the content of `AutogadgetFS/Pizero/` to the Pi zero: `username: pi` & `password: raspberry`

cd AutogadgetFS/Pizero/ scp gadgetfuzzer.py removegadget.sh requirements.txt router.py pi@:/home/pi

- SSH into the PI Zero and setup requirements for AutoGadgetFS:

ssh pi@ chmod +x removegadget.sh sudo apt update sudo apt install python3 python3-pip sudo -H pip3 install -r requirements.txt

- Upgrading the latest kernel and adding modules (\* This step is optional for the current release): ( This will take a very long time compiling on the Pi Zero, unless you choose to cross compile the kernel see [Compiling options](https://www.raspberrypi.org/documentation/linux/kernel/building.md))

sudo bash apt install git bc bison flex libssl-dev make libncurses5-dev screen screen mkdir Downloads cd Downloads/ git clone --depth=1 [https://github.com/raspberrypi/linux](https://github.com/raspberrypi/linux) cd linux/ make bcmrpi\_defconfig make menuconfig

- Enable the Modules and save the config:

[![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets.png)](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets.png)

[![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets2.png)](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets2.png)

[![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets3.png)](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets3.png)

[![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets4.png)](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/allgadgets4.png)

- Build and use the kernel:

make zImage modules dtbs make modules\_install cp arch/arm/boot/dts/_.dtb /boot/ cp arch/arm/boot/dts/overlays/_.dtb\* /boot/overlays/ cp arch/arm/boot/dts/overlays/README /boot/overlays/ cp arch/arm/boot/zImage /boot/kernel.img reboot

#### And you’re done!

### AutoGadgetFS tutorial:

[Click to visit the tutorial](https://docs.agfs.io/)

### Screenshots:

##### Man in the Middle:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/mitm.png)

#### USB device fuzzing:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/devfuzzer.png)

#### Host side fuzzing with code covereage:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/codecov.png)

#### Fuzzer based on a selection of bytes:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/selectivefuzz.png)

#### Smart fuzzer based on learning traffic:

In [44]: x.devSmartFuzz(engine=“smart”,samples=5,filename=“/home/raindrop/PycharmProjects/AutoGadgetFs/binariesdb/Nud-Nuvoton-1046-20764-1590421333.5169587-Nuvoton-1046-20764-1590421600.8067 …: 274-device.bin”) [+]General Statistics Full charset : !"#$%&'()\*+,-./0123456789:;\<=\>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ^\_`abcdefghijklmnopqrstuvwxyz{|}~ Discarded charset : !"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ghijklmnopqrstuvwxyz{|}~ Final charset : 0123456789abcdef Word Length : 128 Lower Case index usage : 92% Lower Case index locations : [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 121, 122, 124, 125, 127] Upper Case index usage : 0% Upper Case index locations : Digit index usage : 96% Digit index locations : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 123, 126] NonAN index usage : 0% NonAN index locations : Counter statistics : Uppercase: 0 , Lowercase: 133071, Digits:212017 , NonAlphaNumeric:0 All char Frequencies : character:5 found:5012 times character:2 found:22563 times character:3 found:12197 times character:8 found:15008 times character:4 found:13275 times character:0 found:98056 times character:1 found:17861 times character:f found:87823 times character:d found:7221 times character:7 found:9614 times character:a found:11148 times character:6 found:10472 times character:b found:8189 times character:9 found:7959 times character:c found:9172 times character:e found:9518 times \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* generated:5 Packets \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Out[44]: [‘5608305852bf2ffd61770e2c827542f20be0b0fcba09db916bd07e1734b04cb0352b1d278068064d19f033bfad6fa90e53d865693fd4fee0214f00000eb0aa2c’, ‘3b083595f276e2f1353a535c32f0f59516fc9328f7673bb80262c4da11c93683afe6dcff8a7a83018d78f41498a0da4d141ebd39c361b1724f2b00000eb0aa2c’, ‘0120961963495c4dab9470738b497eddde07b0d70b357795ad9554d7964761969a6d997205e17eada6fa84eb33dcfb11412f75e04c195001283900000eb0aa2c’, ‘091065d52127bbc6e840e02f8e1316f1c4d9c92a23931c00cdbb8c158368852ef8fabd461b98812b51ec84e1ccc5c04aaa366fbafabec623bd3500000eb0aa2c’, ‘7300cc61151b7af27a578e766f49bebb2de68c48b37a00df1030ae464f456928eedd035303e697208bf58217af728a2a346fda5c8aef0335b82e00000eb0aa2c’ In [46]: x.edap.packets Out[46]: [‘5608305852bf2ffd61770e2c827542f20be0b0fcba09db916bd07e1734b04cb0352b1d278068064d19f033bfad6fa90e53d865693fd4fee0214f00000eb0aa2c’, ‘3b083595f276e2f1353a535c32f0f59516fc9328f7673bb80262c4da11c93683afe6dcff8a7a83018d78f41498a0da4d141ebd39c361b1724f2b00000eb0aa2c’, ‘0120961963495c4dab9470738b497eddde07b0d70b357795ad9554d7964761969a6d997205e17eada6fa84eb33dcfb11412f75e04c195001283900000eb0aa2c’, ‘091065d52127bbc6e840e02f8e1316f1c4d9c92a23931c00cdbb8c158368852ef8fabd461b98812b51ec84e1ccc5c04aaa366fbafabec623bd3500000eb0aa2c’, ‘7300cc61151b7af27a578e766f49bebb2de68c48b37a00df1030ae464f456928eedd035303e697208bf58217af728a2a346fda5c8aef0335b82e00000eb0aa2c’]

#### Help method:

In [15]: x.help(“”) Currently supported methods: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ Method ||–\>Description ---------------------------------------------------------------------------------------------------------------------------- MITMproxy ||–\>This method creates a connection to the RabbitMQ and listen on received messages on the todev queue \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ MITMproxyRQueues ||–\>This method reads from the queue todev and sends the request to the device its self. \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ SmartFuzz ||–\>This method is generates packets based on what it has learned from a sniff from either the host or the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ chgIntrfs ||–\>This method allows you to change and select another interface \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ clearqueues ||–\>this method clears all the queues on the rabbitMQ queues that are set up \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ clonedev ||–\>This method does not need any parameters it only saves a backup of the device incase you need to share it or use it later. \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ createctrltrsnfDB ||–\>creates a SQLite database containing values that were enumerated from control transfer enumeration \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ createdb ||–\>create the sqlite table and columns from usblyzer captures \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ decodePacketAscii ||–\>This method decodes packet bytes back to Ascii \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ describeFuzz ||–\>This method allows you to describe a packet and select which bytes will be fuzzed \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devEnumCtrltrnsf ||–\>This method enumerates all possible combinations of a control transfer request \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devReset ||–\>This method Resets the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devWrite ||–\>To use this with a method you would write to a device make sure to run the startSniffReadThread(self,endpoint=None, pts=None, queue=None,channel=None) \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devctrltrnsf ||–\>This method allows you to send ctrl transfer requests to the target device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ deviceInfo ||–\>gets the complete info only for any usb connected to the host \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ deviceInterfaces ||–\>get all interfaces and endpoints on the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devrandfuzz ||–\>this method allows you to create fixed or random size packets created using urandom \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ devseqfuzz ||–\>This method allows you to create sequential incremented packets and send them to the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ findSelect ||–\>This method enumerates all USB devices connected and allows you to select it as a target device as well as its endpoints \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ help ||–\>AutogadgetFS Help method \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ hostwrite ||–\>This method writes packets to the host either targeting a software or a driver in control of the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ hstrandfuzz ||–\>this method allows you to create fixed or random size packets created using urandom and send them to the host queue \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ monInterfaceChng ||–\>Method in charge of monitoring interfaces for changes this is called from def startMonInterfaceChng(self) \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ newProject ||–\>creates a new project name if you were testing something else \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ releasedev ||–\>releases the device and re-attaches the kernel driver \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ removeGadget ||–\>This method removes the gadget from the raspberryPI \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ replaymsgs ||–\>This method searches the USBLyzer parsed database and give you the option replay a message or all messages from host to device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ searchmsgs ||–\>This method allows you to search and select all messages for a pattern which were saved from a USBlyzer database creation \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ setupGadgetFS ||–\>setup variables for gadgetFS : Linux Only, on Raspberry Pi Zero best option \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ showMessage ||–\>shows messages if error or warn or info \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ sniffdevice ||–\>read the communication between the device to hosts \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ startMITMusbWifi ||–\>Starts a thread to monitor the USB target Device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ startMonInterfaceChng||–\>This method Allows you to monitor a device every 10 seconds in case it suddenly changes its interface configuration. \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ startQueuewrite ||–\>initiates a connection to the queue to communicate with the host \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ startSniffReadThread ||–\>This is a thread to continuously read the replies from the device and dependent on what you pass to the method either pts or queue \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ stopMITMusbWifi ||–\>Stops the man in the middle thread between the host and the device \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ stopMonInterfaceChang||–\>Stops the interface monitor thread \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ stopQueuewrite ||–\>stop the thread incharge of communicating with the host machine \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ stopSniffing ||–\>Kills the sniffing thread strted by startSniffReadThread() \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ usblyzerparse ||–\>This method will parse your xml exported from usblyzer and then import them into a database \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ In [16]: x.help(“findSelect”) \*\*\*\* [+]Help for findSelect Method: [-]Signature: findSelect(self, chgint=None) [+]findSelect Help: This method enumerates all USB devices connected and allows you to select it as a target device as well as its endpoints \*\*\*\*

#### AutoGadgetFS console. A much simpler way to use AGFS:

![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/agfsconsole.png)

### Youtube Playlist:

[Youtube Playlist](https://www.youtube.com/playlist?list=PLKozlVgM6RQjNHmpWR2RBiFCtufV03o6Z)

### Join Slack:

Visit [AutogadgetFS Slack Channel](https://join.slack.com/t/autogadgetfs/shared_invite/zt-emgcv3ol-unG_axHmSQlk~5GcBddhlQ)

### Supported by:

![](https://camo.githubusercontent.com/f5421792f7221929b7984bbda67f96b5ccaedae2/68747470733a2f2f7062732e7477696d672e636f6d2f70726f66696c655f696d616765732f313033393933313331353736363837303031362f61684f76657644555f343030783430302e6a7067) ![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/JetBrains.png) ![](https://github.com/ehabhussein/AutoGadgetFS/raw/master/screenshots/pyusb.png) ![](https://camo.githubusercontent.com/da6c0aab51c5d38714d80f3569ee4ff6238dd436/68747470733a2f2f692e696d6775722e636f6d2f723658454c45662e706e67)

## GitHub:

> **[GitHub - ehabhussein/AutoGadgetFS: USB testing made easy](https://github.com/ehabhussein/AutoGadgetFS)**
>
> USB testing made easy
