Wifi spam timing and structure improved - works again
This commit is contained in:
parent
384450cfaf
commit
18bba41b54
|
@ -7,7 +7,7 @@
|
||||||
//#define CARDPUTER
|
//#define CARDPUTER
|
||||||
// -=-=- Uncommenting more than one at a time will result in errors -=-=-
|
// -=-=- Uncommenting more than one at a time will result in errors -=-=-
|
||||||
|
|
||||||
String buildver="2.0.0rc1";
|
String buildver="2.0.0rc2";
|
||||||
#define BGCOLOR BLACK
|
#define BGCOLOR BLACK
|
||||||
#define FGCOLOR GREEN
|
#define FGCOLOR GREEN
|
||||||
|
|
||||||
|
@ -1178,9 +1178,6 @@ void wifispam_setup() {
|
||||||
packetSize -= 26;
|
packetSize -= 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate random mac address
|
|
||||||
randomMac();
|
|
||||||
|
|
||||||
//change WiFi mode
|
//change WiFi mode
|
||||||
WiFi.mode(WIFI_MODE_STA);
|
WiFi.mode(WIFI_MODE_STA);
|
||||||
|
|
||||||
|
@ -1210,7 +1207,7 @@ void wifispam_setup() {
|
||||||
DISP.print(rickrollssids);
|
DISP.print(rickrollssids);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// placed here for consistency. no-op since display handled in loop.
|
DISP.printf(" - Random SSIDs\n", ct);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DISP.setTextSize(SMALL_TEXT);
|
DISP.setTextSize(SMALL_TEXT);
|
||||||
|
@ -1233,14 +1230,14 @@ void wifispam_loop() {
|
||||||
while(i < len){
|
while(i < len){
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
beaconSpam(funnyssids);
|
beaconSpamList(funnyssids);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
len = sizeof(rickrollssids);
|
len = sizeof(rickrollssids);
|
||||||
while(i < len){
|
while(i < len){
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
beaconSpam(rickrollssids);
|
beaconSpamList(rickrollssids);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
char* randoms = randomSSID();
|
char* randoms = randomSSID();
|
||||||
|
@ -1248,7 +1245,7 @@ void wifispam_loop() {
|
||||||
while(i < len){
|
while(i < len){
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
beaconSpam(randoms);
|
beaconSpamList(randoms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
139
wifispam.h
139
wifispam.h
|
@ -76,31 +76,18 @@ const char rickrollssids[] PROGMEM = {
|
||||||
"08 and hurt you\n"
|
"08 and hurt you\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char foobar[] PROGMEM = {
|
// run-time variables
|
||||||
"abh\nfoooo\nbarrr\nbaz\nbat\ngarply\nquux\nheyfuckface\n"
|
char emptySSID[32];
|
||||||
};
|
char beaconSSID[32];
|
||||||
|
char randomName[32];
|
||||||
#define SSIDLEN 375 /* Change to whatever length you need */
|
uint8_t channelIndex = 0;
|
||||||
|
uint8_t macAddr[6];
|
||||||
char* randomSSID(){
|
uint8_t wifi_channel = 1;
|
||||||
/* Change to allowable characters */
|
uint32_t currentTime = 0;
|
||||||
const char possible[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -.!)(,?%";
|
uint32_t packetSize = 0;
|
||||||
static char ssid[SSIDLEN + 1];
|
uint32_t packetCounter = 0;
|
||||||
for(int p = 0, i = 0; i < SSIDLEN; i++){
|
uint32_t attackTime = 0;
|
||||||
int r = random(0, strlen(possible));
|
uint32_t packetRateTime = 0;
|
||||||
if(r % 7 == 0){
|
|
||||||
ssid[p++] = '\n'; // inject newlines occasionally :D
|
|
||||||
}
|
|
||||||
ssid[p++] = possible[r];
|
|
||||||
}
|
|
||||||
ssid[SSIDLEN] = '\n'; DISP.setTextSize(1);
|
|
||||||
DISP.fillScreen(BLACK);
|
|
||||||
DISP.setCursor(0, 0, 1);
|
|
||||||
DISP.println("Spamming Random SSIDs:");
|
|
||||||
// Maximum broadcast SSID length is 32, but the strings might show longer in the output. Sorry.
|
|
||||||
DISP.print(ssid);
|
|
||||||
return ssid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
@ -121,17 +108,28 @@ const char* generateRandomName() {
|
||||||
return randomName;
|
return randomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* randomSSID() {
|
||||||
|
const char* charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
int len = rand() % 22 + 7; // Generate a random length between 1 and 10
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
randomName[i] = charset[rand() % strlen(charset)]; // S elect random characters from the charset
|
||||||
|
}
|
||||||
|
randomName[len] = '\0'; // Null-terminate the string
|
||||||
|
return randomName;
|
||||||
|
}
|
||||||
|
|
||||||
// run-time variables
|
|
||||||
char emptySSID[32];
|
uint8_t packet[128] = { 0x80, 0x00, 0x00, 0x00, //Frame Control, Duration
|
||||||
uint8_t channelIndex = 0;
|
/*4*/ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //Destination address
|
||||||
uint8_t macAddr[6];
|
/*10*/ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //Source address - overwritten later
|
||||||
uint8_t wifi_channel = 1;
|
/*16*/ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, //BSSID - overwritten to the same as the source address
|
||||||
uint32_t currentTime = 0;
|
/*22*/ 0xc0, 0x6c, //Seq-ctl
|
||||||
uint32_t packetSize = 0;
|
/*24*/ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, //timestamp - the number of microseconds the AP has been active
|
||||||
uint32_t packetCounter = 0;
|
/*32*/ 0x64, 0x00, //Beacon interval
|
||||||
uint32_t attackTime = 0;
|
/*34*/ 0x01, 0x04, //Capability info
|
||||||
uint32_t packetRateTime = 0;
|
/* SSID */
|
||||||
|
/*36*/ 0x00
|
||||||
|
};
|
||||||
|
|
||||||
// beacon frame definition
|
// beacon frame definition
|
||||||
uint8_t beaconPacket[109] = {
|
uint8_t beaconPacket[109] = {
|
||||||
|
@ -200,26 +198,46 @@ void nextChannel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// generates random MAC
|
void beaconSpam(const char ESSID[]){
|
||||||
void randomMac() {
|
Serial.printf("WiFi SSID: %s\n", ESSID);
|
||||||
for (int i = 0; i < 6; i++)
|
int set_channel = random(1,12);
|
||||||
macAddr[i] = random(256);
|
esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE);
|
||||||
|
delay(1);
|
||||||
|
packet[10] = packet[16] = random(256);
|
||||||
|
packet[11] = packet[17] = random(256);
|
||||||
|
packet[12] = packet[18] = random(256);
|
||||||
|
packet[13] = packet[19] = random(256);
|
||||||
|
packet[14] = packet[20] = random(256);
|
||||||
|
packet[15] = packet[21] = random(256);
|
||||||
|
|
||||||
|
int realLen = strlen(ESSID);
|
||||||
|
int ssidLen = random(realLen, 33);
|
||||||
|
int numSpace = ssidLen - realLen;
|
||||||
|
//int rand_len = sizeof(rand_reg);
|
||||||
|
int fullLen = ssidLen;
|
||||||
|
packet[37] = fullLen;
|
||||||
|
|
||||||
|
for(int i = 0; i < realLen; i++)
|
||||||
|
packet[38 + i] = ESSID[i];
|
||||||
|
|
||||||
|
for(int i = 0; i < numSpace; i++)
|
||||||
|
packet[38 + realLen + i] = 0x20;
|
||||||
|
|
||||||
|
packet[50 + fullLen] = set_channel;
|
||||||
|
|
||||||
|
esp_wifi_80211_tx(WIFI_IF_STA, packet, sizeof(packet), false);
|
||||||
|
esp_wifi_80211_tx(WIFI_IF_STA, packet, sizeof(packet), false);
|
||||||
|
esp_wifi_80211_tx(WIFI_IF_STA, packet, sizeof(packet), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void beaconSpam(const char list[]){
|
void beaconSpamList(const char list[]){
|
||||||
attackTime = currentTime;
|
// Parses the char array and splits it into SSIDs
|
||||||
|
|
||||||
// temp variables
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int ssidNum = 1;
|
int ssidNum = 1;
|
||||||
char tmp;
|
char tmp;
|
||||||
int ssidsLen = strlen_P(list);
|
int ssidsLen = strlen_P(list);
|
||||||
bool sent = false;
|
bool sent = false;
|
||||||
|
|
||||||
// go to next channel
|
|
||||||
nextChannel();
|
|
||||||
|
|
||||||
while (i < ssidsLen) {
|
while (i < ssidsLen) {
|
||||||
// read out next SSID
|
// read out next SSID
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -227,31 +245,10 @@ void beaconSpam(const char list[]){
|
||||||
tmp = pgm_read_byte(list + i + j);
|
tmp = pgm_read_byte(list + i + j);
|
||||||
j++;
|
j++;
|
||||||
} while (tmp != '\n' && j <= 32 && i + j < ssidsLen);
|
} while (tmp != '\n' && j <= 32 && i + j < ssidsLen);
|
||||||
|
|
||||||
uint8_t ssidLen = j - 1;
|
uint8_t ssidLen = j - 1;
|
||||||
|
memcpy_P(&beaconSSID, &list[i], ssidLen);
|
||||||
// set MAC address
|
beaconSpam(beaconSSID);
|
||||||
macAddr[5] = ssidNum;
|
memcpy_P(&beaconSSID, &emptySSID, 32);
|
||||||
ssidNum++;
|
|
||||||
|
|
||||||
// write MAC address into beacon frame
|
|
||||||
memcpy(&beaconPacket[10], macAddr, 6);
|
|
||||||
memcpy(&beaconPacket[16], macAddr, 6);
|
|
||||||
|
|
||||||
// reset SSID
|
|
||||||
memcpy(&beaconPacket[38], emptySSID, 32);
|
|
||||||
|
|
||||||
// write new SSID into beacon frame
|
|
||||||
memcpy_P(&beaconPacket[38], &list[i], ssidLen);
|
|
||||||
|
|
||||||
// set channel for beacon frame
|
|
||||||
beaconPacket[82] = wifi_channel;
|
|
||||||
|
|
||||||
// send packet
|
|
||||||
for (int k = 0; k < 3; k++) {
|
|
||||||
packetCounter += esp_wifi_80211_tx(WIFI_IF_STA, beaconPacket, packetSize, 0) == 0;
|
|
||||||
delay(1);
|
|
||||||
}
|
|
||||||
i += j;
|
i += j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue