This repository demonstrates a Website Fingerprinting (WF) attack targeting Android applications using Tor.
- TorCollect is an Android app that utilizes the
TrafficStatsAPI. - It works with
server.pyto collect upload/download traffic statistics from the device. - To simulate WF attacks on Tor users, we use the Orbot app to route all Android traffic through Tor.
To collect Tor traffic data from your Android device, follow these steps:
-
Set up Tor on your computer
- Create a
torrcfile with the following lines:HiddenServiceDir /path/to/hidden_service/ HiddenServicePort 80 127.0.0.1:5001 - This will generate a
.onionaddress inside thehostnamefile in the specified directory.
- Create a
-
Start Tor on your computer
- Make sure the hidden service is running.
-
Configure your Android device
- Install and launch Orbot.
- Ensure it routes traffic through the Tor network.
-
Run the server and client
- Run
server.pyon your computer. - Launch the TorCollect app on your Android device.
- Run
- The app will send upload/download traffic data to the server via the Tor network using the generated
.onionaddress.
-
Run
raw_to_diff.py
→ Converts cumulative traffic data into difference-based sequences. -
Run
packet_seq_augmentation.py
→ Converts data into a per-packet format and augment the datas on packet sequences. -
Run
attach_noise.py
→ Appends random noise and adjusts sequence lengths to a fixed size.
- Use
model.py(MLP-based) to train and evaluate the WF attack model on the processed traffic data.
- Ensure your
.onionhostname and private key files are not uploaded to public repositories. - All experiments assume traffic is routed through Tor and accessed via hidden services.