Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kremser committed Aug 8, 2017
2 parents 505ad80 + 3cbc667 commit 34b5f08
Show file tree
Hide file tree
Showing 37 changed files with 877 additions and 1,144 deletions.
163 changes: 0 additions & 163 deletions LICENSE.md

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ Please don't refer to this project as "jammer", that totaly underminds the real

**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!

This comment has been minimized.

Copy link
@1jammer1

1jammer1 Jan 16, 2021

huh this is not software


- WiFi Deauther (Pocket WiFi)
- WiFi Deauther v1.5
- [AliExpress](https://goo.gl/JAXhTg)
- [tindie](https://goo.gl/yMiuGH)
- WiFi Deauther OLED (Pocket WiFi)
- WiFi Deauther OLED v1.5
- [AliExpress](https://goo.gl/P30vNz)
- [tindie](https://goo.gl/GGH7x8)
- WiFi Deauther OLED v2
- [AliExpress](https://goo.gl/UK87iU)
- [tindie](https://goo.gl/PMDYn4)

## Installation

Expand Down Expand Up @@ -264,7 +267,7 @@ ESP8266:

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

802.11w-2009: https://en.wikipedia.org/wiki/IEEE_802.11w-2009
Expand Down
18 changes: 11 additions & 7 deletions esp8266_deauther/APScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ bool APScan::start() {
Serial.println("MAC - Ch - RSSI - Encrypt. - SSID - Hidden");// - Vendor");
}
aps._clear();
for (int i = 0; i < maxAPScanResults; i++) selected[i] = false;
results = 0;
for (int i = 0; i < maxAPScanResults; i++){
selected[i] = false;
String("").toCharArray(names[i], 33);
}
results = WiFi.scanNetworks(false, settings.apScanHidden); // lets scanNetworks return hidden APs. (async = false & show_hidden = true)
if(results > maxAPScanResults) results = maxAPScanResults;

for (int i = 0; i < results && i < maxAPScanResults; i++) {
if (debug) Serial.println("Scan results: "+(String)results);

for (int i = 0; i < results; i++) {
Mac _ap;
_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]);
aps.add(_ap);
Expand Down Expand Up @@ -112,9 +119,6 @@ String APScan::getAPEncryption(int num) {
String APScan::getAPMac(int num) {
return aps._get(num).toString();
}
bool APScan::getAPSelected(int num) {
return selected[num];
}
bool APScan::isHidden(int num) {
return hidden[num];
}
Expand Down Expand Up @@ -178,7 +182,7 @@ void APScan::sendResults() {
json += "\"r\":" + (String)getAPRSSI(i) + ",";
json += "\"e\":" + (String)encryption[i] + ",";
//json += "\"v\":\""+getAPVendor(i)+"\",";
json += "\"se\":" + (String)getAPSelected(i);
json += "\"se\":" + (String)isSelected(i);
json += "}";
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";

Expand Down Expand Up @@ -211,7 +215,7 @@ String APScan::getResultsJSON() {
json += "\"r\":" + (String)getAPRSSI(i) + ",";
json += "\"e\":" + (String)encryption[i] + ",";
//json += "\"v\":\""+getAPVendor(i)+"\",";
json += "\"se\":" + (String)getAPSelected(i);
json += "\"se\":" + (String)isSelected(i);
json += "}";
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
}
Expand Down
3 changes: 1 addition & 2 deletions esp8266_deauther/APScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class APScan {
String getAPEncryption(int num);
//String getAPVendor(int num);
String getAPMac(int num);
bool getAPSelected(int num);
bool isHidden(int num);
int getAPRSSI(int num);
int getAPChannel(int num);
Expand All @@ -57,4 +56,4 @@ class APScan {

};

#endif
#endif
35 changes: 19 additions & 16 deletions esp8266_deauther/Attack.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "Attack.h"

Attack::Attack() {
randomSeed(os_random());
}

void Attack::generate() {
Expand All @@ -13,8 +12,7 @@ void Attack::generate() {

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

Expand Down Expand Up @@ -162,7 +160,7 @@ void Attack::run() {
if (apScan.isSelected(a)) {
Mac _ap;
int _ch = apScan.getAPChannel(a);
_ap.setMac(apScan.aps._get(a));
_ap.set(apScan.aps._get(a));

wifi_set_channel(_ch);

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

for (int a = 0; a < ssidList.len; a++) {
String _ssid = ssidList.get(a);
int _ch = channels[a];

buildBeacon(beaconAdrs._get(a), _ssid, _ch, settings.attackEncrypted);

buildBeacon(beaconAdrs._get(a), ssidList.get(a), channels[a], ssidList.isEncrypted(a));
if (send()) packetsCounter[1]++;
}

Expand Down Expand Up @@ -287,7 +281,8 @@ void Attack::start(int num) {
attackTimeoutCounter[num] = 0;
refreshLed();
if (debug) Serial.println("starting " + (String)attackNames[num] + " attack...");
if (num == 0) attackMode = "STOP";
if (num == 0) attackMode_deauth = "STOP";
else if(num == 1) attackMode_beacon = "STOP";
if(!settings.multiAttacks){
for (int i = 0; i < attacksNum; i++){
if(i != num) stop(i);
Expand All @@ -299,7 +294,8 @@ void Attack::start(int num) {
void Attack::stop(int num) {
if(isRunning[num]) {
if (debug) Serial.println("stopping " + (String)attackNames[num] + " attack...");
if (num == 0) attackMode = "START";
if (num == 0) attackMode_deauth = "START";
else if(num == 1) attackMode_beacon = "START";
isRunning[num] = false;
prevTime[num] = millis();
refreshLed();
Expand All @@ -317,7 +313,7 @@ void Attack::_log(int num){
for(int a=0;a<apScan.results;a++){
if(apScan.isSelected(a)){
Mac _ap;
_ap.setMac(apScan.aps._get(a));
_ap.set(apScan.aps._get(a));
addLog(_ap.toString());
}
}
Expand Down Expand Up @@ -378,7 +374,11 @@ size_t Attack::getSize(){
json = "\"ssid\":[";
jsonSize += json.length();
for (int i = 0; i < ssidList.len; i++) {
json = "\"" + ssidList.get(i) + "\"";
json = "[";
json += "\"" + ssidList.get(i) + "\",";
json += String( ssidList.isEncrypted(i) ) + "";
Serial.print(ssidList.isEncrypted(i));
json += "]";
if (i != ssidList.len - 1) json += ",";
jsonSize += json.length();
}
Expand Down Expand Up @@ -439,7 +439,10 @@ void Attack::sendResults(){
json = "\"ssid\":[";
sendToBuffer(json);
for (int i = 0; i < ssidList.len; i++) {
json = "\"" + ssidList.get(i) + "\"";
json = "[";
json += "\"" + ssidList.get(i) + "\",";
json += (String)ssidList.isEncrypted(i) + "";
json += "]";
if (i != ssidList.len - 1) json += ",";
sendToBuffer(json);
}
Expand All @@ -463,11 +466,11 @@ void Attack::refreshLed() {
}
if (numberRunning >= 1 && settings.useLed) {
if (debug) Serial.println("Attack LED : ON");
digitalWrite(settings.ledPin, LOW);
digitalWrite(settings.ledPin, !settings.pinStateOff);
}
else if (numberRunning == 0 || !settings.useLed) {
if (debug) Serial.println("Attack LED : OFF");
digitalWrite(settings.ledPin, HIGH);
digitalWrite(settings.ledPin, settings.pinStateOff);
}
}

3 changes: 2 additions & 1 deletion esp8266_deauther/Attack.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extern const bool debug;
extern void addLog(String str);
extern void openLog();
extern void closeLog();
extern String attackMode;
extern String attackMode_deauth;
extern String attackMode_beacon;

extern APScan apScan;
extern ClientScan clientScan;
Expand Down
22 changes: 19 additions & 3 deletions esp8266_deauther/Mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ void Mac::set(uint8_t first, uint8_t second, uint8_t third, uint8_t fourth, uint
adress[5] = sixth;
}

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

void Mac::setMac(Mac adr) {
void Mac::set(Mac adr) {
for (int i = 0; i < 6; i++) {
adress[i] = adr._get(i);
}
}

void Mac::setAt(uint8_t first, int num) {
if (num > -1 && num < 6) adress[num] = first;
}

bool Mac::valid() {
for (int i = 0; i < 6; i++) {
if (adress[i] != 0xFF && adress[i] != 0x00) return true;
Expand Down Expand Up @@ -52,6 +58,10 @@ void Mac::_println() {
Serial.println(Mac::toString());
}

uint8_t* Mac::_get() {
return adress;
}

uint8_t Mac::_get(int num) {
return adress[num];
}
Expand All @@ -63,4 +73,10 @@ bool Mac::compare(Mac target) {
return true;
}

void Mac::randomize() {
uint8_t randomMac[6];
getRandomVendorMac(randomMac);
this->set(randomMac);
}


7 changes: 6 additions & 1 deletion esp8266_deauther/Mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@

#include <Arduino.h>

extern void getRandomVendorMac(uint8_t *buf);

class Mac
{
public:
Mac();
void set(uint8_t first, uint8_t second, uint8_t third, uint8_t fourth, uint8_t fifth, uint8_t sixth);
void set(uint8_t* mac);
void set(Mac adr);
void setAt(uint8_t first, int num);
void setMac(Mac adr);
String toString();
void _print();
void _println();
uint8_t* _get();
uint8_t _get(int num);
bool compare(Mac target);
bool valid();
void randomize();
private:
uint8_t adress[6];
};
Expand Down
4 changes: 2 additions & 2 deletions esp8266_deauther/MacList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool MacList::contains(Mac adr) {
int MacList::add(Mac adr) {
if(num < len && adr.valid()) {
if (!contains(adr)) {
macAdrs[num].setMac(adr);
macAdrs[num].set(adr);
num++;
return num - 1;
}
Expand Down Expand Up @@ -58,6 +58,6 @@ void MacList::remove(Mac adr) {
}

void MacList::set(int num, Mac adr) {
macAdrs[num].setMac(adr);
macAdrs[num].set(adr);
}

23 changes: 12 additions & 11 deletions esp8266_deauther/SSIDList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ void SSIDList::load() {
char _nextChar = EEPROM.read(listAdr + (i * SSIDLength) + h);
names[i][h] = _nextChar;
}
encrypted[i] = EEPROM.read(encAdr + i);
}
}

void SSIDList::clear() {
len = 0;
}

void SSIDList::add(String name) {
void SSIDList::add(String name, bool enc) {
if (len < SSIDListLength) {
for (int i = 0; i < SSIDLength; i++) {
if (i < name.length()) names[len][i] = name[i];
else names[len][i] = 0x00;
}
encrypted[len] = enc;
len++;
}
}

void SSIDList::addClone(String name, int num) {
void SSIDList::addClone(String name, int num, bool enc) {
int _restSSIDLen = SSIDLength - name.length();
String _apName;

Expand All @@ -52,14 +54,7 @@ void SSIDList::addClone(String name, int num) {
for (int d = 0; d < _restSSIDLen - 2; d++) _apName += " ";
_apName += (String)c;//e.g. "SAMPLEAP 78"
}
add(_apName);
}
}

void SSIDList::edit(int num, String name) {
for (int i = 0; i < SSIDLength; i++) {
if (i < name.length()) names[num][i] = name[i];
else names[num][i] = 0x00;
add(_apName, enc);
}
}

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

bool SSIDList::isEncrypted(int num){
return encrypted[num];
}

void SSIDList::remove(int num) {
if (num >= 0 && num < len) {
for (int i = num; i < len - 1; i++) {
for (int h = 0; h < SSIDLength; h++) {
names[i][h] = names[i + 1][h];
}
encrypted[i] = encrypted[i + 1];
}
len--;
}
Expand All @@ -89,6 +89,7 @@ void SSIDList::save() {
for (int h = 0; h < SSIDLength; h++) {
EEPROM.write(listAdr + (i * SSIDLength) + h, names[i][h]);
}
EEPROM.write(encAdr + i, encrypted[i]);
}
EEPROM.commit();
if (debug) Serial.println("done");
Expand All @@ -99,7 +100,7 @@ void SSIDList::_random() {
for (int i = len; i < SSIDListLength; i++) {
_rName = "";
for (int h = 0; h < SSIDLength; h++) _rName += letters[random(0, sizeof(letters))];
add(_rName);
add(_rName, random(2) > 0.5 );
}
}

Expand Down
Loading

0 comments on commit 34b5f08

Please sign in to comment.