From b7ca182bd81f6fcce58efa1542591457782b2e54 Mon Sep 17 00:00:00 2001 From: dj1ch Date: Sat, 25 Nov 2023 12:20:26 -0800 Subject: [PATCH 1/5] fixed everything. magic numbers are added, etc --- minigotchi/deauth.cpp | 75 +++++++++++++-------------------- minigotchi/minigotchi.ino | 26 +++++++----- minigotchi/packet.cpp | 16 ++++--- minigotchi/pwnagotchi.cpp | 87 +++++++++++++++++++++++++++++++-------- minigotchi/pwnagotchi.h | 14 +++++-- 5 files changed, 131 insertions(+), 87 deletions(-) diff --git a/minigotchi/deauth.cpp b/minigotchi/deauth.cpp index cf36f31..3218642 100644 --- a/minigotchi/deauth.cpp +++ b/minigotchi/deauth.cpp @@ -1,60 +1,41 @@ -// deauth.cpp: handles the deauth of a local ap +// minigotchi.ino: everything implemented here +#include "pwnagotchi.h" #include "deauth.h" +#include "packet.h" -void DeauthAttack::addToWhitelist(const char* bssid) { - whitelist.push_back(bssid); -} - -void DeauthAttack::selectRandomAP() { - int apCount = WiFi.scanNetworks(); - - if (apCount > 0) { - int randomIndex = random(apCount); - randomAP = WiFi.SSID(randomIndex); +Pwnagotchi pwnagotchi; +PacketSender packetSender; +DeauthAttack deauthAttack; - // check for ap in whitelist - if (std::find(whitelist.begin(), whitelist.end(), randomAP) != whitelist.end()) { - Serial.println("Selected AP is in the whitelist. Skipping deauthentication."); - return; - } +void setup() { + Serial.begin(115200); + deauthAttack.addToWhitelist("SSID"); + Serial.println(); - Serial.print("Selected random AP: "); - Serial.println(randomAP); + Serial.println("Formatting SPIFFS. This may take a while..."); + if (SPIFFS.format()) { + Serial.println("SPIFFS formatted successfully."); } else { - Serial.println("No access points found."); + Serial.println("Failed to format SPIFFS."); } } -void DeauthAttack::startRandomDeauth() { - if (randomAP.length() > 0) { - Serial.println("Starting deauthentication attack on the selected AP..."); - // define the attack - if (!running) { - // Deauth, beacon, deauth all stations, probe, output, timeout - start(true, false, false, false, true, 0); - } else { - Serial.println("Attack is already running."); - } - } else { - Serial.println("No access point selected. Use selectRandomAP() first."); - } -} - -void DeauthAttack::start(bool param1, bool param2, bool param3, bool param4, bool param5, int param6) { - running = true; +void loop() { + // get local payload from local pwnagotchi + pwnagotchi.detectPwnagotchi(); + delay(5000); - // make the deauth frame - String reasonCode = "3"; // means "Deauthenticated because sending STA is leaving (or has left) BSS" - String deauthPacket = "c0:ff:ee:c0:ff:ee" + randomAP + reasonCode; - uint8_t* deauthPacketBytes = (uint8_t*)deauthPacket.c_str(); - int packetSize = deauthPacket.length(); - - // send the deauth 10 times - for (int i = 0; i < 10; ++i) { - wifi_send_pkt_freedom(deauthPacketBytes, packetSize, 0); - delay(100); + // send payload + if (SPIFFS.begin()) { + packetSender.sendJsonPayloadFromFile("packet.json"); + } else { + Serial.println("Failed to mount file, does the file exist?"); + delay(5000); } - running = false; + // deauth a random ap + deauthAttack.selectRandomAP(); + deauthAttack.startRandomDeauth(); + delay(5000); } diff --git a/minigotchi/minigotchi.ino b/minigotchi/minigotchi.ino index bfd223c..3218642 100644 --- a/minigotchi/minigotchi.ino +++ b/minigotchi/minigotchi.ino @@ -9,24 +9,30 @@ PacketSender packetSender; DeauthAttack deauthAttack; void setup() { - Serial.begin(115200); // this is the rate for the serial monitor - deauthAttack.addToWhitelist("SSID"); // set your ssid you want to use - if (SPIFFS.begin()) { - // Use the appropriate file path - packetSender.sendJsonPayloadFromFile("/packet.json"); + Serial.begin(115200); + deauthAttack.addToWhitelist("SSID"); + Serial.println(); + + Serial.println("Formatting SPIFFS. This may take a while..."); + if (SPIFFS.format()) { + Serial.println("SPIFFS formatted successfully."); } else { - Serial.println("Failed to mount file, does the file exist?"); - } + Serial.println("Failed to format SPIFFS."); + } } void loop() { // get local payload from local pwnagotchi - pwnagotchi.detectPwnagotchi("de:ad:be:ef:de:ad"); + pwnagotchi.detectPwnagotchi(); delay(5000); // send payload - packetSender.sendJsonPayloadFromFile("/packet.json"); - delay(5000); + if (SPIFFS.begin()) { + packetSender.sendJsonPayloadFromFile("packet.json"); + } else { + Serial.println("Failed to mount file, does the file exist?"); + delay(5000); + } // deauth a random ap deauthAttack.selectRandomAP(); diff --git a/minigotchi/packet.cpp b/minigotchi/packet.cpp index 81d5b83..418bdb0 100644 --- a/minigotchi/packet.cpp +++ b/minigotchi/packet.cpp @@ -3,6 +3,9 @@ #include "packet.h" #include "raw80211.h" +// set magic number(222 in hex) +const uint8_t MAGIC_NUMBER = 0xDE; + void PacketSender::sendJsonPayloadFromFile(const char* filePath) { File configFile = SPIFFS.open(filePath, "r"); if (configFile) { @@ -11,17 +14,12 @@ void PacketSender::sendJsonPayloadFromFile(const char* filePath) { configFile.readBytes(buf.get(), size); configFile.close(); - DynamicJsonDocument doc(1024); - deserializeJson(doc, buf.get()); - - // make json string - String jsonString; - serializeJson(doc, jsonString); + // put number in payload + Raw80211::send(&MAGIC_NUMBER, sizeof(MAGIC_NUMBER)); + Raw80211::send(reinterpret_cast(buf.get()), size); - // send payload - Raw80211::send(reinterpret_cast(jsonString.c_str()), jsonString.length()); + Serial.println("Sent payload!"); } else { Serial.println("Failed to open JSON file for reading"); } } - diff --git a/minigotchi/pwnagotchi.cpp b/minigotchi/pwnagotchi.cpp index dcca5e2..e1e68dd 100644 --- a/minigotchi/pwnagotchi.cpp +++ b/minigotchi/pwnagotchi.cpp @@ -2,29 +2,80 @@ #include "pwnagotchi.h" #include +#include "raw80211.h" +#include -void Pwnagotchi::detectPwnagotchi(const char* essid) { - if (strncmp(essid, PWNAGOTCHI_MAC, 17) == 0) { - Serial.println("Detected a Pwnagotchi!"); +namespace { + Pwnagotchi* pwnInstance = nullptr; - DynamicJsonDocument jsonBuffer(1024); - DeserializationError error = deserializeJson(jsonBuffer, essid + 18); + void rawCallback(const wifi_ieee80211_mac_hdr_t *hdr, int rssi, const unsigned char *buff, short unsigned int buff_len) { + if (pwnInstance) { + pwnInstance->handlePwnagotchiDetection(hdr, rssi, buff, buff_len); + } + } +} + +Pwnagotchi::Pwnagotchi() { + // init the class + essid = "de:ad:be:ef:de:ad"; +} + +void Pwnagotchi::getMAC(char* addr, const unsigned char* buff, int offset) { + snprintf(addr, 18, "%02x:%02x:%02x:%02x:%02x:%02x", + buff[offset], buff[offset + 1], buff[offset + 2], + buff[offset + 3], buff[offset + 4], buff[offset + 5]); +} + +String Pwnagotchi::extractMAC(const unsigned char *buff) { + char addr[] = "00:00:00:00:00:00"; + getMAC(addr, buff, 10); + return String(addr); +} + +void Pwnagotchi::detectPwnagotchi() { + Serial.println("Scanning for Pwnagotchi..."); + + // static instance + pwnInstance = this; + + // register the function + Raw80211::register_cb(&rawCallback); +} + +void Pwnagotchi::handlePwnagotchiDetection(const wifi_ieee80211_mac_hdr_t *hdr, int rssi, const unsigned char *buff, short unsigned int buff_len) { + // check if it is a beacon frame + if (buff[0] == 0x80) { + // extract mac + char addr[] = "00:00:00:00:00:00"; + String src = extractMAC(buff); + + // check if the source MAC matches "de:ad:be:ef:de:ad" + if (src == "de:ad:be:ef:de:ad") { + // extract the ESSID from the beacon frame + String essid(reinterpret_cast(&buff[36])); + essid = essid.substring(0, 32); // Assuming ESSID starts at index 36 and is 32 bytes long + + // load json from the ESSID + DynamicJsonDocument jsonBuffer(1024); // Adjust the buffer size as needed + DeserializationError error = deserializeJson(jsonBuffer, essid); - if (error) { - Serial.print("Failed to parse Pwnagotchi JSON. Error: "); - Serial.println(error.c_str()); - } else { - Serial.println("Successfully parsed Pwnagotchi JSON"); + // check if json parsing is successful + if (error) { + Serial.print(F("Could not parse Pwnagotchi json: ")); + Serial.println(error.c_str()); + } else { + Serial.println("\nSuccessfully parsed json"); - const String pwnagotchiName = jsonBuffer["name"].as(); - const int pwndTot = jsonBuffer["pwnd_tot"].as(); + // find out some stats + String name = jsonBuffer["name"].as(); + String pwndTot = jsonBuffer["pwnd_tot"].as(); - Serial.print("Pwnagotchi Name: "); - Serial.println(pwnagotchiName); - Serial.print("Pwnd Tot: "); - Serial.println(pwndTot); + // print the info + Serial.print("Pwnagotchi name: "); + Serial.println(name); + Serial.print("Pwned Networks: "); + Serial.println(pwndTot); + } } - } else { - Serial.println("Not a Pwnagotchi device."); } } diff --git a/minigotchi/pwnagotchi.h b/minigotchi/pwnagotchi.h index 8ce567b..a290dec 100644 --- a/minigotchi/pwnagotchi.h +++ b/minigotchi/pwnagotchi.h @@ -7,16 +7,24 @@ #include #include +#include "raw80211.h" +#include class Pwnagotchi { public: - void detectPwnagotchi(const char* essid); + Pwnagotchi(); // constructs/inits everything + + void detectPwnagotchi(); + void handlePwnagotchiDetection(const wifi_ieee80211_mac_hdr_t *hdr, int rssi, const unsigned char *buff, short unsigned int buff_len); + String extractMAC(const unsigned char *buff); + void getMAC(char* addr, const unsigned char* buff, int offset); private: - const char* PWNAGOTCHI_MAC = "de:ad:be:ef:de:ad"; + String essid; + }; // global instance extern Pwnagotchi pwnagotchi; -#endif // PWNAGOTCHI_H \ No newline at end of file +#endif // PWNAGOTCHI_H From e4cb620199632372b622ba0e9ed788dc9f90af09 Mon Sep 17 00:00:00 2001 From: dj1ch Date: Sat, 25 Nov 2023 13:32:39 -0800 Subject: [PATCH 2/5] more info on the state of the project --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c391f12..37990cd 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ### an even smaller pwnagotchi. ### ### Note that this project is undergoing a major rewrite in the code and the structure of everything(see development branch) +It will take a really long time to get a fully stable and working release! You can watch this repository and see the activity on this repository. I got several issues to sort out, including the packet sending and the pwnagotchi detection system. If you want to help, feel free to fork and make a couple changes to my code. ### #### Intro Overall, this project started as a thought. A pwnagotchi on an even smaller board, in this case an esp8266. Crazy, right? Anyway, this project may make it a little bit more possible. Instead of pwning networks, it will be a friend to a local pwnagotchi(Most likely one of yours), along with deauthing random networks if the esp8266 is in the vicinity of any. @@ -19,8 +20,9 @@ The install guide is [here](INSTALL.md), now that I have put out releases. - Go (maybe) #### #### Prerequisites -- An IDE (most likely the arduino ide or thonny on the raspberry pi pico) -- Hardware(esp8266 microcontroller or raspberry pi pico with esp8266 wifi module) +- An IDE (most likely the arduino ide) +- Hardware(esp8266 microcontroller) +- A reliable and appropriate power source and supply for the hardware - Patience (a lot of it) #### How it operates/works The minigotchi relies on the IDE/serial shell for communication through logs. It will send raw frames to associate to an access point, and will advertise itself on a network like a pwnagotchi, or perhaps interact with the local pwngrid server that the pwnagotchi is running. @@ -31,6 +33,8 @@ We have dropped support for the pico, as it turns out, the esp8266 is a microcon - Hardware is here(the esp8266): https://www.amazon.com/QCCAN-Internet-ESP8266-Compatible-MicroPython/dp + +Keep in mind it comes with two of them. It's best to keep one extra in case a board gets burnt out and/or lost. I don't think I can find a singular one. I believe this is a clone, so be sure to set this as the clone in the Arduino IDE board manager. #### #### To do - screen support? From 6a944c661f63024374323664c89b75a42ae58e8a Mon Sep 17 00:00:00 2001 From: dj1ch Date: Sat, 25 Nov 2023 14:56:45 -0800 Subject: [PATCH 3/5] final fixes, im sure everything works now --- minigotchi/minigotchi.ino | 28 ++++++++----------- minigotchi/packet.cpp | 59 ++++++++++++++++++++++++++++++++------- minigotchi/packet.h | 3 +- minigotchi/packet.json | 31 -------------------- minigotchi/pwnagotchi.cpp | 22 ++++++++++++--- minigotchi/pwnagotchi.h | 2 ++ 6 files changed, 82 insertions(+), 63 deletions(-) delete mode 100644 minigotchi/packet.json diff --git a/minigotchi/minigotchi.ino b/minigotchi/minigotchi.ino index 3218642..84370fc 100644 --- a/minigotchi/minigotchi.ino +++ b/minigotchi/minigotchi.ino @@ -10,29 +10,25 @@ DeauthAttack deauthAttack; void setup() { Serial.begin(115200); - deauthAttack.addToWhitelist("SSID"); - Serial.println(); - - Serial.println("Formatting SPIFFS. This may take a while..."); - if (SPIFFS.format()) { - Serial.println("SPIFFS formatted successfully."); - } else { - Serial.println("Failed to format SPIFFS."); - } + Serial.println("Hi, I'm Minigotchi, your pwnagotchi's best friend!"); + Serial.println(" "); + Serial.println("You can edit my whitelist in the minigotchi.ino, and you can also edit the json parameters in the packet.cpp"); + Serial.println(" "); + deauthAttack.addToWhitelist("SSID"); // add your ssid(s) here + deauthAttack.addToWhitelist("ANOTHER_SSID"); + delay(5000); + Serial.println(" "); + Serial.println("Starting now..."); } void loop() { // get local payload from local pwnagotchi - pwnagotchi.detectPwnagotchi(); + pwnagotchi.detectAndHandlePwnagotchi(); delay(5000); // send payload - if (SPIFFS.begin()) { - packetSender.sendJsonPayloadFromFile("packet.json"); - } else { - Serial.println("Failed to mount file, does the file exist?"); - delay(5000); - } + packetSender.sendJsonPayload(); + delay(5000); // deauth a random ap deauthAttack.selectRandomAP(); diff --git a/minigotchi/packet.cpp b/minigotchi/packet.cpp index 418bdb0..35ea4fd 100644 --- a/minigotchi/packet.cpp +++ b/minigotchi/packet.cpp @@ -2,24 +2,63 @@ #include "packet.h" #include "raw80211.h" +#include // set magic number(222 in hex) const uint8_t MAGIC_NUMBER = 0xDE; -void PacketSender::sendJsonPayloadFromFile(const char* filePath) { - File configFile = SPIFFS.open(filePath, "r"); - if (configFile) { - size_t size = configFile.size(); - std::unique_ptr buf(new char[size]); - configFile.readBytes(buf.get(), size); - configFile.close(); +void PacketSender::sendJsonPayload() { + + // json object creation + DynamicJsonDocument doc(1024); + // all settings + doc["epoch"] = 1; + doc["face"] = "(◕‿‿◕)"; + doc["identity"] = "b9210077f7c14c0651aa338c55e820e93f90110ef679648001b1cecdbffc0090"; + doc["name"] = "minigotchi"; + + JsonObject policy = doc.createNestedObject("policy"); + policy["advertise"] = true; + policy["ap_ttl"] = 0; + policy["associate"] = true; + policy["bored_num_epochs"] = 0; + + JsonArray channels = policy.createNestedArray("channels"); + channels.add(1); + channels.add(3); + channels.add(4); + channels.add(5); + channels.add(6); + + policy["deauth"] = true; + policy["excited_num_epochs"] = 1; + policy["hop_recon_time"] = 1; + policy["max_inactive_scale"] = 0; + policy["max_interactions"] = 1; + policy["max_misses_for_recon"] = 1; + policy["min_recon_time"] = 1; + policy["min_rssi"] = 1; + policy["recon_inactive_multiplier"] = 1; + policy["recon_time"] = 1; + policy["sad_num_epochs"] = 1; + policy["sta_ttl"] = 0; + + doc["pwnd_run"] = 0; + doc["pwnd_tot"] = 0; + doc["session_id"] = "84:f3:eb:58:95:bd"; + doc["uptime"] = 1; + doc["version"] = "v1.0.0"; + + String jsonString; + if (serializeJson(doc, jsonString) == 0) { + // handle errors here + Serial.println("Failed to serialize JSON"); + } else { // put number in payload Raw80211::send(&MAGIC_NUMBER, sizeof(MAGIC_NUMBER)); - Raw80211::send(reinterpret_cast(buf.get()), size); + Raw80211::send(reinterpret_cast(jsonString.c_str()), jsonString.length()); Serial.println("Sent payload!"); - } else { - Serial.println("Failed to open JSON file for reading"); } } diff --git a/minigotchi/packet.h b/minigotchi/packet.h index ae2c568..1e138c0 100644 --- a/minigotchi/packet.h +++ b/minigotchi/packet.h @@ -4,13 +4,12 @@ #define PACKET_H #include -#include #include "raw80211.h" #include class PacketSender { public: - void sendJsonPayloadFromFile(const char* filePath); + void sendJsonPayload(); }; #endif // PACKET_H diff --git a/minigotchi/packet.json b/minigotchi/packet.json deleted file mode 100644 index a8d9b05..0000000 --- a/minigotchi/packet.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "epoch": 1, - "face": "(◕‿‿◕)", - "identity": "b9210077f7c14c0651aa338c55e820e93f90110ef679648001b1cecdbffc0090", - "name": "minigotchi", - "policy": { - "advertise": true, - "ap_ttl": 0, - "associate": true, - "bored_num_epochs": 0, - "channels": [1, 3, 4, 5, 6], - "deauth": true, - "excited_num_epochs": 1, - "hop_recon_time": 1, - "max_inactive_scale": 0, - "max_interactions": 1, - "max_misses_for_recon": 1, - "min_recon_time": 1, - "min_rssi": 1, - "recon_inactive_multiplier": 1, - "recon_time": 1, - "sad_num_epochs": 1, - "sta_ttl": 0 - }, - "pwnd_run": 0, - "pwnd_tot": 0, - "session_id": "84:f3:eb:58:95:bd", - "uptime": 1, - "version": "v1.0.0" - } - \ No newline at end of file diff --git a/minigotchi/pwnagotchi.cpp b/minigotchi/pwnagotchi.cpp index e1e68dd..3982099 100644 --- a/minigotchi/pwnagotchi.cpp +++ b/minigotchi/pwnagotchi.cpp @@ -17,7 +17,10 @@ namespace { Pwnagotchi::Pwnagotchi() { // init the class - essid = "de:ad:be:ef:de:ad"; + essid = "de:ad:be:ef:de:ad"; + // register the function + Raw80211::register_cb(&rawCallback); + Serial.println("Callback registered"); } void Pwnagotchi::getMAC(char* addr, const unsigned char* buff, int offset) { @@ -32,14 +35,19 @@ String Pwnagotchi::extractMAC(const unsigned char *buff) { return String(addr); } -void Pwnagotchi::detectPwnagotchi() { +void Pwnagotchi::detectAndHandlePwnagotchi() { Serial.println("Scanning for Pwnagotchi..."); // static instance pwnInstance = this; - // register the function - Raw80211::register_cb(&rawCallback); + // delay for scanning (adjust as needed) + delay(5000); + + // check if the rawCallback was triggered during scanning + if (!pwnInstance->pwnagotchiDetected) { + Serial.println("No Pwnagotchi found."); + } } void Pwnagotchi::handlePwnagotchiDetection(const wifi_ieee80211_mac_hdr_t *hdr, int rssi, const unsigned char *buff, short unsigned int buff_len) { @@ -51,10 +59,16 @@ void Pwnagotchi::handlePwnagotchiDetection(const wifi_ieee80211_mac_hdr_t *hdr, // check if the source MAC matches "de:ad:be:ef:de:ad" if (src == "de:ad:be:ef:de:ad") { + pwnagotchiDetected = true; + Serial.println("Pwnagotchi detected!"); + // extract the ESSID from the beacon frame String essid(reinterpret_cast(&buff[36])); essid = essid.substring(0, 32); // Assuming ESSID starts at index 36 and is 32 bytes long + Serial.print("ESSID: "); + Serial.println(essid); + // load json from the ESSID DynamicJsonDocument jsonBuffer(1024); // Adjust the buffer size as needed DeserializationError error = deserializeJson(jsonBuffer, essid); diff --git a/minigotchi/pwnagotchi.h b/minigotchi/pwnagotchi.h index a290dec..3fb32cb 100644 --- a/minigotchi/pwnagotchi.h +++ b/minigotchi/pwnagotchi.h @@ -14,6 +14,7 @@ class Pwnagotchi { public: Pwnagotchi(); // constructs/inits everything + void detectAndHandlePwnagotchi(); void detectPwnagotchi(); void handlePwnagotchiDetection(const wifi_ieee80211_mac_hdr_t *hdr, int rssi, const unsigned char *buff, short unsigned int buff_len); String extractMAC(const unsigned char *buff); @@ -21,6 +22,7 @@ class Pwnagotchi { private: String essid; + bool pwnagotchiDetected; }; From 64df0acb4fcd797b05a1218fc29339193a0feae4 Mon Sep 17 00:00:00 2001 From: dj1ch Date: Sat, 25 Nov 2023 15:39:20 -0800 Subject: [PATCH 4/5] allowed scanning to stop for deauthing, or payload --- minigotchi/minigotchi.ino | 16 ++++++++++++++-- minigotchi/raw80211.h | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/minigotchi/minigotchi.ino b/minigotchi/minigotchi.ino index 84370fc..374f4d3 100644 --- a/minigotchi/minigotchi.ino +++ b/minigotchi/minigotchi.ino @@ -3,22 +3,28 @@ #include "pwnagotchi.h" #include "deauth.h" #include "packet.h" +#include "raw80211.h" Pwnagotchi pwnagotchi; PacketSender packetSender; DeauthAttack deauthAttack; +Raw80211 raw; void setup() { Serial.begin(115200); + Serial.println(" "); Serial.println("Hi, I'm Minigotchi, your pwnagotchi's best friend!"); Serial.println(" "); Serial.println("You can edit my whitelist in the minigotchi.ino, and you can also edit the json parameters in the packet.cpp"); Serial.println(" "); + Serial.println("Starting now..."); deauthAttack.addToWhitelist("SSID"); // add your ssid(s) here deauthAttack.addToWhitelist("ANOTHER_SSID"); - delay(5000); + raw.init("bssid of ap you will listen on", channel number); // set the settings here, ("BSSID", channel) + raw.start(); + delay(15000); Serial.println(" "); - Serial.println("Starting now..."); + Serial.println("Started successfully!"); } void loop() { @@ -26,6 +32,9 @@ void loop() { pwnagotchi.detectAndHandlePwnagotchi(); delay(5000); + // stop for deauthing and payload + raw.stop(); + // send payload packetSender.sendJsonPayload(); delay(5000); @@ -34,4 +43,7 @@ void loop() { deauthAttack.selectRandomAP(); deauthAttack.startRandomDeauth(); delay(5000); + + // restart the process + raw.start(); } diff --git a/minigotchi/raw80211.h b/minigotchi/raw80211.h index f801835..9a449a3 100644 --- a/minigotchi/raw80211.h +++ b/minigotchi/raw80211.h @@ -25,6 +25,13 @@ class Raw80211 { static void start(); static void send(const uint8_t *data, uint16_t data_len); static void register_cb(RAW_CB cb); + static void stop() { + #ifdef ESP32 + esp_wifi_set_promiscuous(0); + #else + wifi_promiscuous_enable(0); + #endif + } }; #endif From 644c32267e39f2d72cd6ff3bace54c30d9b931bd Mon Sep 17 00:00:00 2001 From: dj1ch Date: Sat, 25 Nov 2023 16:01:35 -0800 Subject: [PATCH 5/5] updated the install guide --- INSTALL.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index fc800f2..b7dec9d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,15 +2,16 @@ Here you can find out how to install minigotchi on the esp8266, or the raspberry pi pico. The esp8266 microcontroller has more support than the pico at the moment. They can be both built using arduino, ~~but you can build manually with the pico, assuming that you have all the libraries from the arduino esp8266 repo. Again, building with Arduino IDE is an option for the raspberry pi pico.~~ The support for this has been dropped, as this is not maintained nor tested by me. #### Building using Arduino IDE I believe that you can also use the raspberry pi pico and run arduino .ino files. It would be much easier to do this then to build it yourself manually. -- Download the latest release [here](https://github.com/Pwnagotchi-Unofficial/minigotchi/releases) -- Go to your arduino folder (on linux, it should be `~/Arduino`) -- Create a folder called `minigotchi` -- Copy and paste all the files from the release into the folder `~/Arduino/minigotchi` -- Open the arduino IDE in that directory (right clicking the .ino file and opening it with the IDE) -- It should prompt you to create a new folder called minigotchi, listen to what it tells you to do. -- Add additional .h files if needed, make sure you install all the dependancies -- From here you can select the board, and then you can run it on the board. Make sure you add the esp8266 libraries, which are on the arduino repo I put [at the bottom here](README.md) -- You first verify, then upload the files to the board using the IDE. The IDE should let you know when it's done programming the board. You can then go to the serial monitor and the board should be giving output, in this case it is showing the packets being sent. -- Note that the pwnagotchi will not notice these packets, yet. -- You can however, notice if a pwnagotchi is nearby, using the ability to read the packets being sent +- Download the latest release [here](https://github.com/Pwnagotchi-Unofficial/minigotchi/releases). +- Unzip the file +- Navigate to the `minigotchi.ino` file in the unzipped folder, and open it up +- At the line that says `raw.init("bssid of ap you will listen on", channel number); // set the settings here, ("BSSID", channel)`, replace the `"bssid of ap you will listen on"` with your actual BSSID(in the quotations), and the `channel` with the channel you prefer(not in quotations). +- Save and exit the file. +- Right click on the folder(should be called minigotchi) then archive it, making it back into a zip file. If you need to rename it, rename it +- Go to the [arduino web editor](create.arduino.cc/editor), then sign in/create an account +- Import the zip file by clicking the button that looks like an upload button, then selecting the minigotchi zip file that you edited +- Select the board as `ESP8266 WEMOS(LOLIN) D1 mini Lite`, and select the port it is plugged into(if you haven't already, plug in the board) +- Click on the upload button(arrow pointing to the left). +- You can click on the monitor button on the sidebar to see the serial monitor. Make sure the baud rate is `115200`. +- Happy hacking! ####