Skip to content

Commit

Permalink
Merge pull request #546 from bmorcelli/main
Browse files Browse the repository at this point in the history
ARP Spoofing, ARP Poisoning, STA Deauth, Deauth on RAW Sniffer, UI COlors
  • Loading branch information
pr3y authored Dec 12, 2024
2 parents 07ea13b + 8d436dd commit d151c2b
Show file tree
Hide file tree
Showing 24 changed files with 584 additions and 185 deletions.
6 changes: 4 additions & 2 deletions ports/lilygo-t-embed-cc1101/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ build_flags =
lib_deps =
${env.lib_deps}
lewisxhe/XPowersLib @0.2.6
mathertel/RotaryEncoder @ ^1.5.3
mathertel/RotaryEncoder @1.5.3


[env:lilygo-t-embed]
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
Expand Down Expand Up @@ -332,5 +333,6 @@ build_flags =
lib_deps =
${env.lib_deps}
lewisxhe/XPowersLib @0.2.6
mathertel/RotaryEncoder @ ^1.5.3
mathertel/RotaryEncoder @1.5.3

#################################### END OF LILYGO MODELS #######################################
27 changes: 25 additions & 2 deletions src/core/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ void displaySuccess(String txt, bool waitKeyPress) {
while(waitKeyPress && !checkAnyKeyPress()) delay(100);
}

void displaySomething(String txt, bool waitKeyPress) {
#ifndef HAS_SCREEN
Serial.println("MESSAGE: " + txt);
return;
#endif
// todo: add newlines to txt if too long
displayRedStripe(txt, getComplementaryColor2(bruceConfig.priColor), bruceConfig.priColor);
delay(200);
while(waitKeyPress && !checkAnyKeyPress()) delay(100);
}


void setPadCursor(int16_t padx, int16_t pady) {
for (int y=0; y<pady; y++) tft.println();
tft.setCursor(padx * BORDER_PAD_X, tft.getCursorY());
Expand Down Expand Up @@ -285,7 +297,9 @@ int loopOptions(std::vector<Option>& options, bool bright, bool submenu, String
if(submenu) drawSubmenu(index, options, subText);
else coord=drawOptions(index, options, bruceConfig.priColor, bruceConfig.bgColor);
if(bright){
setBrightness(String(options[index].label.c_str()).toInt(),false);
uint8_t bv = String(options[index].label.c_str()).toInt(); // Grabs the int value from menu option
if(bv>0) setBrightness(bv,false); // If valid, apply brightnes
else setBrightness(bruceConfig.bright,false); // if "Main Menu", bv==0, return brightness to default
}
redraw=false;
delay(REDRAW_DELAY);
Expand Down Expand Up @@ -1076,7 +1090,16 @@ bool showGIF(FS fs, String filename, int x, int y) {
return false;
}


/***************************************************************************************
** Function name: getComplementaryColor2
** Description: Get simple complementary color in RGB565 format
***************************************************************************************/
uint16_t getComplementaryColor2(uint16_t color) {
int r = 31-((color >> 11) & 0x1F);
int g = 63-((color >> 5) & 0x3F);
int b = 31-(color & 0x1F);
return (r<<11) | (g<<5) | b;
}
/***************************************************************************************
** Function name: getComplementaryColor
** Description: Get complementary color in RGB565 format
Expand Down
11 changes: 6 additions & 5 deletions src/core/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ bool showGIF(FS fs,String filename, int x=0, int y=0);
bool showJpeg(FS fs,String filename, int x=0, int y=0, bool center = false);

uint16_t getComplementaryColor(uint16_t color);
uint16_t getComplementaryColor2(uint16_t color);
uint16_t getColorVariation(uint16_t color, int delta = 10, int direction = 0);

void resetTftDisplay(int x = 0, int y = 0, uint16_t fc = bruceConfig.priColor, int size = FM, uint16_t bg = bruceConfig.bgColor, uint16_t screen = bruceConfig.bgColor);
void setTftDisplay(int x = 0, int y = 0, uint16_t fc = tft.textcolor, int size = tft.textsize, uint16_t bg = tft.textbgcolor);

void displayRedStripe(String text, uint16_t fgcolor = TFT_WHITE, uint16_t bgcolor = TFT_RED);

void displayError(String txt, bool waitKeyPress = false); // Faixa vermelha
void displayWarning(String txt, bool waitKeyPress = false);// Faixa amarela
void displayInfo(String txt, bool waitKeyPress = false); // Faixa Azul
void displaySuccess(String txt, bool waitKeyPress = false);// Faixa Verde

void displayError(String txt, bool waitKeyPress = false); // Red Stripe
void displayWarning(String txt, bool waitKeyPress = false); // Yellow Stripe
void displayInfo(String txt, bool waitKeyPress = false); // Blue Stripe
void displaySuccess(String txt, bool waitKeyPress = false); // Green Strupe
void displaySomething(String txt, bool waitKeyPress = false); // UI Colored stripe
void setPadCursor(int16_t padx=1, int16_t pady=0);

void padprintf(int16_t padx, const char *format, ...);
Expand Down
2 changes: 1 addition & 1 deletion src/core/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void setBrightnessMenu() {
{"50 %", [=]() { setBrightness(50); }, bruceConfig.bright == 50 },
{"25 %", [=]() { setBrightness(25); }, bruceConfig.bright == 25 },
{" 1 %", [=]() { setBrightness(1); }, bruceConfig.bright == 1 },
{"Main Menu", [=]() { backToMenu(); }},
{"Main Menu", [=]() { backToMenu(); }}, // this one bugs the brightness selection
};
delay(200);
loopOptions(options, true,false,"",idx);
Expand Down
2 changes: 1 addition & 1 deletion src/core/wifi_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool wifiConnectMenu(wifi_mode_t mode)
case WIFI_STA: // station mode
int nets;
WiFi.mode(WIFI_MODE_STA);
displayRedStripe("Scanning..", TFT_WHITE, bruceConfig.priColor);
displaySomething("Scanning..");
nets = WiFi.scanNetworks();
options = {};
for (int i = 0; i < nets; i++) {
Expand Down
14 changes: 5 additions & 9 deletions src/modules/ble/bad_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,23 +284,19 @@ void ble_setup() {
if (!kbChosen_ble) Kble.begin(); // starts the KeyboardLayout_en_US as default if nothing had beed chosen (cancel selection)
Ask_for_restart=1; // arm the flag
first_time=false;
displayRedStripe("Waiting Victim",TFT_WHITE, bruceConfig.priColor);
displaySomething("Waiting Victim");
}
while (!Kble.isConnected() && !checkEscPress());

if(Kble.isConnected()) {
BLEConnected=true;
displayRedStripe("Preparing",TFT_WHITE, bruceConfig.priColor);
displaySomething("Preparing");
delay(1000);
displayWarning(String(BTN_ALIAS) + " to deploy", true);
delay(200);
key_input_ble(*fs, bad_script);

displayRedStripe("Payload Sent",TFT_WHITE, bruceConfig.priColor);
checkSelPress();
while (!checkSelPress()) {
// nothing here, just to hold the screen press Ok of M5.
}
displaySomething("Payload Sent",true);
if(returnToMenu) goto End; // when cancel the run in the middle, go to End to turn off BLE services
// Try to run a new script on the same device

Expand All @@ -321,7 +317,7 @@ void ble_MediaCommands() {

if(!Kble.isConnected()) Kble.begin();

displayRedStripe("Pairing...",TFT_WHITE, bruceConfig.priColor);
displaySomething("Pairing...");

while (!Kble.isConnected() && !checkEscPress());

Expand Down Expand Up @@ -380,7 +376,7 @@ void ble_keyboard() {
if (!kbChosen_ble) Kble.begin(); // starts the KeyboardLayout_en_US as default if nothing had beed chosen (cancel selection)
Ask_for_restart=1;
Reconnect:
displayRedStripe("Pair to start",TFT_WHITE, bruceConfig.priColor);
displaySomething("Pair to start");

while (!Kble.isConnected() && !checkEscPress()); // loop to wait for the connection callback or ESC

Expand Down
2 changes: 1 addition & 1 deletion src/modules/ble/ble_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void ble_scan_setup()

void ble_scan()
{
displayRedStripe("Scanning..", TFT_WHITE, bruceConfig.priColor);
displaySomething("Scanning..");

options = { };
ble_scan_setup();
Expand Down
10 changes: 5 additions & 5 deletions src/modules/ble/ble_spam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,23 +451,23 @@ void aj_adv(int ble_choice){

switch(ble_choice){
case 0: // Applejuice
displayRedStripe("iOS Spam (" + String(count) + ")",TFT_WHITE,bruceConfig.priColor);
displaySomething("iOS Spam (" + String(count) + ")");
executeSpam(Apple);
break;
case 1: // SwiftPair
displayRedStripe("SwiftPair (" + String(count) + ")",TFT_WHITE,bruceConfig.priColor);
displaySomething("SwiftPair (" + String(count) + ")");
executeSpam(Microsoft);
break;
case 2: // Samsung
displayRedStripe("Samsung (" + String(count) + ")",TFT_WHITE,bruceConfig.priColor);
displaySomething("Samsung (" + String(count) + ")");
executeSpam(Samsung);
break;
case 3: // Android
displayRedStripe("Android (" + String(count) + ")",TFT_WHITE,bruceConfig.priColor);
displaySomething("Android (" + String(count) + ")");
executeSpam(Google);
break;
case 4: // Tutti-frutti
displayRedStripe("Spam All (" + String(count) + ")",TFT_WHITE,bruceConfig.priColor);
displaySomething("Spam All (" + String(count) + ")");
if(mael == 0) executeSpam(Google);
if(mael == 1) executeSpam(Samsung);
if(mael == 2) executeSpam(Microsoft);
Expand Down
15 changes: 6 additions & 9 deletions src/modules/fm/fm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ uint16_t fm_scan() {
min_noise = radio.currNoiseLevel;

tft.fillScreen(bruceConfig.bgColor);
displayRedStripe("Scanning...", TFT_WHITE, bruceConfig.priColor);
displaySomething("Scanning...");
for (f=8750; f<10800; f+=10) {
Serial.print("Measuring "); Serial.print(f); Serial.print("...");
radio.readTuneMeasure(f);
Expand All @@ -51,7 +51,7 @@ uint16_t fm_scan() {

sprintf(display_freq, "Found %d MHz", freq_candidate);
tft.fillScreen(bruceConfig.bgColor);
displayRedStripe(display_freq, TFT_WHITE, bruceConfig.priColor);
displaySomething(display_freq);
while(!checkEscPress() && !checkSelPress()) {
delay(100);
}
Expand All @@ -64,7 +64,7 @@ void fm_options_frq(uint16_t f_min, bool reserved) {
char f_str[5];
uint16_t f_max;
// Choose between scan for best freq or select freq
displayRedStripe("Choose frequency", TFT_WHITE, bruceConfig.priColor);
displaySomething("Choose frequency");
delay(1000);

// Handle min / max frequency
Expand Down Expand Up @@ -96,7 +96,7 @@ void fm_options_digit(uint16_t f_min, bool reserved) {
char f_str[5];
uint16_t f_max;
// Choose between scan for best freq or select freq
displayRedStripe("Choose digit", TFT_WHITE, bruceConfig.priColor);
displaySomething("Choose digit");
delay(1000);

// Handle min / max frequency
Expand Down Expand Up @@ -133,7 +133,7 @@ void fm_options_digit(uint16_t f_min, bool reserved) {
void fm_options(uint16_t f_min, uint16_t f_max, bool reserved) {
char f_str[5];
// Choose between scan for best freq or select freq
displayRedStripe("Choose tens", TFT_WHITE, bruceConfig.priColor);
displaySomething("Choose tens");
delay(1000);

options = { };
Expand Down Expand Up @@ -229,10 +229,7 @@ bool fm_begin() {
if (!radio.begin()) { // begin with address 0x63 (CS high default)
tft.fillScreen(bruceConfig.bgColor);
Serial.println("Cannot find radio");
displayRedStripe("Cannot find radio", TFT_WHITE, bruceConfig.priColor);
while(!checkEscPress() && !checkSelPress()) {
delay(100);
}
displaySomething("Cannot find radio",true);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/gps/gps_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool GPSTracker::begin_gps() {
end();
return false;
}
displayRedStripe("Waiting GPS: " + String(count)+ "s", TFT_WHITE, bruceConfig.priColor);
displaySomething("Waiting GPS: " + String(count)+ "s");
count++;
delay(1000);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/gps/wardriving.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool Wardriving::begin_gps() {
end();
return false;
}
displayRedStripe("Waiting GPS: " + String(count)+ "s", TFT_WHITE, bruceConfig.priColor);
displaySomething("Waiting GPS: " + String(count)+ "s");
count++;
delay(1000);
}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/ir/TV-B-Gone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void StartTvBGone() {
if (checkSelPress()) // Pause TV-B-Gone
{
while (checkSelPress()) yield();
displayRedStripe("Paused", TFT_WHITE, bruceConfig.bgColor);
displaySomething("Paused");

while (!checkSelPress()){ // If Presses Select again, continues
if(checkEscPress()) {
Expand All @@ -181,15 +181,15 @@ void StartTvBGone() {
yield();
}
if (endingEarly) break; // Cancels TV-B-Gone
displayRedStripe("Running, Wait", TFT_WHITE, bruceConfig.priColor);
displaySomething("Running, Wait");
}

} //end of POWER code for loop


if (endingEarly==false)
{
displayRedStripe("All codes sent!", TFT_WHITE, bruceConfig.priColor);
displaySomething("All codes sent!");
//pause for ~1.3 sec, then flash the visible LED 8 times to indicate that we're done
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
delay_ten_us(MAX_WAIT_TIME); // wait 655.350ms
Expand Down
20 changes: 10 additions & 10 deletions src/modules/ir/custom_ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bool txIrFile(FS *fs, String filepath) {
if (checkSelPress()) // Pause TV-B-Gone
{
while (checkSelPress()) yield();
displayRedStripe("Paused", TFT_WHITE, bruceConfig.bgColor);
displaySomething("Paused");

while (!checkSelPress()){ // If Presses Select again, continues
if(checkEscPress()) {
Expand All @@ -211,7 +211,7 @@ bool txIrFile(FS *fs, String filepath) {
yield();
}
if (endingEarly) break; // Cancels custom IR Spam
displayRedStripe("Running, Wait", TFT_WHITE, bruceConfig.priColor);
displaySomething("Running, Wait");
}
} // end while file has lines to process
databaseFile.close();
Expand Down Expand Up @@ -350,7 +350,7 @@ void otherIRcodes() {
void sendNECCommand(String address, String command) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint8_t first_zero_byte_pos = address.indexOf("00", 2);
if(first_zero_byte_pos!=-1) address = address.substring(0, first_zero_byte_pos);
first_zero_byte_pos = command.indexOf("00", 2);
Expand All @@ -367,7 +367,7 @@ void sendNECCommand(String address, String command) {
void sendRC5Command(String address, String command) {
IRsend irsend(bruceConfig.irTx,true); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint8_t addressValue = strtoul(address.substring(0,2).c_str(), nullptr, 16);
uint8_t commandValue = strtoul(command.substring(0,2).c_str(), nullptr, 16);
uint16_t data = irsend.encodeRC5(addressValue, commandValue);
Expand All @@ -379,7 +379,7 @@ void sendRC5Command(String address, String command) {
void sendRC6Command(String address, String command) {
IRsend irsend(bruceConfig.irTx,true); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint32_t addressValue = strtoul(address.c_str(), nullptr, 16);
uint32_t commandValue = strtoul(command.c_str(), nullptr, 16);
uint64_t data = irsend.encodeRC6(addressValue, commandValue);
Expand All @@ -391,7 +391,7 @@ void sendRC6Command(String address, String command) {
void sendSamsungCommand(String address, String command) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
//uint64_t data = ((uint64_t)strtoul(address.c_str(), nullptr, 16) << 32) | strtoul(command.c_str(), nullptr, 16);
uint32_t addressValue = strtoul(address.c_str(), nullptr, 16);
uint32_t commandValue = strtoul(command.c_str(), nullptr, 16);
Expand All @@ -406,7 +406,7 @@ void sendSamsungCommand(String address, String command) {
void sendSonyCommand(String address, String command) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint16_t commandValue = strtoul(command.substring(0,2).c_str(), nullptr, 16);
uint16_t addressValue = strtoul(address.substring(0,2).c_str(), nullptr, 16);
uint16_t addressValue2 = strtoul(address.substring(3,6).c_str(), nullptr, 16);
Expand All @@ -422,7 +422,7 @@ void sendSonyCommand(String address, String command) {
void sendPanasonicCommand(String address, String command) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint8_t first_zero_byte_pos = address.indexOf("00", 2);
if(first_zero_byte_pos!=-1) address = address.substring(0, first_zero_byte_pos);
// needs to invert endianess
Expand Down Expand Up @@ -455,7 +455,7 @@ bool sendDecodedCommand(String protocol, String value, String bits) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
bool success = false;
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");

if(hasACState(type)) {
// need to send the state (still passed from value)
Expand Down Expand Up @@ -488,7 +488,7 @@ bool sendDecodedCommand(String protocol, String value, String bits) {
void sendRawCommand(uint16_t frequency, String rawData) {
IRsend irsend(bruceConfig.irTx); // Set the GPIO to be used to sending the message.
irsend.begin();
displayRedStripe("Sending..",TFT_WHITE,bruceConfig.priColor);
displaySomething("Sending..");
uint16_t dataBuffer[SAFE_STACK_BUFFER_SIZE/2]; // MEMO: stack overflow with full buffer size
uint16_t count = 0;

Expand Down
Loading

0 comments on commit d151c2b

Please sign in to comment.