Skip to content

MobiSec-CSE-UTA/SnoopDog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SnoopDog: Detecting USB Bus Sniffers Using Responsive EMR

SnoopDog Colab to test Method(Section 5) in the paper without hardwares

Colab link

Expected result of Colab

target data file to load =  ./recorded_data/benign1.data
8 fold record data has been loaded.
Detection result : False
	DTW distance: 5.0 

target data file to load =  ./recorded_data/benign2.data
8 fold record data has been loaded.
Detection result : False
	DTW distance: 5.0 

target data file to load =  ./recorded_data/malicious1.data
8 fold record data has been loaded.
Detection result : True
	DTW distance: 0.0 

target data file to load =  ./recorded_data/malicious2.data
8 fold record data has been loaded.
Detection result : True
	DTW distance: 0.0 

Directory structure

SnoopDog\
β”œβ”€β”€ artifact\
β”‚   β”œβ”€β”€ detector\ <- Source codes for Detector
β”‚   β”‚   β”œβ”€β”€ recorded_data\
β”‚   β”‚   β”‚   β”œβ”€β”€ benign1.data
β”‚   β”‚   β”‚   β”œβ”€β”€ benign2.data
β”‚   β”‚   β”‚   β”œβ”€β”€ malicious1.data
β”‚   β”‚   β”‚   └── malicious2.data
β”‚   β”‚   β”œβ”€β”€ rtl_power_library\
β”‚   β”‚   β”‚   β”œβ”€β”€ rtl-sdr\ <- library for rtl-sdr device
β”‚   β”‚   β”‚   └── README.md
β”‚   β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”‚   β”œβ”€β”€ client.py
β”‚   β”‚   └── detect_with_recorded_data.py
β”‚   β”‚   └── detector.py
β”‚   β”‚   └── pyrtl_power.py
β”‚   β”œβ”€β”€ server\ <- Source codes for Server
β”‚   β”‚   β”œβ”€β”€ BaitPacketTransmitter.py
β”‚   β”‚   └── Server.py
β”‚   └── Iso image
β”‚   β”‚   └── download_iso.sh
β”‚   └── detector.zip <-- same as detector folder
β”‚   └── server.zip <-- same as server folder
β”œβ”€β”€ claim\
β”‚   └── claim1\
β”‚       β”œβ”€β”€ recorded_data\
β”‚       β”‚   β”œβ”€β”€ benign1.data
β”‚       β”‚   β”œβ”€β”€ benign2.data
β”‚       β”‚   β”œβ”€β”€ malicious1.data
β”‚       β”‚   └── malicious2.data
β”‚       β”œβ”€β”€ expected output.txt
β”‚       β”œβ”€β”€ requirements.txt
β”‚       β”œβ”€β”€ run.sh
β”‚       └── snoopdog_detector.py
β”œβ”€β”€ infrastructure\
β”‚   └── colab_link.txt
└── README.md

Source code description

For SnoopDog detector

  1. client.py

    Communication codes to send/receive commands from/to Host PC

  2. detect_with_recorded_data.py

    Source code for detector including detection method in the paper. This program takes raw measurement of EMR signals from the USB device for detection.

    For details, please go to "Run Snoopdog with recorded data"

  3. detector.py Source code for detector including detection method in the paper. This program requires real-world hardware environment.

For Host PC

  1. server.py

    Source code for Host PC including communication codes.

  2. BaitPacketTransmitter.py

    Source code for transmitting bait traffic to Host PC.

Hardware requirements

  1. Raspberry Pi 4b or later with USB gadget functionallity
  2. Auxiliary power for Raspberry Pi
  3. RTL-SDR
  4. Near-Field probe

Example of the detector hardware

hardware_of_snoopdog

Note: We use Pisugar external battery to power our RPi.
The power from USB connection from Host PC might be insufficient to operate the detector based on our experience.

Software requirements for detector (Raspberry Pi)

  1. Python 3.12 or later
  2. numpy
  3. scipy
  4. fastdtw
  5. Radio pi

Software requirements for Host PC

  1. Python 3.12 or later
  2. RNDIS driver (if the detector is not recognized)

Detector set-up

We provide two setup options:

  1. Use iso image and flash to your RPi SD card to duplicate our detector.
  2. Use your RPi and bring up manually.

1. use iso image and make sdcard to duplicate our detector

  1. Navigate to Iso image
cd artifact/Iso image/
  1. Download Snoopdog.img (the size of the image file is 12Gb)
bash ./run.sh

or

wget -c -O snoopdog.iso https://tinyurl.com/4pphfmb9
  1. burn image into sdcard

Β Β Β Β Β Β  for linux for Mac, use dd command

1. Find your sdcard in your linux system. (you may use 'lsblk')
2. Use dd to copy snoopdog.img to your sdcard.
  sudo dd if=/dev/<your sdcard> of=snoopdog.img bs=4M status=progress conv=fsync

Β Β Β Β Β Β  for Windows, you may use rufus

Β Β Β Β Β Β  Download rufus
Β Β Β Β Β Β  Select your sd card and select snoopdog.img
Β Β Β Β Β Β  Click start button

  1. plug your copied sdcard into your raspberry pi.

2. Use your raspberry pi and set up manually.

  1. Download pisdr image on your SD card you may use dd or rufus
  sudo dd if=/dev/<your sdcard> of=pisdr.img bs=4M status=progress conv=fsync

Β Β Β Β Β Β  replace 'pisdr.img' with the actuall file name of the iso file downloaded from pisdr

  1. Boot up your raspberry pi and access it using ssh for default ID/passwd check pisdr.
  2. install or check python 3.12
  3. Download our detector source codes
  wget https://github.com/MobiSec-CSE-UTA/SnoopDog/tree/main/artifact/detector.zip
  unzip ~/detector.zip
  1. install requirements
cd ~/detector
python -m pip install -r requirements.txt
  1. enable USB gadget g_ether
  • Open Terminal on the RPi.

  • Open the file /boot/config.txt.

  • Add the following line:

    dtoverlay=dwc2
  • Save and exit the file.

  • Navigate to /boot/cmdline.txt.

  • Add the following text at the end of the line, after rootwait:

    modules-load=dwc2,g_ether
  • Save and exit the file.

  • open /etc/dhcpcd.conf file.

  • add following lines

      interface usb0
      static ip_address=192.168.7.2
  • Save and exit the file.

  • reboot your raspberry pi

Host PC set-up

  1. Download Our project for Host PC
wget https://github.com/MobiSec-CSE-UTA/SnoopDog/tree/main/artifact/server.zip
unzip server.zip
cd host

Installing the RNDIS driver

Follow these instructions only if your PC cannot recognize the RPi.

For Windows PC:
  1. Download the RNDIS driver from Microsoft Update Catalog.
  2. Open Device Manager β†’ navigate to Other drivers β†’ RNDIS/Ethernet Gadget β†’ right-click and select Update Driver Software.
  3. Choose the file downloaded in step 1.
  4. Reboot and reconnect all systems.
For Linux PC:
  • The RPi will appear as a network interface automatically.

Connect Snoopdog detector and Host PC

Connection_diagram

The detector should be recognized as a network interface when it is attached to Host PC.

Please follow the diagram above to connect the detector, a USB hub and Host PC.

Run SnoopDog to detect a malicious sniffer

Upon connecting the detector & hub,

  1. Locate the ipaddress of Host PC
for Windows, open Powershell/CMD β†’ 'ipconfig'
for linux and Mac, open terminal β†’ 'ifconfig'

If the SnoopDog detector is properly recognized, then your Host PC optains an ip address from the detector. The ipaddress should be 192.168.7.xxx, the 'xxx' octet represents the Host PC

  1. Run snoopdog server on Host PC
python server.py -p 5050
  1. Open terminal and connect to the detector using ssh.
ssh snoopdog@192.168.7.2

the password is 'raspberry'

  1. Run snoopdog_detector.py
python ./snoopdog_detector.py -i 192.168.7.<replace with your Host ip addrss> -p 5050
  1. The program will display the result.

Run Snoopdog with recorded data

For users who do not have the required hardware/environment for SnoopDog, We provide a recorded raw EMR data to test SnoopDog.

Requirements

  • Python 3.12 or later

Automatic install

Requirements

  • Ubuntu 22.04
  1. Clone this repo
  2. Run install.sh with sudo
cd Snoopdog
chmod +x ./install.sh
sudo ./install.sh
  1. Activate venv and navigate to the folder for claim1
source Snoopdog/bin/activate
cd ./claims/claim1/
  1. Run run.sh
chmod +x ./run.sh
./run.sh

Manual install

Please follow the steps mentioned here:

  1. Download and unzip detector.zip by
wget https://github.com/MobiSec-CSE-UTA/SnoopDog/tree/main/artifact/detector.zip
unzip detector.zip
  1. Navigate into the detector folder
cd  detector
  1. Run code To test recorded data from a malicious sniffer
python ./snoopdog_detect_with_recorded_data.py -d ./recorded_data/malicious1.data

To test recorded data from a benign device.

python ./snoopdog_detect_with_recorded_data.py -d ./recorded_data/malicious1.data

Or you may run without designation of the file.

python ./snoopdog_detect_with_recorded_data.py

in this case, the program will ask which option you want to test.

About

Artifacts for SnoopDog (ACSAC 2025)

Resources

License

GPL-2.0, GPL-2.0 licenses found

Licenses found

GPL-2.0
LICENSE
GPL-2.0
license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors