Skip to content

Commit

Permalink
Adapt for ArduinoJson 7
Browse files Browse the repository at this point in the history
  • Loading branch information
andreock committed Oct 1, 2024
1 parent 00ff48c commit 8e7fc35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/UI/navigation/SubGHZ/SubGHZNavigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ void start_raw_record() {
void make_dump_file() {
Serial.println("Saving file");
extern std::vector<byte> raw_signal;
DynamicJsonDocument doc(110 + (32 * raw_signal.size()));
JsonDocument doc;
doc["frequency"] = subghz_module->get_frequency();
doc["bandwidth"] = subghz_module->get_bw();
doc["deviation"] = subghz_module->get_deviation();
doc["data_length"] = raw_signal.size();
JsonArray data = doc.createNestedArray("data");
JsonArray data = doc["data"].to<JsonArray>();
Serial.println("Saving file");
for (byte b : raw_signal) {
data.add(b);
Expand Down
6 changes: 3 additions & 3 deletions lib/network_attacks/network_attacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ NetworkAttacks::~NetworkAttacks() {}

void NetworkAttacks::connect_to_wifi(const char *config) {
File dhcp_glutton_config = open(config, "r");
StaticJsonDocument<512> doc;
JsonDocument doc;
DeserializationError error = deserializeJson(doc, dhcp_glutton_config);
if (error) {
Serial.printf("Error: %s", error.c_str());
Expand All @@ -64,7 +64,7 @@ void NetworkAttacks::create_default_ap() {

void NetworkAttacks::create_ap() {
File evilportal_config = open(EVIL_PORTAL_CONFIG_FILE, "r");
StaticJsonDocument<256> doc;
JsonDocument doc;
DeserializationError error = deserializeJson(doc, evilportal_config);
if (error) {
LOG_ERROR(
Expand All @@ -84,7 +84,7 @@ void NetworkAttacks::create_ap() {

ARPoisonerConfig NetworkAttacks::get_arp_config() {
File arp_poisoner_config = open(ARP_POISONING_CONFIG_FILE, "r");
StaticJsonDocument<512> doc;
JsonDocument doc;
DeserializationError error = deserializeJson(doc, arp_poisoner_config);
if (error) {
Serial.printf("Error: %s", error.c_str());
Expand Down
4 changes: 2 additions & 2 deletions lib/nfc_attacks/nfc_attacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ bool NFCAttacks::felica_clone(NFCTag *tag) {

NFCTag NFCAttacks::get_tag_towrite(uint8_t uid_length) {
File nfc_config = open(NFC_CONFIG_FILE, "r");
StaticJsonDocument<256> doc;
JsonDocument doc;
DeserializationError error = deserializeJson(doc, nfc_config);
if (error) {
uint8_t empty[1024];
Expand All @@ -490,7 +490,7 @@ NFCTag NFCAttacks::get_felica_towrite() {
uint8_t idm[8] = {0};
uint8_t pmm[8] = {0};
uint16_t sys_code = 0;
StaticJsonDocument<256> doc;
JsonDocument doc;
DeserializationError error = deserializeJson(doc, nfc_config);
if (error) {
uint8_t empty[1024];
Expand Down
6 changes: 3 additions & 3 deletions lib/wifi_attack/wifi_attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ void WifiAttack::scan() {
}

void WifiAttack::save_scan() {
DynamicJsonDocument all_networks(2048);
JsonDocument all_networks;

for (auto network : networks) {
#ifdef ARDUINO_NANO_ESP32
Serial.printf("SSID: %s\n", network.get_ssid());
#else
Serial0.printf("SSID: %s\n", network.get_ssid());
#endif
DynamicJsonDocument wifi(512);
StaticJsonDocument<JSON_ARRAY_SIZE(6)> doc;
JsonDocument wifi;
JsonDocument doc;
JsonArray json_bssid = doc.to<JsonArray>();
uint8_t *bssid = network.get_bssid();
for (size_t i = 0; i < 6; i++) {
Expand Down

0 comments on commit 8e7fc35

Please sign in to comment.