mirror of
https://github.com/jjshoots/RemoteIDSpoofer.git
synced 2026-02-09 01:41:31 +00:00
first official prototype
This commit is contained in:
25
README.md
25
README.md
@@ -1,8 +1,29 @@
|
||||
# ID Open
|
||||
# RIDS - Remote ID Spoofer
|
||||
|
||||
**Disclaimer**: This repository and its code are intended for educational purposes only.
|
||||
|
||||
An ESP8266/NodeMCU Drone RemoteID Spoofer.
|
||||
|
||||
This spawns 16 different fake drones broadcasting RemoteID, with them all flying in random directions around a particular GPS location.
|
||||
|
||||

|
||||
|
||||
Built based on work done by [sxjack](https://github.com/sxjack/uav_electronic_ids).
|
||||
Built based on work done by [sxjack](https://github.com/sxjack/uav_electronic_ids) and [SpacehuhnTech](https://github.com/SpacehuhnTech/esp8266_deauther).
|
||||
I stand on the shoulders of giants.
|
||||
|
||||
## Installation
|
||||
|
||||
1. You need the [Arduino IDE](https://www.arduino.cc/en/software).
|
||||
2. In Arduino IDE, go to `File` > `Preferences`, then add this URL to the `Additional Boards Manager URLs`:
|
||||
- https://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json
|
||||
3. Now go to `Tools` > `Boards` > `Boards Manager`, search `deauther` and install `Deauther ESP8266 Boards`.
|
||||
4. Select your board at `Tools` > `Board` > and be sure it is at `Deauther ESP8266 Boards` (and not at `ESP8266 Modules`).
|
||||
5. Plug in your device, I used a NodeMCU v3, and select its COM port at `Tools` > `Port`.
|
||||
6. Press `upload`, or use Ctrl+U.
|
||||
7. The device should start broadcasting RemoteID packets generated for random flying machines.
|
||||
|
||||
## To-Do List
|
||||
|
||||
1. Add GPS capability to automatically create IDs wherever the device is located.
|
||||
|
||||
|
||||
|
||||
@@ -1,131 +1,20 @@
|
||||
// ESP8266 RemoteID spoofer
|
||||
// Heavily adapted from https://github.com/sxjack/uav_electronic_ids
|
||||
|
||||
#pragma GCC diagnostic warning "-Wunused-variable"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include "spoofer.h"
|
||||
|
||||
#include "id_open.h"
|
||||
|
||||
static ID_OpenDrone squitter;
|
||||
static UTM_Utilities utm_utils;
|
||||
|
||||
static struct UTM_parameters utm_parameters;
|
||||
static struct UTM_data utm_data;
|
||||
|
||||
static int speed_kn = 40;
|
||||
static float x = 0.0, y = 0.0, z = 0.0, speed_m_x, max_dir_change = 75.0;
|
||||
static double deg2rad = 0.0, m_deg_lat = 0.0, m_deg_long = 0.0;
|
||||
const int num_spoofers = 16;
|
||||
static Spoofer spoofers[num_spoofers];
|
||||
|
||||
void setup() {
|
||||
|
||||
char text[64];
|
||||
double lat_d, long_d;
|
||||
time_t time_2;
|
||||
struct tm clock_tm;
|
||||
struct timeval tv = {0,0};
|
||||
struct timezone utc = {0,0};
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.print("\nSerial\n\n\r");
|
||||
|
||||
deg2rad = (4.0 * atan(1.0)) / 180.0;
|
||||
|
||||
memset(&clock_tm,0,sizeof(struct tm));
|
||||
|
||||
clock_tm.tm_hour = 10;
|
||||
clock_tm.tm_mday = 16;
|
||||
clock_tm.tm_mon = 11;
|
||||
clock_tm.tm_year = 122;
|
||||
|
||||
tv.tv_sec =
|
||||
time_2 = mktime(&clock_tm);
|
||||
|
||||
settimeofday(&tv,&utc);
|
||||
|
||||
delay(500);
|
||||
|
||||
Serial.print(ctime(&time_2));
|
||||
|
||||
memset(&utm_parameters,0,sizeof(utm_parameters));
|
||||
|
||||
strcpy(utm_parameters.UAS_operator,"SUKONDEEZ");
|
||||
utm_parameters.region = 1;
|
||||
utm_parameters.EU_category = 1;
|
||||
utm_parameters.EU_class = 5;
|
||||
|
||||
squitter.init(&utm_parameters);
|
||||
|
||||
memset(&utm_data,0,sizeof(utm_data));
|
||||
|
||||
// 52° 24' 24.4404" -1° 29' 36.564"W
|
||||
lat_d =
|
||||
utm_data.latitude_d =
|
||||
utm_data.base_latitude = 52.0 + (24.0 / 60.0) + (24.4404 / 3600.0);
|
||||
long_d =
|
||||
utm_data.longitude_d =
|
||||
utm_data.base_longitude = -1.0 - (29.0 / 60.0) - (36.564 / 3600.0);
|
||||
utm_data.base_alt_m = 42.0;
|
||||
|
||||
utm_data.alt_msl_m = utm_data.base_alt_m + z;
|
||||
utm_data.alt_agl_m = z;
|
||||
|
||||
utm_data.speed_kn = speed_kn;
|
||||
utm_data.satellites = 8;
|
||||
utm_data.base_valid = 1;
|
||||
|
||||
speed_m_x = ((float) speed_kn) * 0.514444 / 5.0; // Because we update every 200 ms.
|
||||
|
||||
utm_utils.calc_m_per_deg(lat_d,&m_deg_lat,&m_deg_long);
|
||||
|
||||
Serial.print("\r\n");
|
||||
|
||||
sprintf(text,"%d degrees/radian\r\n",(int) (1.0 / deg2rad));
|
||||
Serial.print(text);
|
||||
|
||||
sprintf(text,"%d m per degree latitude\r\n",(int) m_deg_lat);
|
||||
Serial.print(text);
|
||||
|
||||
sprintf(text,"%d m per degree longitude\r\n",(int) m_deg_long);
|
||||
Serial.print(text);
|
||||
|
||||
Serial.print("\r\n");
|
||||
|
||||
srand(micros());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int dir_change;
|
||||
char text[64], lat_s[16], long_s[16];
|
||||
float rads, ranf;
|
||||
uint32_t msecs;
|
||||
static uint32_t last_update = 0;
|
||||
|
||||
void loop() {
|
||||
if ((millis() - last_update) < 200) {
|
||||
return;
|
||||
delay(50);
|
||||
for (int i = 0; i < num_spoofers; i++) {
|
||||
spoofers[i].update();
|
||||
}
|
||||
|
||||
ranf = 0.001 * (float) (((int) rand() % 1000) - 500);
|
||||
dir_change = (int) (max_dir_change * ranf);
|
||||
utm_data.heading = (utm_data.heading + dir_change + 360) % 360;
|
||||
|
||||
x += speed_m_x * sin(rads = (deg2rad * (float) utm_data.heading));
|
||||
y += speed_m_x * cos(rads);
|
||||
|
||||
utm_data.latitude_d = utm_data.base_latitude + (y / m_deg_lat);
|
||||
utm_data.longitude_d = utm_data.base_longitude + (x / m_deg_long);
|
||||
|
||||
dtostrf(utm_data.latitude_d, 10, 7, lat_s);
|
||||
dtostrf(utm_data.longitude_d, 10, 7, long_s);
|
||||
|
||||
// sprintf(text,"%s,%s,%d,%d,%d\r\n", lat_s,long_s,utm_data.heading,utm_data.speed_kn,dir_change);
|
||||
// Serial.print(text);
|
||||
|
||||
squitter.transmit(&utm_data);
|
||||
last_update = millis();
|
||||
}
|
||||
79
spoofer.cpp
Normal file
79
spoofer.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "spoofer.h"
|
||||
|
||||
Spoofer::Spoofer() {
|
||||
// time things
|
||||
memset(&clock_tm,0,sizeof(struct tm));
|
||||
clock_tm.tm_hour = 10;
|
||||
clock_tm.tm_mday = 16;
|
||||
clock_tm.tm_mon = 11;
|
||||
clock_tm.tm_year = 122;
|
||||
tv.tv_sec =
|
||||
time_2 = mktime(&clock_tm);
|
||||
settimeofday(&tv,&utc);
|
||||
|
||||
// utm things
|
||||
memset(&utm_parameters,0,sizeof(utm_parameters));
|
||||
strcpy(utm_parameters.UAS_operator, getID().c_str());
|
||||
// strcpy(utm_parameters.UAS_operator, "SUKONDEEZ");
|
||||
utm_parameters.region = 1;
|
||||
utm_parameters.EU_category = 1;
|
||||
utm_parameters.EU_class = 5;
|
||||
squitter.init(&utm_parameters);
|
||||
memset(&utm_data,0,sizeof(utm_data));
|
||||
|
||||
// define location
|
||||
// 52° 24' 24.4404" -1° 29' 36.564"W
|
||||
lat_d =
|
||||
utm_data.latitude_d =
|
||||
utm_data.base_latitude = 52.0 + (24.0 / 60.0) + (24.4404 / 3600.0);
|
||||
long_d =
|
||||
utm_data.longitude_d =
|
||||
utm_data.base_longitude = -1.0 - (29.0 / 60.0) - (36.564 / 3600.0);
|
||||
utm_data.base_alt_m = 42.0;
|
||||
|
||||
utm_data.alt_msl_m = utm_data.base_alt_m + z;
|
||||
utm_data.alt_agl_m = z;
|
||||
utm_data.speed_kn = speed_kn;
|
||||
utm_data.satellites = 8;
|
||||
utm_data.base_valid = 1;
|
||||
|
||||
speed_m_x = ((float) speed_kn) * 0.514444 * 0.2; // Because we update every 200 ms.
|
||||
|
||||
utm_utils.calc_m_per_deg(lat_d,&m_deg_lat,&m_deg_long);
|
||||
|
||||
srand(micros());
|
||||
}
|
||||
|
||||
void Spoofer::update() {
|
||||
if ((millis() - last_update) < 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
// randomly pick a direction to head and update the heading
|
||||
float ranf = 0.001 * (float) (((int) rand() % 1000) - 500);
|
||||
int dir_change = (int) (max_dir_change * ranf);
|
||||
utm_data.heading = (utm_data.heading + dir_change + 360) % 360;
|
||||
|
||||
// calculate the new x, y
|
||||
float rads = (deg2rad * (float) utm_data.heading);
|
||||
x += speed_m_x * sin(rads);
|
||||
y += speed_m_x * cos(rads);
|
||||
|
||||
// update the x, y
|
||||
utm_data.latitude_d = utm_data.base_latitude + (y / m_deg_lat);
|
||||
utm_data.longitude_d = utm_data.base_longitude + (x / m_deg_long);
|
||||
|
||||
// transmit things
|
||||
squitter.transmit(&utm_data);
|
||||
last_update = millis();
|
||||
}
|
||||
|
||||
String Spoofer::getID() {
|
||||
String characters = String("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
String ID = "";
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
ID.concat(characters[(rand() % characters.length())]);
|
||||
}
|
||||
return ID;
|
||||
}
|
||||
42
spoofer.h
Normal file
42
spoofer.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <Arduino.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <Esp.h>
|
||||
|
||||
#include "id_open.h"
|
||||
|
||||
#ifndef SPOOFER_H
|
||||
#define SPOOFER_H
|
||||
|
||||
class Spoofer {
|
||||
private:
|
||||
ID_OpenDrone squitter;
|
||||
UTM_Utilities utm_utils;
|
||||
|
||||
struct UTM_parameters utm_parameters;
|
||||
struct UTM_data utm_data;
|
||||
|
||||
int speed_kn = (int) (rand() % 10);
|
||||
float x = 0.0, y = 0.0, z = 0.0;
|
||||
float speed_m_x, max_dir_change = 75.0;
|
||||
double deg2rad = (4.0 * atan(1.0)) / 180.0;
|
||||
double m_deg_lat = 0.0, m_deg_long = 0.0;
|
||||
|
||||
double lat_d, long_d;
|
||||
time_t time_2;
|
||||
struct tm clock_tm;
|
||||
struct timeval tv = {0,0};
|
||||
struct timezone utc = {0,0};
|
||||
|
||||
uint32_t last_update = 0;
|
||||
|
||||
// random ID generator
|
||||
String getID();
|
||||
|
||||
public:
|
||||
Spoofer();
|
||||
void update();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user