diff --git a/README.md b/README.md index ad264a0..2fac250 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,4 @@ This spawns 16 different fake drones broadcasting RemoteID, with them all flying ## To-Do List -1. Set custom MAC address for each Remote ID instance. -2. Add GPS capability to automatically create IDs wherever the device is located. +1. Add GPS capability to automatically create IDs wherever the device is located. diff --git a/RemoteIDSpoofer/RemoteIDSpoofer.ino b/RemoteIDSpoofer/RemoteIDSpoofer.ino index 45d7288..fca00c2 100644 --- a/RemoteIDSpoofer/RemoteIDSpoofer.ino +++ b/RemoteIDSpoofer/RemoteIDSpoofer.ino @@ -5,6 +5,7 @@ #include #include "spoofer.h" +// we are limited by how fast we can broadcast things const int num_spoofers = 16; static Spoofer spoofers[num_spoofers]; @@ -13,8 +14,8 @@ void setup() { } void loop() { - delay(50); for (int i = 0; i < num_spoofers; i++) { spoofers[i].update(); + delay(500 / num_spoofers); } -} \ No newline at end of file +} diff --git a/RemoteIDSpoofer/id_open.cpp b/RemoteIDSpoofer/id_open.cpp index 826d6d7..64912ac 100644 --- a/RemoteIDSpoofer/id_open.cpp +++ b/RemoteIDSpoofer/id_open.cpp @@ -68,12 +68,20 @@ ID_OpenDrone::ID_OpenDrone() { #if ID_OD_WIFI - memset(WiFi_mac_addr,0,6); + // scrambled, not poached + // Nodemcu doesn't like certain mac addresses + // setting the first value to 0 seems to solve this + WiFi_mac_addr[i] = 0; + for (int i = 1; i < 6; i++) { + // WiFi_mac_addr[i] = (uint8_t) (rand() % 100 + 100); + WiFi_mac_addr[i] = (uint8_t) (rand() % 256); + } + memset(ssid,0,sizeof(ssid)); strcpy(ssid,"UAS_ID_OPEN"); - beacon_interval = (BEACON_INTERVAL) ? BEACON_INTERVAL: 500; + beacon_interval = 10; #if ID_OD_WIFI_BEACON @@ -409,10 +417,8 @@ int ID_OpenDrone::transmit(struct UTM_data *utm_data) { int i, status; char text[128]; - uint32_t msecs; time_t secs = 0; static int phase = 0; - static uint32_t last_msecs = 2000; // @@ -573,9 +579,6 @@ int ID_OpenDrone::transmit(struct UTM_data *utm_data) { // Pack and transmit the WiFi data. - static uint8_t wifi_toggle = 1; - static uint32_t last_wifi = 0; - if ((msecs - last_wifi) >= beacon_interval) { last_wifi = msecs; @@ -653,9 +656,7 @@ int ID_OpenDrone::transmit_wifi(struct UTM_data *utm_data,int prepacked) { #if ID_OD_WIFI int length = 0, wifi_status = 0; - uint32_t msecs; uint64_t usecs = 0; - static uint32_t last_wifi = 0; char text[128]; text[0] = 0; @@ -784,9 +785,7 @@ int ID_OpenDrone::transmit_wifi(struct UTM_data *utm_data,int prepacked) { odid_message_build_pack(&UAS_data,beacon_payload,beacon_max_packed); if (length > 0) { - *beacon_length = length + 5; - wifi_status = transmit_wifi2(beacon_frame,len2 = beacon_offset + length); } @@ -833,9 +832,6 @@ int ID_OpenDrone::transmit_wifi(struct UTM_data *utm_data,int prepacked) { */ int ID_OpenDrone::transmit_ble(uint8_t *odid_msg,int length) { - - uint32_t msecs; - static uint32_t last_ble; msecs = millis(); ble_interval = msecs - last_ble; @@ -920,4 +916,4 @@ int ID_OpenDrone::transmit_ble(uint8_t *odid_msg,int length) { /* * - */ + */ \ No newline at end of file diff --git a/RemoteIDSpoofer/id_open.h b/RemoteIDSpoofer/id_open.h index 0f7abaa..b0a71ce 100644 --- a/RemoteIDSpoofer/id_open.h +++ b/RemoteIDSpoofer/id_open.h @@ -137,7 +137,9 @@ private: int auth_page = 0, auth_page_count = 0, key_length = 0, iv_length = 0; char *UAS_operator; uint8_t msg_counter[16]; + uint8_t wifi_toggle = 1; uint16_t wifi_interval = 0, ble_interval = 0; + uint32_t last_ble = 0, last_wifi = 0, msecs = 0, last_msecs = 2000; Stream *Debug_Serial = NULL; char ssid[32]; diff --git a/RemoteIDSpoofer/id_open_esp32.cpp b/RemoteIDSpoofer/id_open_esp32.cpp index 748581e..a732478 100644 --- a/RemoteIDSpoofer/id_open_esp32.cpp +++ b/RemoteIDSpoofer/id_open_esp32.cpp @@ -189,7 +189,8 @@ void init2(char *ssid,int ssid_length,uint8_t *WiFi_mac_addr,uint8_t wifi_channe // esp_wifi_set_max_tx_power(78); esp_wifi_get_max_tx_power(&wifi_power); - status = esp_read_mac(WiFi_mac_addr,ESP_MAC_WIFI_STA); + // no default mac addresses + // status = esp_read_mac(WiFi_mac_addr,ESP_MAC_WIFI_STA); if (Debug_Serial) { diff --git a/RemoteIDSpoofer/id_open_esp8266.cpp b/RemoteIDSpoofer/id_open_esp8266.cpp index b441323..3966d78 100644 --- a/RemoteIDSpoofer/id_open_esp8266.cpp +++ b/RemoteIDSpoofer/id_open_esp8266.cpp @@ -66,8 +66,7 @@ void init2(char *ssid,int ssid_length,uint8_t *WiFi_mac_addr,uint8_t wifi_channe softap_config wifi_config; WiFi.mode(WIFI_OFF); - - WiFi.macAddress(WiFi_mac_addr); + // WiFi.macAddress(WiFi_mac_addr); WiFi.softAP(ssid,NULL,wifi_channel,false,0); WiFi.setOutputPower(20.0); @@ -162,7 +161,6 @@ int transmit_wifi2(uint8_t *buffer,int length) { #if ID_OD_WIFI if (length) { - wifi_send_pkt_freedom(buffer,length,1); } diff --git a/RemoteIDSpoofer/spoofer.cpp b/RemoteIDSpoofer/spoofer.cpp index e12c877..a1bd708 100644 --- a/RemoteIDSpoofer/spoofer.cpp +++ b/RemoteIDSpoofer/spoofer.cpp @@ -23,7 +23,7 @@ Spoofer::Spoofer() { // define location // 52° 24' 24.4404" -1° 29' 36.564"W - lat_d = + lat_d = utm_data.latitude_d = utm_data.base_latitude = 52.0 + (24.0 / 60.0) + (24.4404 / 3600.0); long_d = @@ -40,12 +40,11 @@ Spoofer::Spoofer() { 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) { + // FAA says minimum rate is 1 Hz, we do 2 Hz here + if ((millis() - last_update) < 500) { return; } @@ -76,4 +75,4 @@ String Spoofer::getID() { ID.concat(characters[(rand() % characters.length())]); } return ID; -} \ No newline at end of file +}