Skip to content

Commit 34b5f08

Browse files
author
Stefan Kremser
committed
Merge branch 'testing'
2 parents 505ad80 + 3cbc667 commit 34b5f08

37 files changed

+877
-1144
lines changed

LICENSE.md

-163
This file was deleted.

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ Please don't refer to this project as "jammer", that totaly underminds the real
7777

7878
**You can flash this software yourself onto any ESP8266**, but if you would like to support me, you can get one of these cool boards that are made especially for this project and come with everything preinstalled!
7979

80-
- WiFi Deauther (Pocket WiFi)
80+
- WiFi Deauther v1.5
8181
- [AliExpress](https://goo.gl/JAXhTg)
8282
- [tindie](https://goo.gl/yMiuGH)
83-
- WiFi Deauther OLED (Pocket WiFi)
83+
- WiFi Deauther OLED v1.5
8484
- [AliExpress](https://goo.gl/P30vNz)
8585
- [tindie](https://goo.gl/GGH7x8)
86+
- WiFi Deauther OLED v2
87+
- [AliExpress](https://goo.gl/UK87iU)
88+
- [tindie](https://goo.gl/PMDYn4)
8689

8790
## Installation
8891

@@ -264,7 +267,7 @@ ESP8266:
264267

265268
packet injection with ESP8266:
266269
* http://hackaday.com/2016/01/14/inject-packets-with-an-esp8266/
267-
* http://bbs.espressif.com/viewtopic.php?f=7&t=1357&p=10205&hilit=Wi-Fi_pkt_freedom#p10205
270+
* http://bbs.espressif.com/viewtopic.php?f=7&t=1357
268271
* https://github.com/pulkin/esp8266-injection-example
269272

270273
802.11w-2009: https://en.wikipedia.org/wiki/IEEE_802.11w-2009

esp8266_deauther/APScan.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@ bool APScan::start() {
1010
Serial.println("MAC - Ch - RSSI - Encrypt. - SSID - Hidden");// - Vendor");
1111
}
1212
aps._clear();
13-
for (int i = 0; i < maxAPScanResults; i++) selected[i] = false;
13+
results = 0;
14+
for (int i = 0; i < maxAPScanResults; i++){
15+
selected[i] = false;
16+
String("").toCharArray(names[i], 33);
17+
}
1418
results = WiFi.scanNetworks(false, settings.apScanHidden); // lets scanNetworks return hidden APs. (async = false & show_hidden = true)
19+
if(results > maxAPScanResults) results = maxAPScanResults;
1520

16-
for (int i = 0; i < results && i < maxAPScanResults; i++) {
21+
if (debug) Serial.println("Scan results: "+(String)results);
22+
23+
for (int i = 0; i < results; i++) {
1724
Mac _ap;
1825
_ap.set(WiFi.BSSID(i)[0], WiFi.BSSID(i)[1], WiFi.BSSID(i)[2], WiFi.BSSID(i)[3], WiFi.BSSID(i)[4], WiFi.BSSID(i)[5]);
1926
aps.add(_ap);
@@ -112,9 +119,6 @@ String APScan::getAPEncryption(int num) {
112119
String APScan::getAPMac(int num) {
113120
return aps._get(num).toString();
114121
}
115-
bool APScan::getAPSelected(int num) {
116-
return selected[num];
117-
}
118122
bool APScan::isHidden(int num) {
119123
return hidden[num];
120124
}
@@ -178,7 +182,7 @@ void APScan::sendResults() {
178182
json += "\"r\":" + (String)getAPRSSI(i) + ",";
179183
json += "\"e\":" + (String)encryption[i] + ",";
180184
//json += "\"v\":\""+getAPVendor(i)+"\",";
181-
json += "\"se\":" + (String)getAPSelected(i);
185+
json += "\"se\":" + (String)isSelected(i);
182186
json += "}";
183187
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
184188

@@ -211,7 +215,7 @@ String APScan::getResultsJSON() {
211215
json += "\"r\":" + (String)getAPRSSI(i) + ",";
212216
json += "\"e\":" + (String)encryption[i] + ",";
213217
//json += "\"v\":\""+getAPVendor(i)+"\",";
214-
json += "\"se\":" + (String)getAPSelected(i);
218+
json += "\"se\":" + (String)isSelected(i);
215219
json += "}";
216220
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
217221
}

esp8266_deauther/APScan.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class APScan {
3232
String getAPEncryption(int num);
3333
//String getAPVendor(int num);
3434
String getAPMac(int num);
35-
bool getAPSelected(int num);
3635
bool isHidden(int num);
3736
int getAPRSSI(int num);
3837
int getAPChannel(int num);
@@ -57,4 +56,4 @@ class APScan {
5756

5857
};
5958

60-
#endif
59+
#endif

esp8266_deauther/Attack.cpp

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "Attack.h"
22

33
Attack::Attack() {
4-
randomSeed(os_random());
54
}
65

76
void Attack::generate() {
@@ -13,8 +12,7 @@ void Attack::generate() {
1312

1413
for (int i = 0; i < macListLen; i++) channels[i] = random(1, maxChannel);
1514
do {
16-
getRandomVendorMac(_randomMacBuffer);
17-
for (int i = 0; i < 6; i++) _randomBeaconMac.setAt(_randomMacBuffer[i], i);
15+
_randomBeaconMac.randomize();
1816
} while (beaconAdrs.add(_randomBeaconMac) >= 0);
1917
if (debug) Serial.println("done");
2018

@@ -162,7 +160,7 @@ void Attack::run() {
162160
if (apScan.isSelected(a)) {
163161
Mac _ap;
164162
int _ch = apScan.getAPChannel(a);
165-
_ap.setMac(apScan.aps._get(a));
163+
_ap.set(apScan.aps._get(a));
166164

167165
wifi_set_channel(_ch);
168166

@@ -213,11 +211,7 @@ void Attack::run() {
213211
prevTime[1] = millis();
214212

215213
for (int a = 0; a < ssidList.len; a++) {
216-
String _ssid = ssidList.get(a);
217-
int _ch = channels[a];
218-
219-
buildBeacon(beaconAdrs._get(a), _ssid, _ch, settings.attackEncrypted);
220-
214+
buildBeacon(beaconAdrs._get(a), ssidList.get(a), channels[a], ssidList.isEncrypted(a));
221215
if (send()) packetsCounter[1]++;
222216
}
223217

@@ -287,7 +281,8 @@ void Attack::start(int num) {
287281
attackTimeoutCounter[num] = 0;
288282
refreshLed();
289283
if (debug) Serial.println("starting " + (String)attackNames[num] + " attack...");
290-
if (num == 0) attackMode = "STOP";
284+
if (num == 0) attackMode_deauth = "STOP";
285+
else if(num == 1) attackMode_beacon = "STOP";
291286
if(!settings.multiAttacks){
292287
for (int i = 0; i < attacksNum; i++){
293288
if(i != num) stop(i);
@@ -299,7 +294,8 @@ void Attack::start(int num) {
299294
void Attack::stop(int num) {
300295
if(isRunning[num]) {
301296
if (debug) Serial.println("stopping " + (String)attackNames[num] + " attack...");
302-
if (num == 0) attackMode = "START";
297+
if (num == 0) attackMode_deauth = "START";
298+
else if(num == 1) attackMode_beacon = "START";
303299
isRunning[num] = false;
304300
prevTime[num] = millis();
305301
refreshLed();
@@ -317,7 +313,7 @@ void Attack::_log(int num){
317313
for(int a=0;a<apScan.results;a++){
318314
if(apScan.isSelected(a)){
319315
Mac _ap;
320-
_ap.setMac(apScan.aps._get(a));
316+
_ap.set(apScan.aps._get(a));
321317
addLog(_ap.toString());
322318
}
323319
}
@@ -378,7 +374,11 @@ size_t Attack::getSize(){
378374
json = "\"ssid\":[";
379375
jsonSize += json.length();
380376
for (int i = 0; i < ssidList.len; i++) {
381-
json = "\"" + ssidList.get(i) + "\"";
377+
json = "[";
378+
json += "\"" + ssidList.get(i) + "\",";
379+
json += String( ssidList.isEncrypted(i) ) + "";
380+
Serial.print(ssidList.isEncrypted(i));
381+
json += "]";
382382
if (i != ssidList.len - 1) json += ",";
383383
jsonSize += json.length();
384384
}
@@ -439,7 +439,10 @@ void Attack::sendResults(){
439439
json = "\"ssid\":[";
440440
sendToBuffer(json);
441441
for (int i = 0; i < ssidList.len; i++) {
442-
json = "\"" + ssidList.get(i) + "\"";
442+
json = "[";
443+
json += "\"" + ssidList.get(i) + "\",";
444+
json += (String)ssidList.isEncrypted(i) + "";
445+
json += "]";
443446
if (i != ssidList.len - 1) json += ",";
444447
sendToBuffer(json);
445448
}
@@ -463,11 +466,11 @@ void Attack::refreshLed() {
463466
}
464467
if (numberRunning >= 1 && settings.useLed) {
465468
if (debug) Serial.println("Attack LED : ON");
466-
digitalWrite(settings.ledPin, LOW);
469+
digitalWrite(settings.ledPin, !settings.pinStateOff);
467470
}
468471
else if (numberRunning == 0 || !settings.useLed) {
469472
if (debug) Serial.println("Attack LED : OFF");
470-
digitalWrite(settings.ledPin, HIGH);
473+
digitalWrite(settings.ledPin, settings.pinStateOff);
471474
}
472475
}
473476

esp8266_deauther/Attack.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ extern const bool debug;
2626
extern void addLog(String str);
2727
extern void openLog();
2828
extern void closeLog();
29-
extern String attackMode;
29+
extern String attackMode_deauth;
30+
extern String attackMode_beacon;
3031

3132
extern APScan apScan;
3233
extern ClientScan clientScan;

esp8266_deauther/Mac.cpp

+19-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ void Mac::set(uint8_t first, uint8_t second, uint8_t third, uint8_t fourth, uint
1515
adress[5] = sixth;
1616
}
1717

18-
void Mac::setAt(uint8_t first, int num) {
19-
if (num > -1 && num < 6) adress[num] = first;
18+
void Mac::set(uint8_t* mac) {
19+
for(int i=0; i<6 || i<sizeof(mac); i++){
20+
adress[i] = mac[i];
21+
}
2022
}
2123

22-
void Mac::setMac(Mac adr) {
24+
void Mac::set(Mac adr) {
2325
for (int i = 0; i < 6; i++) {
2426
adress[i] = adr._get(i);
2527
}
2628
}
2729

30+
void Mac::setAt(uint8_t first, int num) {
31+
if (num > -1 && num < 6) adress[num] = first;
32+
}
33+
2834
bool Mac::valid() {
2935
for (int i = 0; i < 6; i++) {
3036
if (adress[i] != 0xFF && adress[i] != 0x00) return true;
@@ -52,6 +58,10 @@ void Mac::_println() {
5258
Serial.println(Mac::toString());
5359
}
5460

61+
uint8_t* Mac::_get() {
62+
return adress;
63+
}
64+
5565
uint8_t Mac::_get(int num) {
5666
return adress[num];
5767
}
@@ -63,4 +73,10 @@ bool Mac::compare(Mac target) {
6373
return true;
6474
}
6575

76+
void Mac::randomize() {
77+
uint8_t randomMac[6];
78+
getRandomVendorMac(randomMac);
79+
this->set(randomMac);
80+
}
81+
6682

esp8266_deauther/Mac.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33

44
#include <Arduino.h>
55

6+
extern void getRandomVendorMac(uint8_t *buf);
7+
68
class Mac
79
{
810
public:
911
Mac();
1012
void set(uint8_t first, uint8_t second, uint8_t third, uint8_t fourth, uint8_t fifth, uint8_t sixth);
13+
void set(uint8_t* mac);
14+
void set(Mac adr);
1115
void setAt(uint8_t first, int num);
12-
void setMac(Mac adr);
1316
String toString();
1417
void _print();
1518
void _println();
19+
uint8_t* _get();
1620
uint8_t _get(int num);
1721
bool compare(Mac target);
1822
bool valid();
23+
void randomize();
1924
private:
2025
uint8_t adress[6];
2126
};

esp8266_deauther/MacList.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bool MacList::contains(Mac adr) {
1414
int MacList::add(Mac adr) {
1515
if(num < len && adr.valid()) {
1616
if (!contains(adr)) {
17-
macAdrs[num].setMac(adr);
17+
macAdrs[num].set(adr);
1818
num++;
1919
return num - 1;
2020
}
@@ -58,6 +58,6 @@ void MacList::remove(Mac adr) {
5858
}
5959

6060
void MacList::set(int num, Mac adr) {
61-
macAdrs[num].setMac(adr);
61+
macAdrs[num].set(adr);
6262
}
6363

esp8266_deauther/SSIDList.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@ void SSIDList::load() {
1515
char _nextChar = EEPROM.read(listAdr + (i * SSIDLength) + h);
1616
names[i][h] = _nextChar;
1717
}
18+
encrypted[i] = EEPROM.read(encAdr + i);
1819
}
1920
}
2021

2122
void SSIDList::clear() {
2223
len = 0;
2324
}
2425

25-
void SSIDList::add(String name) {
26+
void SSIDList::add(String name, bool enc) {
2627
if (len < SSIDListLength) {
2728
for (int i = 0; i < SSIDLength; i++) {
2829
if (i < name.length()) names[len][i] = name[i];
2930
else names[len][i] = 0x00;
3031
}
32+
encrypted[len] = enc;
3133
len++;
3234
}
3335
}
3436

35-
void SSIDList::addClone(String name, int num) {
37+
void SSIDList::addClone(String name, int num, bool enc) {
3638
int _restSSIDLen = SSIDLength - name.length();
3739
String _apName;
3840

@@ -52,14 +54,7 @@ void SSIDList::addClone(String name, int num) {
5254
for (int d = 0; d < _restSSIDLen - 2; d++) _apName += " ";
5355
_apName += (String)c;//e.g. "SAMPLEAP 78"
5456
}
55-
add(_apName);
56-
}
57-
}
58-
59-
void SSIDList::edit(int num, String name) {
60-
for (int i = 0; i < SSIDLength; i++) {
61-
if (i < name.length()) names[num][i] = name[i];
62-
else names[num][i] = 0x00;
57+
add(_apName, enc);
6358
}
6459
}
6560

@@ -71,12 +66,17 @@ String SSIDList::get(int num) {
7166
return _name;
7267
}
7368

69+
bool SSIDList::isEncrypted(int num){
70+
return encrypted[num];
71+
}
72+
7473
void SSIDList::remove(int num) {
7574
if (num >= 0 && num < len) {
7675
for (int i = num; i < len - 1; i++) {
7776
for (int h = 0; h < SSIDLength; h++) {
7877
names[i][h] = names[i + 1][h];
7978
}
79+
encrypted[i] = encrypted[i + 1];
8080
}
8181
len--;
8282
}
@@ -89,6 +89,7 @@ void SSIDList::save() {
8989
for (int h = 0; h < SSIDLength; h++) {
9090
EEPROM.write(listAdr + (i * SSIDLength) + h, names[i][h]);
9191
}
92+
EEPROM.write(encAdr + i, encrypted[i]);
9293
}
9394
EEPROM.commit();
9495
if (debug) Serial.println("done");
@@ -99,7 +100,7 @@ void SSIDList::_random() {
99100
for (int i = len; i < SSIDListLength; i++) {
100101
_rName = "";
101102
for (int h = 0; h < SSIDLength; h++) _rName += letters[random(0, sizeof(letters))];
102-
add(_rName);
103+
add(_rName, random(2) > 0.5 );
103104
}
104105
}
105106

0 commit comments

Comments
 (0)