Skip to content

Commit

Permalink
Merge pull request #207 from valentin8709/feature/palnagotchi
Browse files Browse the repository at this point in the history
Feature/pwnagotchi_pwngrid_spam
  • Loading branch information
pr3y authored Sep 2, 2024
2 parents e79ab19 + 54a7e86 commit 1156d17
Show file tree
Hide file tree
Showing 13 changed files with 1,058 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ Also, [read our FAQ](https://github.com/pr3y/Bruce/wiki/FAQ)
- [x] Evil Portal
- [X] Scan Hosts
- [x] Wireguard Tun
- [x] Pwnagotchi
- [x] Pwnagotchi frien
- [x] Pwngrid spam faces & names
- [x] [Optional] DoScreen a very long name and face
- [x] [Optional] Flood uniq peer identifiers

### BLE
- [X] BLE Beacon
Expand Down
3 changes: 3 additions & 0 deletions sd_files/pwnagotchi/pwngridspam.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
faces="(STOP)","♬♪♬♪♬♪♬","(X‿‿X)","(u W u)","(EVIL)","(.)(.)","ლ(o_oლ)","(O﹏o)","(✖╭╮✖)","SKIDZ!","(ɹoɹɹƎ)","(H4cK)","NOPWND!\n■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■",

names="Check M5 Bruce Project","┌∩┐(◣_◢)┌∩┐","(╯°□°)╯╭╮(XoX)","STOP DEAUTH SKIDZ!","System Breached oups","Unauthorized Access","Security Compromised.. reboot","Warning...Bruce's here","Critical Error need reboot","No more Battery","Never gonna give you up","Never gonna let you down","Never gonna run around","and desert you","Never gonna make you cry","Never gonna say goodbye","Never gonna tell a lie","and hurt you"
7 changes: 6 additions & 1 deletion src/core/menu_items/WifiMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "modules/wifi/wifi_atks.h"
#include "modules/ble/ble_jammer.h"

#ifndef LITE_VERSION
#include "modules/pwnagotchi/pwnagotchi.h"
#endif

void WifiMenu::optionsMenu() {
if(!wifiConnected) {
options = {
Expand All @@ -34,6 +38,7 @@ void WifiMenu::optionsMenu() {
options.push_back({"Scan Hosts", [=]() { local_scan_setup(); }});
#ifndef LITE_VERSION
options.push_back({"Wireguard", [=]() { wg_setup(); }});
options.push_back({"Pwnagotchi", [=]() { pwnagotchi_start(); }});
#endif
#if defined(USE_NRF24_VIA_SPI)
options.push_back({"NRF24 Jammer", [=]() { ble_jammer(); }});
Expand All @@ -53,4 +58,4 @@ void WifiMenu::draw() {
tft.fillCircle(40+iconX,60+iconY,6,FGCOLOR);
tft.drawArc(40+iconX,60+iconY,26,20,130,230,FGCOLOR, BGCOLOR);
tft.drawArc(40+iconX,60+iconY,46,40,130,230,FGCOLOR, BGCOLOR);
}
}
94 changes: 94 additions & 0 deletions src/modules/pwnagotchi/mood.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
Thanks to thoses developers for their projects:
* @7h30th3r0n3 : https://github.com/7h30th3r0n3/Evil-M5Core2 and https://github.com/7h30th3r0n3/PwnGridSpam
* @viniciusbo : https://github.com/viniciusbo/m5-palnagotchi
* @sduenasg : https://github.com/sduenasg/pio_palnagotchi
Thanks to @bmorcelli for his help doing a better code.
*/

#ifndef LITE_VERSION
#include "mood.h"

// ASCII equivalent
const String palnagotchi_moods[] = {
"(v__v)", // 0 - sleeping
"(=__=)", // 1 - awakening
"(O__O)", // 2 - awake
"( O_O)", // 3 - observing (neutral) right
"(O_O )", // 4 - observig (neutral) left
"( 0_0)", // 5 - observing (happy) right
"(0_0 )", // 6 - observing (happy) left
"(+__+)", // 7 - intense
"(-@_@)", // 8 - cool
"(0__0)", // 9 - happy
"(^__^)", // 10 - grateful
"(UwU )", // 11 - excited
"(+__+)", // 12 - smart
"(*__*)", // 13 - friendly
"(@__@)", // 14 - motivated
"(>__<)", // 15 - demotivated
"(-__-)", // 16 - bored
"(T_T )", // 17 - sad
"(;__;)", // 18 - lonely
"(X__X)", // 19 - broken
"(#__#)", // 20 - debugging
"(-_-')", // 21 - angry
"(^__^)", // 22- helping
};

const String palnagotchi_moods_desc[] = {
"Zzzz...", // 0 - sleeping
"...", // 1 - awakening
"Let's MAKE FRENS!", // 2 - awake
"WANTED: FRENS", // 3 - observing (neutral) right
"WANTED: FRENS", // 4 - observig (neutral) left
"Looking for frens that pwn.", // 5 - observing (happy) right
"Looking for frens that pwn.", // 6 - observing (happy) left
"YEAH! So many pwnagotchis!", // 7 - intense
"The coolest pal in the neighbourhood", // 8 - cool
"Can we have even more frens?", // 9 - happy
"I LOVE PWNAGOTCHIS!", // 10 - grateful
"When I grow up, I'll PWN myself!!", // 11 - excited
"3.1415926535897932384626433832795", // 12 - smart
"HEY YOU! LETS BE FRENS!", // 13 - friendly
"IT RUNS! PWND!", // 14 - motivated
"I don't PWN, therefore i don't am.", // 15 - demotivated
"Seriously, let's go for a walk...", // 16 - bored
"Really? This hardware? can't PWN...", // 17 - sad
"Where are all the Pwnagotchis?", // 18 - lonely
"It works on my end.", // 19 - broken
"My frens pwn.", // 20 - debugging
"SO ANGERY, BUT CANT PWN", // 21 - angry
"Helping Pwnagotchis be sane since 2024",
};

uint8_t current_mood = 0;
String current_phrase = "";
String current_face = "";
bool current_broken = false;
const int number_of_moods = 23; //sizeof(palnagotchi_moods);

uint8_t getCurrentMoodId() { return current_mood; }
int getNumberOfMoods() { return number_of_moods; }
String getCurrentMoodFace() { return current_face; }
String getCurrentMoodPhrase() { return current_phrase; }
bool isCurrentMoodBroken() { return current_broken; }

void setMood(uint8_t mood, String face, String phrase, bool broken) {
current_mood = mood;
current_broken = broken;

if (face != "") {
current_face = face;
} else {
current_face = palnagotchi_moods[current_mood];
}

if (phrase != "") {
current_phrase = phrase;
} else {
current_phrase = palnagotchi_moods_desc[current_mood];
}
}
#endif
22 changes: 22 additions & 0 deletions src/modules/pwnagotchi/mood.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Thanks to thoses developers for their projects:
* @7h30th3r0n3 : https://github.com/7h30th3r0n3/Evil-M5Core2 and https://github.com/7h30th3r0n3/PwnGridSpam
* @viniciusbo : https://github.com/viniciusbo/m5-palnagotchi
* @sduenasg : https://github.com/sduenasg/pio_palnagotchi
Thanks to @bmorcelli for his help doing a better code.
*/

#ifndef LITE_VERSION
#include <Arduino.h>

#define MOOD_BROKEN 19

void setMood(uint8_t mood, String face = "", String phrase = "",
bool broken = false);
uint8_t getCurrentMoodId();
int getNumberOfMoods();
String getCurrentMoodFace();
String getCurrentMoodPhrase();
bool isCurrentMoodBroken();
#endif
124 changes: 124 additions & 0 deletions src/modules/pwnagotchi/pwnagotchi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
Thanks to thoses developers for their projects:
* @7h30th3r0n3 : https://github.com/7h30th3r0n3/Evil-M5Core2 and https://github.com/7h30th3r0n3/PwnGridSpam
* @viniciusbo : https://github.com/viniciusbo/m5-palnagotchi
* @sduenasg : https://github.com/sduenasg/pio_palnagotchi
Thanks to @bmorcelli for his help doing a better code.
*/

#ifndef LITE_VERSION
#include <Arduino.h>
#include "core/mykeyboard.h"
#include "ui.h"
#include "spam.h"

#define STATE_INIT 0
#define STATE_WAKE 1
#define STATE_HALT 255

void advertise(uint8_t channel);
void wakeUp();

uint8_t state;
uint8_t current_channel = 1;
uint32_t last_mood_switch = 10001;
bool pwnagotchi_exit = false;

void pwnagotchi_setup() {
initPwngrid();
initUi();
state = STATE_INIT;
Serial.println("Pwnagotchi Initialized");
}

void pwnagotchi_update() {
if (state == STATE_HALT) {
return;
}

if (state == STATE_INIT) {
state = STATE_WAKE;
wakeUp();
}

if (state == STATE_WAKE) {
checkPwngridGoneFriends();
advertise(current_channel++);
if (current_channel == 15) {
current_channel = 1;
}
}
updateUi(true);
}

void wakeUp() {
for (uint8_t i = 0; i < 3; i++) {
setMood(i);
updateUi(false);
delay(1250);
}
}

void advertise(uint8_t channel) {
uint32_t elapsed = millis() - last_mood_switch;
if (elapsed > 8000) {
setMood(random(2, getNumberOfMoods() - 1)); //random mood
last_mood_switch = millis();
}

esp_err_t result = pwngridAdvertise(channel, getCurrentMoodFace());

if (result == ESP_ERR_WIFI_IF) {
setMood(MOOD_BROKEN, "", "Error: invalid interface", true);
state = STATE_HALT;
} else if (result == ESP_ERR_INVALID_ARG) {
setMood(MOOD_BROKEN, "", "Error: invalid argument", true);
state = STATE_HALT;
} else if (result != ESP_OK) {
setMood(MOOD_BROKEN, "", "Error: unknown", true);
state = STATE_HALT;
}
}

void set_pwnagotchi_exit(bool new_value) {
pwnagotchi_exit = new_value;
}

void pwnagotchi_start() {
int tmp = 0;

tft.fillScreen(BGCOLOR);
options = {
{"Find frens", [=]() { }},
{"Pwngrid spam", [=]() { send_pwnagotchi_beacon_main(); }},
{"Main Menu", [=]() { set_pwnagotchi_exit(true); }},
};

pwnagotchi_setup();
delay(300); // Due to select button pressed to enter / quit this feature*

// Draw footer & header
drawTopCanvas();
drawBottomCanvas();

while(true) {
if(millis()-tmp>3000) {
tmp=millis();
pwnagotchi_update();
}
if (checkSelPress()) {
// Display menu
loopOptions(options);
// Redraw footer & header
tft.fillScreen(BGCOLOR);
drawTopCanvas();
drawBottomCanvas();
}
if (pwnagotchi_exit) {
break;
}
delay(50);
}
}
#endif
14 changes: 14 additions & 0 deletions src/modules/pwnagotchi/pwnagotchi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Thanks to thoses developers for their projects:
* @7h30th3r0n3 : https://github.com/7h30th3r0n3/Evil-M5Core2 and https://github.com/7h30th3r0n3/PwnGridSpam
* @viniciusbo : https://github.com/viniciusbo/m5-palnagotchi
* @sduenasg : https://github.com/sduenasg/pio_palnagotchi
Thanks to @bmorcelli for his help doing a better code.
*/

#ifndef LITE_VERSION
void pwnagotchi_start();
void pwnagotchi_setup();
void pwnagotchi_update();
#endif
Loading

0 comments on commit 1156d17

Please sign in to comment.