Giter VIP home page Giter VIP logo

packetdatavisualisationsuite's Introduction

Probe Request & MAC Randomisation Visualisation Suite

M.Sc Dissertation - The Visualisation & Analysis of Device Footprints Though 802.11 Probe Request Frames

Grade - Distinction 79%

Probe requests not using MAC randomisation contain the sender’s MAC address and potentially a previously authenticated network SSID from the searching devices memory. Consequently devices are vulnerable to tracking. Current locations are determined through the presence of a broadcasted MAC address to a receiver and previously visited locations can, in theory, be determined based on the SSIDs contained within the frames. To address this issue, operating system patches have been written to randomise the senders MAC address broadcast within probe requests, in order to make device tracking less trivial. However, adoption of these fixes has been limited, and the success varied across device manufacturers.

This suite was produced to graphically visualise the tracking concerns through cross-referencing contained SSIDs with wardriving WiFi databases, and demonstrated manufacturer patch success rates or failings. This ran on Pythons Flask web framework. The interactive GUI and data representations within the portal were built in JavaScript, making use of D3.js (Data Driven Documents), Crossfilter.js and DC.js.

Dataset Overview

Overview Stats

Manufacturer Analysis

Vendor Overview

SSID Analyis & Geolocation

SSID Analysis

Geolocation

Geolocation

packetdatavisualisationsuite's People

Contributors

adamistheanswer avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar

packetdatavisualisationsuite's Issues

Need help installing

Great project. I am new to linux and I need little help to install your software. I Have raspberry pi zero. I have little home automation project where I have few ESP8266 clients. My project require to collect Mac ID of these ESP devices in raspberry pi to further process in RPIEasy home automation software https://github.com/enesbcs/rpieasy . I took inspiration for this project from here HarringayMakerSpace/sonoff-adhoc#1 . client code is below:

This sketch uses IRremoteESP8266 library from https://github.com/crankyoldgit/IRremoteESP8266.
In order to send MIDEA protocol IR message there is change needed in library
as documented here : https://github.com/crankyoldgit/IRremoteESP8266/issues/887#issuecomment-531314986
Change this line: https://github.com/crankyoldgit/IRremoteESP8266/blob/master/src/IRrecv.h#L402
to:
                   bool strict = false);
e.g.
#if DECODE_MIDEA
  bool decodeMidea(decode_results *results, uint16_t nbits = kMideaBits,
                   bool strict = true);
#endif
On receiver side example can be used from here: https://github.com/happytm/BatteryNode/blob/master/Double%20Receiver/Double_Receiver.ino
*/
#define IRSENDER              true
#define PROBEREQUESTER        true
#define SLEEP_SECS 15 * 60 // 15 minutes
int device = 1;

#if PROBEREQUESTER
#include <ESP8266WiFi.h>


#endif

//============Do not need user configuration from here on============================

 
#if IRSENDER
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
//#include <IRrecv.h>
//#include <IRutils.h>
#endif

#include "SparkFunBME280.h"

ADC_MODE(ADC_VCC); //vcc read-mode

BME280 bme280;




int apChannel = 7;
int temperature = 10;
int humidity = 20;
int pressure = 30;
int voltage = 40;
int light = 50; 

uint8_t irMac[] = {temperature, humidity, pressure, voltage, light, device}; 

int VOLT_LIMIT = 3;
unsigned long lastMillis;
unsigned long passedMillis;
int ledPin = 12;

  

/*
//==============================Probe Request defines starts=======================  
extern "C" void preinit() {
    
   // Change MAC 
    uint8_t mac[6];
    mac[0] = temperature;
    mac[1] = humidity;
    mac[2] = pressure;
    mac[3] = Voltage;
    mac[4] = light;
    mac[5] = device;
  
  
  wifi_set_opmode (STATION_MODE);
  wifi_set_macaddr(STATION_IF, irMac);
}
//==============================Probe Request defines ends=======================  
*/

//====================IR defines starts============================

#if IRSENDER
const uint16_t kIrLed = 16;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(kIrLed);  // Set the GPIO to be used to sending the message.

// Example Samsung A/C state captured from IRrecvDumpV2.ino
//uint8_t myMac[kSamsungAcStateLength] = {temperature, humidity, pressure, Voltage, light, device}; //{0xb4, 0xe6, 0x52, 0x44, 0x86, 0xad, 0xb4, 0xe6, 0x52, 0x44, 0x86, 0xad };
//uint64_t myMac = 0x1234567890AB;//{temperature, humidity, pressure, battery, lux, device};  // 48bits 
uint64_t myMac = 
    (uint64_t)(uint8_t (irMac[5])) | 
    (uint64_t)(uint8_t (irMac[4])) << 8 |          
    (uint64_t)(uint8_t (irMac[3])) << 16 |          
    (uint64_t)(uint8_t (irMac[2])) << 24 |          
    (uint64_t)(uint8_t (irMac[1])) << 32 |          
    (uint64_t)(uint8_t (irMac[0])) << 40;    
#endif
    
   
//====================IR defines ends==============================


void setup() {
    Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
    Serial.println();
    Serial.print("Milliseconds passed before setup: ");
    Serial.println(millis());
    lastMillis = millis();
    Serial.println();
    
    
    
    #if PROBEREQUESTER
    //WiFi.mode(WIFI_STA); // Station mode for esp-now controller
  //   wifi_set_opmode (STATION_MODE);
    wifi_set_macaddr(STATION_IF, irMac);
    struct station_config stationConf;
    //stationConf.bssid_set = 1;  //need not check MAC address of AP
    WiFi.disconnect();
    WiFi.hostname("Livingroom");
    Serial.println();
    #endif
    
    
    
    float voltage = ESP.getVcc() / (float)1023; // * (float)1.07;
    Serial.print("Voltage: "); Serial.print(voltage); Serial.print("  Voltage Expected: "); Serial.println(VOLT_LIMIT);
    if (voltage < VOLT_LIMIT)      // if voltage of battery gets to low, the LED wil blink fast.
  {
    Serial.println("Warning :- Battery Voltage low please change batteries" );
    Serial.println();
  }
    
    Serial.println("Setup finished");
    
    
    passedMillis = millis() - lastMillis;
    Serial.print("Time spent on setup: "); 
    Serial.println(passedMillis);
    Serial.println();
    lastMillis = millis();

    readBME280();
    Serial.println();
    
    #if PROBEREQUESTER
   probeRequest();
    #endif
    
    #if IRSENDER
    irsend.begin();
    irSender();
    #endif

}

//========================Main Loop================================

void loop() {

//===========================IR loop===============================
  #if IRSENDER
  //irSender();
  #endif
 //=====================Probe request Loop=========================
  
// put your code here to run in loop or move to setup to run oncce.
 
 #if PROBEREQUESTER
 probeRequest();
 #endif
 
 //readBME280();
  


 Serial.print("Total time I spent before going to sleep: "); 
 Serial.println(millis());
 Serial.print("I will wakeup in: "); 
 Serial.print(SLEEP_SECS / 60); 
 Serial.println(" Minutes"); 
 delay(20000);
 ESP.restart(); 
//ESP.deepSleep(0);
 
    
}

//=========================Main Loop ends==========================






void readBME280() {
  bme280.settings.commInterface = I2C_MODE;
  bme280.settings.I2CAddress = 0x76;
  bme280.settings.runMode = 2; // Forced mode with deepSleep
  bme280.settings.tempOverSample = 1;
  bme280.settings.pressOverSample = 1;
  bme280.settings.humidOverSample = 1;
  Serial.print("bme280 init="); Serial.println(bme280.begin(), HEX);
  temperature = 25;//bme280.readTempC();
  humidity = bme280.readFloatHumidity();
  pressure = bme280.readFloatPressure() / 100.0;
  delay(10);
  passedMillis = millis() - lastMillis;
  Serial.print("Time spent on BME280: "); 
  Serial.println(passedMillis);
  Serial.println();
}



void gotoSleep() {                            //need connection between GPIO16 and reset pin on ESP8266
  // add some randomness to avoid collisions with multiple devices
  int sleepSecs = SLEEP_SECS;// + ((uint8_t)RANDOM_REG32/2);
  Serial.printf("Up for %i ms, going to sleep for %i secs...\n", millis(), sleepSecs);
  ESP.deepSleep(sleepSecs * 1000000, RF_NO_CAL);
}

#if PROBEREQUESTER
//=========================Probe request function starts===========
  
  void probeRequest()  {
  Serial.println("Starting Probe sender");
  Serial.println("Sending sensor data over Probe request protocol to Master Node");
  Serial.println();
 

//WiFi.scanNetworksAsync(prinScanResult);

//int8_t scanNetworks(bool async = true, bool show_hidden = false, uint8 channel = 0, uint8* ssid = NULL);
int n = WiFi.scanNetworks(true, true, apChannel); // find solution for san for specific ssid instead of channel.

#if !IRSENDER
delay(25); // Minimum delay required to scan networks in async mode if not using IRSENDER 
#endif

#if IRSENDER
delay(10);     // Minimum delay required to scan networks in async mode if using IRSENDER              
#endif

 if (WiFi.BSSIDstr(0)[16] == '1')  {
 String ssid;
 Serial.println();
 Serial.print("This Device MAC ID is: ");
 Serial.println(WiFi.macAddress());
 Serial.print("This Device Name is: ");
 Serial.println(WiFi.hostname());
 Serial.print("Message received from Controller is: ");
 Serial.println(&WiFi.BSSIDstr(0)[0]);
 Serial.println(WiFi.BSSIDstr(0)[0]);
 Serial.println(WiFi.BSSIDstr(0)[1]);
 Serial.println(WiFi.BSSIDstr(0)[2]);
 Serial.println(WiFi.BSSIDstr(0)[3]);
 Serial.println(WiFi.BSSIDstr(0)[4]);
 Serial.println(WiFi.BSSIDstr(0)[5]);
 Serial.println(WiFi.BSSIDstr(0)[6]);
 Serial.println(WiFi.BSSIDstr(0)[7]);
 Serial.println(WiFi.BSSIDstr(0)[8]);
 Serial.println(WiFi.BSSIDstr(0)[9]);
 Serial.println(WiFi.BSSIDstr(0)[10]);
 Serial.println(WiFi.BSSIDstr(0)[11]);
 Serial.println(WiFi.BSSIDstr(0)[12]);
 Serial.println(WiFi.BSSIDstr(0)[13]);
 Serial.println(WiFi.BSSIDstr(0)[14]);
 Serial.println(WiFi.BSSIDstr(0)[15]);
 Serial.println(WiFi.BSSIDstr(0)[16]);
 
 Serial.print("Gateway Name is: ");
 Serial.println(WiFi.SSID(0));
 Serial.print("Gateway Channel is: ");
 Serial.println(WiFi.channel(0));
 
 Serial.print("Message received from Controller: ");
 if (WiFi.BSSIDstr(0)[0] == '3')  {
       Serial.print("GPIO,");
       Serial.print(ledPin);
       Serial.print(",");
       Serial.print(WiFi.BSSIDstr(0)[15]);
    }
 }

 Serial.println();
 WiFi.scanDelete();
 passedMillis = millis() - lastMillis;
 Serial.print("Time spent on Probe Request: "); 
 Serial.println(passedMillis);
 lastMillis = millis();
 Serial.println();
 
 delay(10);


 
}

#endif

#if IRSENDER
//========================IR function starts=========================================
void irSender()   {
    
  Serial.println("Starting IR data sender");
  Serial.println("Sending sensor data over IR protocol to Master Node");
  Serial.println();
   //  irsend.sendSamsungAC(myMac);
   //irsend.sendMidea(hwaddr);
   irsend.sendMidea(myMac); 
   Serial.print("Message sent : ");
//   serialPrintUint64(myMac, HEX); //  
   Serial.println();
   
 
    passedMillis = millis() - lastMillis;
    Serial.print("Time spent on IR Sender: "); 
    Serial.println(passedMillis);
    lastMillis = millis();
    Serial.println();
    //delay(10);
}
#endif````

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.