mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-21 14:09:59 +01:00
Added Mac-change & Beacon Interval Setting
This commit is contained in:
@@ -17,6 +17,8 @@ void Attack::generate() {
|
||||
for (int i = 0; i < 6; i++) _randomBeaconMac.setAt(_randomMacBuffer[i], i);
|
||||
} while (beaconAdrs.add(_randomBeaconMac) >= 0);
|
||||
if (debug) Serial.println("done");
|
||||
|
||||
macListChangeCounter = 0;
|
||||
}
|
||||
|
||||
void Attack::buildDeauth(Mac _ap, Mac _client, uint8_t type, uint8_t reason) {
|
||||
@@ -48,6 +50,11 @@ void Attack::buildBeacon(Mac _ap, String _ssid, int _ch, bool encrypt) {
|
||||
packetSize++;
|
||||
}
|
||||
|
||||
if(settings.beaconInterval){
|
||||
beaconPacket_header[32] = 0xe8;
|
||||
beaconPacket_header[33] = 0x03;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
//set source (AP)
|
||||
packet[10 + i] = packet[16 + i] = _ap._get(i);
|
||||
@@ -185,8 +192,10 @@ void Attack::run() {
|
||||
}
|
||||
}
|
||||
|
||||
/* =============== Beacon list Attack =============== */
|
||||
if (isRunning[1] && currentMillis - prevTime[1] >= 100) {
|
||||
/* =============== Beacon Attack =============== */
|
||||
int beaconsPerSecond = 10;
|
||||
if(settings.beaconInterval) beaconsPerSecond = 1;
|
||||
if (isRunning[1] && currentMillis - prevTime[1] >= 1000/beaconsPerSecond) {
|
||||
if (debug) Serial.print("running " + (String)attackNames[1] + " attack...");
|
||||
prevTime[1] = millis();
|
||||
|
||||
@@ -199,17 +208,18 @@ void Attack::run() {
|
||||
if (send()) packetsCounter[1]++;
|
||||
}
|
||||
|
||||
stati[1] = (String)(packetsCounter[1] * 10) + "pkts/s";
|
||||
stati[1] = (String)(packetsCounter[1] * beaconsPerSecond) + "pkts/s";
|
||||
packetsCounter[1] = 0;
|
||||
|
||||
macListChangeCounter++;
|
||||
if (macListChangeCounter / 10 >= macChangeInterval && macChangeInterval > 0) {
|
||||
generate();
|
||||
macListChangeCounter = 0;
|
||||
if(settings.macInterval > 0){
|
||||
if (macListChangeCounter / beaconsPerSecond >= settings.macInterval) generate();
|
||||
}
|
||||
|
||||
if (debug) Serial.println(" done");
|
||||
if (settings.attackTimeout > 0) {
|
||||
attackTimeoutCounter[1]++;
|
||||
if (attackTimeoutCounter[1] / 10 > settings.attackTimeout) stop(1);
|
||||
if (attackTimeoutCounter[1] / beaconsPerSecond > settings.attackTimeout) stop(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,13 +236,15 @@ void Attack::run() {
|
||||
|
||||
stati[2] = (String)(packetsCounter[2]) + "pkts/s";
|
||||
packetsCounter[2] = 0;
|
||||
|
||||
macListChangeCounter++;
|
||||
if (macListChangeCounter >= macChangeInterval && macChangeInterval > 0) {
|
||||
generate();
|
||||
if(settings.macInterval > 0){
|
||||
if (macListChangeCounter >= settings.macInterval) generate();
|
||||
/*ssidList.clear();
|
||||
ssidList._random();
|
||||
macListChangeCounter = 0;*/
|
||||
}
|
||||
|
||||
if (debug) Serial.println("done");
|
||||
if (settings.attackTimeout > 0) {
|
||||
attackTimeoutCounter[2]++;
|
||||
@@ -269,6 +281,7 @@ void Attack::stop(int num) {
|
||||
prevTime[num] = millis();
|
||||
refreshLed();
|
||||
}
|
||||
|
||||
stati[num] = "ready";
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ extern "C" {
|
||||
|
||||
#define attacksNum 3
|
||||
#define macListLen 64
|
||||
#define macChangeInterval 6
|
||||
|
||||
extern void PrintHex8(uint8_t *data, uint8_t length);
|
||||
extern void getRandomVendorMac(uint8_t *buf);
|
||||
|
||||
@@ -43,6 +43,8 @@ void Settings::load() {
|
||||
channelHop = (bool)EEPROM.read(channelHopAdr);
|
||||
multiAPs = (bool)EEPROM.read(multiAPsAdr);
|
||||
multiAttacks = (bool)EEPROM.read(multiAttacksAdr);
|
||||
macInterval = eepromReadInt(macIntervalAdr);
|
||||
beaconInterval = (bool)EEPROM.read(beaconIntervalAdr);
|
||||
}
|
||||
|
||||
void Settings::reset() {
|
||||
@@ -67,6 +69,8 @@ void Settings::reset() {
|
||||
channelHop = false;
|
||||
multiAPs = false;
|
||||
multiAttacks = false;
|
||||
macInterval = 4;
|
||||
beaconInterval = false;
|
||||
|
||||
if (debug) Serial.println("done");
|
||||
|
||||
@@ -99,6 +103,8 @@ void Settings::save() {
|
||||
EEPROM.write(multiAPsAdr, multiAPs);
|
||||
EEPROM.write(multiAttacksAdr, multiAttacks);
|
||||
EEPROM.write(checkNumAdr, checkNum);
|
||||
eepromWriteInt(macIntervalAdr, macInterval);
|
||||
EEPROM.write(beaconIntervalAdr, beaconInterval);
|
||||
EEPROM.commit();
|
||||
|
||||
if (debug) {
|
||||
@@ -125,6 +131,8 @@ void Settings::info() {
|
||||
Serial.println("channel hopping: " + (String)channelHop);
|
||||
Serial.println("multiple APs: " + (String)multiAPs);
|
||||
Serial.println("multiple Attacks: " + (String)multiAttacks);
|
||||
Serial.println("mac change interval: " + (String)macInterval);
|
||||
Serial.println("1s beacon interval: " + (String)beaconInterval);
|
||||
}
|
||||
|
||||
size_t Settings::getSize(){
|
||||
@@ -144,7 +152,9 @@ size_t Settings::getSize(){
|
||||
json += "\"useLed\":" + (String)useLed + ",";
|
||||
json += "\"channelHop\":" + (String)channelHop + ",";
|
||||
json += "\"multiAPs\":" + (String)multiAPs + ",";
|
||||
json += "\"multiAttacks\":" + (String)multiAttacks + "}";
|
||||
json += "\"multiAttacks\":" + (String)multiAttacks + ",";
|
||||
json += "\"macInterval\":" + (String)macInterval + ",";
|
||||
json += "\"beaconInterval\":" + (String)beaconInterval + "}";
|
||||
jsonSize += json.length();
|
||||
|
||||
return jsonSize;
|
||||
@@ -168,7 +178,9 @@ void Settings::send() {
|
||||
json += "\"useLed\":" + (String)useLed + ",";
|
||||
json += "\"channelHop\":" + (String)channelHop + ",";
|
||||
json += "\"multiAPs\":" + (String)multiAPs + ",";
|
||||
json += "\"multiAttacks\":" + (String)multiAttacks + "}";
|
||||
json += "\"multiAttacks\":" + (String)multiAttacks + ",";
|
||||
json += "\"macInterval\":" + (String)macInterval + ",";
|
||||
json += "\"beaconInterval\":" + (String)beaconInterval + "}";
|
||||
sendToBuffer(json);
|
||||
sendBuffer();
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ extern NameList nameList;
|
||||
#define channelHopAdr 1100
|
||||
#define multiAPsAdr 1101
|
||||
#define multiAttacksAdr 1102
|
||||
#define macIntervalAdr 1103
|
||||
#define beaconIntervalAdr 1105
|
||||
|
||||
#define checkNumAdr 1102
|
||||
#define checkNum 14
|
||||
@@ -64,6 +66,8 @@ class Settings
|
||||
bool channelHop;
|
||||
bool multiAPs;
|
||||
bool multiAttacks;
|
||||
int macInterval;
|
||||
bool beaconInterval;
|
||||
|
||||
private:
|
||||
size_t getSize();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -362,6 +362,10 @@ void saveSettings() {
|
||||
if (server.arg("apScanHidden") == "false") settings.apScanHidden = false;
|
||||
else settings.apScanHidden = true;
|
||||
}
|
||||
if (server.hasArg("beaconInterval")) {
|
||||
if (server.arg("beaconInterval") == "false") settings.beaconInterval = false;
|
||||
else settings.beaconInterval = true;
|
||||
}
|
||||
if (server.hasArg("useLed")) {
|
||||
if (server.arg("useLed") == "false") settings.useLed = false;
|
||||
else settings.useLed = true;
|
||||
@@ -380,6 +384,8 @@ void saveSettings() {
|
||||
else settings.multiAttacks = true;
|
||||
}
|
||||
|
||||
if(server.hasArg("macInterval")) settings.macInterval = server.arg("macInterval").toInt();
|
||||
|
||||
settings.save();
|
||||
server.send( 200, "text/json", "true" );
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ var multiAPs = getE('multiAPs');
|
||||
var multiAttacks = getE('multiAttacks');
|
||||
var cMac = getE('cMac');
|
||||
var cName = getE('cName');
|
||||
var macInterval = getE('macInterval');
|
||||
var beaconInterval = getE('beaconInterval');
|
||||
var res;
|
||||
|
||||
function getData() {
|
||||
@@ -40,6 +42,8 @@ function getData() {
|
||||
/*channelHop.checked = res.channelHop;*/
|
||||
multiAPs.checked = res.multiAPs;
|
||||
multiAttacks.checked = res.multiAttacks;
|
||||
macInterval.value = res.macInterval;
|
||||
beaconInterval.checked = res.beaconInterval;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,6 +64,8 @@ function saveSettings() {
|
||||
/*url += "&channelHop=" + channelHop.checked;*/
|
||||
url += "&multiAPs="+multiAPs.checked;
|
||||
url += "&multiAttacks="+multiAttacks.checked;
|
||||
url += "&macInterval="+macInterval.value;
|
||||
url += "&beaconInterval="+beaconInterval.checked;
|
||||
|
||||
getResponse(url, function(responseText) {
|
||||
if (responseText == "true") {
|
||||
|
||||
@@ -116,7 +116,15 @@
|
||||
<label for="ssidEnc">WPA2 Beacons</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="checkbox" name="ssidEnc" id="ssidEnc" value="false">
|
||||
<input type="checkbox" id="ssidEnc" value="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label for="beaconInterval">1s Beacon Interval (default: 100ms)</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="checkbox" id="beaconInterval" value="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -124,7 +132,7 @@
|
||||
<label for="useLed">Use LED</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="checkbox" name="useLed" id="useLed" value="false">
|
||||
<input type="checkbox" id="useLed" value="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -148,9 +156,18 @@
|
||||
<label for="multiAttacks">Multiple Attacks</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="checkbox" name="multiAttacks" id="multiAttacks" value="false">
|
||||
<input type="checkbox" id="multiAttacks" value="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<label for="macInterval">MAC Change Interval (used for beacons & probes)</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="number" id="macInterval" min="0" max="65000">s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user