20
20
const char ssidList[][33 ] PROGMEM = {
21
21
22
22
// "12345678901234567890123456789012" // as a point of reference, this is 32 ASCII characters
23
-
23
+
24
24
" The Password is..." ,
25
25
" Untrusted Network" ,
26
26
" 404 Network Unavailable" ,
@@ -41,6 +41,7 @@ const char ssidList[][33] PROGMEM = {
41
41
" The LAN Before Time" ,
42
42
" Get off my LAN" ,
43
43
" Silence of the LAN"
44
+
44
45
};
45
46
46
47
// ////// channels ////////
@@ -67,7 +68,7 @@ const bool wpa2 = false;
67
68
// can be used to "synchronise" two or more devices
68
69
// seed is printed to serial port at start-up
69
70
const uint64_t randomMacSeed = os_random(); // random seed on startup
70
- // const uint64_t randomMacSeed = 0x1234abcd ; // fixed seed; make it your own
71
+ // const uint64_t randomMacSeed = 0x12345abc ; // fixed seed; make it your own
71
72
72
73
// ////// Includes ////////
73
74
#include < ESP8266WiFi.h>
@@ -84,6 +85,7 @@ const uint64_t randomMacSeed = os_random(); // random seed on startup
84
85
// run-time variables
85
86
uint16_t channelIndex = 0 ;
86
87
uint8_t macAddr[5 ];
88
+ uint8_t macAddr_b[5 ];
87
89
uint8_t wifi_channel = channels[0 ];
88
90
uint32_t packetSize = 0 ;
89
91
uint32_t loopStartTime = 0 ;
@@ -187,13 +189,12 @@ void randomMac() {
187
189
macAddr[2 ] = uint8_t (random (0x0 , 0x100 ));
188
190
macAddr[3 ] = uint8_t (random (0x0 , 0x100 ));
189
191
macAddr[4 ] = uint8_t (random (0x0 , 0x100 ));
190
- // macAddr[5] = uint8_t(0x00); // this one gets assigned sequentially,
192
+ macAddr[5 ] = uint8_t (0x00 ); // this one gets assigned sequentially,
191
193
// later on, when this mode is in use
192
194
}
193
195
194
196
void mayhemMac (uint32_t ssidNum) {
195
197
// SEE COMMENTS, ABOVE
196
- randomSeed (uint32_t ((randomMacSeed) + (ssidNum)));
197
198
macAddr[0 ] = uint8_t (random (0x0 , 0x100 )) & 0xfe | 0x02 ; // SEE COMMENTS, ABOVE
198
199
macAddr[1 ] = uint8_t (random (0x0 , 0x100 ));
199
200
macAddr[2 ] = uint8_t (random (0x0 , 0x100 ));
@@ -241,7 +242,7 @@ void setup() {
241
242
242
243
// /////////////////////////////
243
244
// mac and ssid startup message
244
- Serial.println (" \n //// Atom Smasher's Beacon Spammer v1.0 ////\n\n // MACs: SSIDs:" );
245
+ Serial.println (" \n //// Atom Smasher's Beacon Spammer v1.1 ////\n\n // MACs: SSIDs:" );
245
246
ssidCount = sizeof (ssidList) / sizeof (ssidList[0 ]);
246
247
i = 0 ;
247
248
if (0 == macMode) {
@@ -250,12 +251,18 @@ void setup() {
250
251
for (i = 0 ; i < ssidCount; i++) {
251
252
yield (); // needed for extra-large lists
252
253
Serial.printf (" %02x:%02x:%02x:%02x:%02x:%02x %s\n " ,
253
- macAddr[0 ], macAddr[1 ], macAddr[2 ], macAddr[3 ], macAddr[4 ], macAddr[5 ] + i + 1 ,
254
+ macAddr[0 ],
255
+ macAddr[1 ],
256
+ macAddr[2 ],
257
+ uint8_t (macAddr[3 ] + ((macAddr[4 ] + (i / 0x100 )) / 0x100 )), // rollover mac address for large ssid lists
258
+ uint8_t (macAddr[4 ] + (i / 0x100 )), // rollover mac address for large ssid lists
259
+ uint8_t (i), // "i" bound by uint8 is effectively "i % 0x100", and it becomes "macAddr[5]"
254
260
ssidList[i]);
255
261
// end start macMode=0
256
262
}
257
263
} else {
258
264
// start macMode=1
265
+ randomSeed (uint32_t (randomMacSeed));
259
266
for (i = 0 ; i < ssidCount; i++) {
260
267
yield (); // needed for extra-large lists
261
268
mayhemMac (i);
@@ -276,6 +283,10 @@ void setup() {
276
283
// during the first iteration of the packet counter loop
277
284
loopStartTime = packetRateTime = millis ();
278
285
286
+
287
+ macAddr_b[3 ] = macAddr[3 ]; // rollover safety
288
+ macAddr_b[4 ] = macAddr[4 ]; // rollover safety
289
+
279
290
}
280
291
281
292
void loop () {
@@ -287,16 +298,22 @@ void loop() {
287
298
288
299
uint32_t ssidNum = 0 ;
289
300
301
+ if (1 == macMode) {
302
+ randomSeed (uint32_t (randomMacSeed));
303
+ }
304
+
290
305
// for each ssid ...
291
306
for (i = 0 ; i < ssidCount; i++) {
292
307
293
308
// /////////////
294
309
// if mayhemMac
295
310
if (1 == macMode) {
296
311
mayhemMac (ssidNum);
297
- // ////
298
312
} else {
299
- macAddr[5 ] = ssidNum;
313
+ // classic mac mode
314
+ macAddr[5 ] = uint8_t (ssidNum);
315
+ macAddr[4 ] = uint8_t (macAddr_b[4 ] + (ssidNum / 0x100 )); // gracefully handle >256 SSIDs
316
+ macAddr[3 ] = uint8_t (macAddr_b[3 ] + ((macAddr_b[4 ] + (ssidNum / 0x100 )) / 0x100 )); // gracefully handle >256 SSIDs
300
317
}
301
318
302
319
ssidNum++;
0 commit comments