mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-17 18:17:41 -08:00
Compare commits
190 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
792b4e5ac9 | ||
|
|
09de10d95c | ||
|
|
898dd1242d | ||
|
|
4f04e91d0a | ||
|
|
b7c2d668b5 | ||
|
|
cbcfa10330 | ||
|
|
88777524e0 | ||
|
|
f2d48d229a | ||
|
|
4aa93e2cc3 | ||
|
|
00a785343c | ||
|
|
01b0520aec | ||
|
|
2468abba22 | ||
|
|
355236dc42 | ||
|
|
80f99f78a7 | ||
|
|
809f0fb19d | ||
|
|
71d5391066 | ||
|
|
1988ec5808 | ||
|
|
2b130b9d11 | ||
|
|
0091c5642a | ||
|
|
a80bba9b18 | ||
|
|
d686353322 | ||
|
|
ae8f8e870f | ||
|
|
d11faf5996 | ||
|
|
6ae350dded | ||
|
|
9a1ee15345 | ||
|
|
da538934e3 | ||
|
|
e2b52f74e5 | ||
|
|
546afc63a7 | ||
|
|
2f0d05a538 | ||
|
|
9f013d3d52 | ||
|
|
45db8f3c22 | ||
|
|
e490b40196 | ||
|
|
72edd3d43d | ||
|
|
bc6a07f5cb | ||
|
|
bd7a350a9b | ||
|
|
cdd0ee5976 | ||
|
|
d7aac68866 | ||
|
|
0f58a0657b | ||
|
|
d9a6966574 | ||
|
|
5341c559be | ||
|
|
2c4edd012d | ||
|
|
3b09650363 | ||
|
|
7d6d0517e1 | ||
|
|
30020dd710 | ||
|
|
3d2bb75081 | ||
|
|
95841e5384 | ||
|
|
a73ae2bbcb | ||
|
|
ae1aebde50 | ||
|
|
9134280c6a | ||
|
|
93d0f2e1d2 | ||
|
|
e3f365febf | ||
|
|
66576c1908 | ||
|
|
8c53ac679f | ||
|
|
2d33c0b5ab | ||
|
|
ec4fc7487f | ||
|
|
71ced23041 | ||
|
|
8e874c493b | ||
|
|
373482822a | ||
|
|
bca0f70073 | ||
|
|
37c65bf6f1 | ||
|
|
b7be44d5ea | ||
|
|
503e65e012 | ||
|
|
a78d5b792c | ||
|
|
38098cb9e5 | ||
|
|
466d5fbb1a | ||
|
|
51a7ff7e26 | ||
|
|
f166c7a4df | ||
|
|
9e1fe534b0 | ||
|
|
a23e7a4c48 | ||
|
|
f801ba0bc5 | ||
|
|
31687c10cb | ||
|
|
8f57daa699 | ||
|
|
910e25f478 | ||
|
|
039279fc95 | ||
|
|
d2b89654e6 | ||
|
|
6e829f5bf4 | ||
|
|
678179a097 | ||
|
|
54e00389cc | ||
|
|
a888c97d52 | ||
|
|
3203c1f94a | ||
|
|
98e5b532bc | ||
|
|
f43907e37c | ||
|
|
c993edb6b2 | ||
|
|
e27ffe1d5f | ||
|
|
324e780609 | ||
|
|
1b51354e5d | ||
|
|
2ec82c509b | ||
|
|
d6f20ec1fa | ||
|
|
87b0fbf370 | ||
|
|
a314e8e817 | ||
|
|
a52e52962d | ||
|
|
e3de597e0a | ||
|
|
3f3b784d47 | ||
|
|
c822bba6da | ||
|
|
6ce7f598eb | ||
|
|
fe33f1fab3 | ||
|
|
a18b8b3004 | ||
|
|
5102939dd5 | ||
|
|
02ac69ecca | ||
|
|
4154b0e0dd | ||
|
|
e108fef595 | ||
|
|
06c70562a7 | ||
|
|
17dd0dda4f | ||
|
|
06a172e28c | ||
|
|
53cef7f44f | ||
|
|
804bdc5150 | ||
|
|
857f61cdf0 | ||
|
|
cf2d5df4d5 | ||
|
|
c8cddedd2b | ||
|
|
2f023a6dbe | ||
|
|
7c137a84af | ||
|
|
ece6b63de4 | ||
|
|
a327c75727 | ||
|
|
018198d51b | ||
|
|
0f4a94134e | ||
|
|
a1dd40a928 | ||
|
|
d32388eb2f | ||
|
|
9ee434ae7f | ||
|
|
2572b83701 | ||
|
|
d914ebd7c0 | ||
|
|
79cdb806f1 | ||
|
|
9f07bc4843 | ||
|
|
b3e98b64ce | ||
|
|
dead80e2f3 | ||
|
|
7db2d0e05d | ||
|
|
f86b5a4df0 | ||
|
|
c7cf1e09f7 | ||
|
|
f623880772 | ||
|
|
ec3ca6d0ad | ||
|
|
59b143fb3e | ||
|
|
c5136b5d2e | ||
|
|
ba05c388b1 | ||
|
|
a98be0d435 | ||
|
|
da43c8b369 | ||
|
|
7a5134bb86 | ||
|
|
bbc10e4452 | ||
|
|
f05776ba45 | ||
|
|
20694f593a | ||
|
|
140451b47c | ||
|
|
6490a12b30 | ||
|
|
1a4136137d | ||
|
|
e79db36906 | ||
|
|
d9d25b0010 | ||
|
|
8a18e55bb7 | ||
|
|
1c86a71704 | ||
|
|
f7db1ea401 | ||
|
|
bdc209d489 | ||
|
|
cc891457ce | ||
|
|
6c3a0d30b7 | ||
|
|
12182af21c | ||
|
|
c9c6bbf971 | ||
|
|
7391a05c8a | ||
|
|
dd6f800b48 | ||
|
|
6f2c2862f6 | ||
|
|
fa4d3bf3e2 | ||
|
|
bf9baee37b | ||
|
|
1612ac4bf0 | ||
|
|
418a8ebf41 | ||
|
|
1e1f6f6b19 | ||
|
|
35b10ac9be | ||
|
|
10d5767ffa | ||
|
|
269e848a16 | ||
|
|
3ab8432443 | ||
|
|
9e07722292 | ||
|
|
5e5313a008 | ||
|
|
3ce996d9e2 | ||
|
|
96957a2cc1 | ||
|
|
ca4048983f | ||
|
|
a2fa6759a8 | ||
|
|
40e11b71f0 | ||
|
|
56acee78e4 | ||
|
|
470371adc1 | ||
|
|
fc5d27b4b6 | ||
|
|
9709bc3d3a | ||
|
|
9dbf0d4a69 | ||
|
|
2039e517af | ||
|
|
41d287c538 | ||
|
|
9ed469d914 | ||
|
|
7abc67242b | ||
|
|
7a8cf2aa50 | ||
|
|
40a4b5f22b | ||
|
|
e1de245ab5 | ||
|
|
5b1f11ef56 | ||
|
|
1897819939 | ||
|
|
80cc78e4a6 | ||
|
|
08b26c97e7 | ||
|
|
668cc1c720 | ||
|
|
452ff43210 | ||
|
|
5b24257fb8 | ||
|
|
eccbaae3a0 |
49
.travis.yml
49
.travis.yml
@@ -11,24 +11,6 @@ env:
|
||||
|
||||
before_install:
|
||||
|
||||
# TODO: undo
|
||||
# remove submodules, we don't want those to be actually tested for compliance
|
||||
- git submodule status | rm -Rf `cut -d ' ' -f 3`
|
||||
|
||||
# Formatting checks:
|
||||
# Check for files starting with a blank line
|
||||
- find . -path './.git' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'head -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at start of $0."; false; fi'
|
||||
# Check for tabs
|
||||
- find . -path './.git' -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
|
||||
# Check for trailing whitespace
|
||||
- find . -path './.git' -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
|
||||
# Check for non-Unix line endings
|
||||
- find . -path './.git' -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
|
||||
# Check for blank lines at end of files
|
||||
- find . -path './.git' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
|
||||
# Check for files that don't end in a newline (https://stackoverflow.com/a/25686825)
|
||||
- find . -path './.git' -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi'
|
||||
|
||||
- git clone https://github.com/per1234/arduino-ci-script.git "${HOME}/scripts/arduino-ci-script"
|
||||
- cd "${HOME}/scripts/arduino-ci-script"
|
||||
# Get new tags from the remote
|
||||
@@ -46,19 +28,23 @@ before_install:
|
||||
- set_application_folder "$APPLICATION_FOLDER"
|
||||
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"
|
||||
|
||||
- install_ide '("1.8.0" "1.8.9" "newest")'
|
||||
#- install_ide '("1.8.11" "1.8.12" "newest")'
|
||||
- install_ide '("newest")'
|
||||
|
||||
# Install the library from the repository
|
||||
- install_library
|
||||
- install_library "M5Stack"
|
||||
- install_library 'https://github.com/bblanchon/ArduinoJson.git' # "ArduinoJSON"
|
||||
|
||||
- ls ${TRAVIS_BUILD_DIR} -la
|
||||
- ls ${TRAVIS_BUILD_DIR}/examples/M5Stack-SD-Menu/ -la
|
||||
- ls $SKETCHBOOK_FOLDER -la
|
||||
- ls $SKETCHBOOK_FOLDER/libraries -la
|
||||
- pwd
|
||||
# what the fsck is wrong install_package() ??
|
||||
#- install_library "https://github.com/lvgl/lv_port_esp32/archive/master.zip"
|
||||
- install_library "TFT_eSPI"
|
||||
- install_library "JPEGDecoder"
|
||||
- install_library "LinkedList"
|
||||
- install_library "lv_arduino"
|
||||
- install_library "https://github.com/adafruit/Adafruit_NeoPixel/archive/1.5.0.zip" ## "Adafruit_NeoPixel"
|
||||
- install_library 'https://github.com/bblanchon/ArduinoJson/releases/download/v5.13.5/ArduinoJson-v5.13.5.zip'
|
||||
- install_library 'https://github.com/h2zero/NimBLE-Arduino/archive/master.zip' # NimBLE
|
||||
|
||||
- cp ${TRAVIS_BUILD_DIR}/User_Setup.h /home/travis/arduino-sketchbook/libraries/TFT_eSPI/User_Setup.h
|
||||
#- install_library 'https://github.com/bblanchon/ArduinoJson.git'
|
||||
#- install_library "https://github.com/spacehuhn/SimpleList.git"
|
||||
#
|
||||
- install_package "esp32:esp32" "https://dl.espressif.com/dl/package_esp32_index.json" # # esp32:esp32:m5stack-core-esp32
|
||||
#- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "compiler.warning_level=none" --save-prefs &>/dev/null
|
||||
#- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "build.warn_data_percentage=75" --save-prefs &>/dev/null
|
||||
@@ -69,8 +55,9 @@ before_install:
|
||||
script:
|
||||
# Compile all example sketches included with the library
|
||||
# build_sketch arguments: sketch name, fqbn, allow failure, IDE version/list/range
|
||||
- check_library_manager_compliance "$TRAVIS_BUILD_DIR"
|
||||
- build_sketch "${TRAVIS_BUILD_DIR}/examples/M5Stack-SD-Menu/M5Stack-SD-Menu.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "newest"
|
||||
# - check_library_manager_compliance "$TRAVIS_BUILD_DIR"
|
||||
- set_ide_preference "compiler.warning_level=auto"
|
||||
- build_sketch "${TRAVIS_BUILD_DIR}/esp32_marauder/esp32_marauder.ino" "esp32:esp32:d32_pro:FlashFreq=80,UploadSpeed=921600,PartitionScheme=min_spiffs" "false" "newest"
|
||||
|
||||
after_script:
|
||||
# Commit a report of the job results to the CI-reports repository
|
||||
|
||||
Binary file not shown.
|
Can't render this file because it contains an unexpected character in line 11 and column 76.
|
309
MarauderOTA/MarauderOTA.ino
Normal file
309
MarauderOTA/MarauderOTA.ino
Normal file
File diff suppressed because one or more lines are too long
429
PCBs/Kit/PCB_ESP32 Marauder 3.5 Kit V3 PCB_2022-04-29.json
Normal file
429
PCBs/Kit/PCB_ESP32 Marauder 3.5 Kit V3 PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/Kit/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/Kit/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
BIN
PCBs/v4(OG)/MSP2807-2.8-SPI.pdf
Normal file
BIN
PCBs/v4(OG)/MSP2807-2.8-SPI.pdf
Normal file
Binary file not shown.
BIN
PCBs/v4(OG)/Marauder Screen PCB Measurements.png
Normal file
BIN
PCBs/v4(OG)/Marauder Screen PCB Measurements.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
459
PCBs/v4(OG)/PCB_ESP32 Marauder 3.7 OG PCB_2022-04-29.json
Normal file
459
PCBs/v4(OG)/PCB_ESP32 Marauder 3.7 OG PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/v4(OG)/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/v4(OG)/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
1
PCBs/v4(OG)/README.md
Normal file
1
PCBs/v4(OG)/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Further resources can be found [here](http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807)
|
||||
576
PCBs/v6/PCB_ESP32 Marauder 6 PCB_2022-04-29.json
Normal file
576
PCBs/v6/PCB_ESP32 Marauder 6 PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/v6/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/v6/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
157
README.md
157
README.md
@@ -1,154 +1,29 @@
|
||||
[](https://github.com/justcallmekoko/ESP32Marauder/blob/master/LICENSE)
|
||||
[](https://gitter.im/justcallmekoko/ESP32Marauder)
|
||||
<!---[](https://github.com/justcallmekoko/ESP32Marauder/blob/master/LICENSE)--->
|
||||
<!---[](https://gitter.im/justcallmekoko/ESP32Marauder)--->
|
||||
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
||||
<!---Shields/Badges https://shields.io/--->
|
||||
|
||||
# ESP32 Marauder v0.4.5
|
||||
# ESP32 Marauder v0.9.9
|
||||
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
||||
<p align="center">
|
||||
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
||||
<br><br>
|
||||
<a href="https://github.com/justcallmekoko/ESP32Marauder/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||
<a href="https://gitter.im/justcallmekoko/ESP32Marauder"><img alt="Gitter" src="https://badges.gitter.im/justcallmekoko/ESP32Marauder.png"/></a>
|
||||
<a href="https://github.com/justcallmekoko/ESP32Marauder/releases/latest"><img src="https://img.shields.io/github/downloads/justcallmekoko/ESP32Marauder/total" alt="Downloads"/></a>
|
||||
<br>
|
||||
<a href="https://twitter.com/intent/follow?screen_name=jcmkyoutube"><img src="https://img.shields.io/twitter/follow/jcmkyoutube?style=social&logo=twitter" alt="Twitter"></a>
|
||||
<a href="https://www.instagram.com/just.call.me.koko"><img src="https://img.shields.io/badge/Follow%20Me-Instagram-orange" alt="Instagram"/></a>
|
||||
<br><br>
|
||||
<a href="https://www.tindie.com/products/justcallmekoko/esp32-marauder/"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>
|
||||
<br>
|
||||
<a href="https://www.twitch.tv/willstunforfood"><img src="https://assets.stickpng.com/images/580b57fcd9996e24bc43c540.png" alt="Twitch WillStunForFood" width="200"></a>
|
||||
</p>
|
||||
|
||||
# Table Of Condensation
|
||||
- [About](#about)
|
||||
- [YouTube](#youtube)
|
||||
- [Hackster Article](#hackster-article)
|
||||
- [Capabilities](#capabilities)
|
||||
- [Do It Yourself](#do-it-yourself)
|
||||
- [Hardware](#hardware)
|
||||
- [Connections](#connections)
|
||||
- [Flashing Firmware](#flashing-firmware)
|
||||
- [Using Arduino IDE](#setting-up-arduino-ide)
|
||||
- [Updating Firmware](#updating-firmware)
|
||||
- [Enclosure](#enclosure)
|
||||
- [Under Development](#under-development)
|
||||
- [Special Thanks](#special-thanks)
|
||||
- [For Sale Now](#for-sale-now)
|
||||
|
||||
# About
|
||||
Sometimes you just gotta do what you gotta do. Am I right, ladies?
|
||||
The ESP32 Marauder is a suite of WiFi/Bluetooth offensive and defensive tools created for the ESP32 and was originally inspired by [Spacehuhn's](https://github.com/Spacehuhn) [esp8266_deauther](https://github.com/Spacehuhn/esp8366_deauther) project. The tool itself serves as a portable device used to test and analyze WiFi and Bluetooth devices. Use this tool and its firmware with caution as the use of some of its capabilities without explicit consent from the target owner is unlawful in most countries. For more information about this project and how it's assembled, follow the video link below.
|
||||
**Note:** Because of espressif's ESP32-IDF, the ESP32 included with Marauder is incapable of transmitting deauthentication frames.
|
||||
|
||||
### YouTube
|
||||
<p align="left"><a href="https://www.youtube.com/watch?v=BGFO1wA29o8"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/esp32marauder_thumbnail.jpg" width="500"></a></p>
|
||||
|
||||
### Hackster Article
|
||||
You can check out the marauder article written [here](https://www.hackster.io/news/esp32-marauder-puts-a-bluetooth-wi-fi-pen-testing-toolkit-in-your-pocket-32d389f6e66f) as well as other interesting engineering projects.
|
||||
|
||||
## Capabilities
|
||||
### Current
|
||||
- Probe Request Sniff: Sniff for WiFi [probe request frames](https://mrncciew.com/2014/10/27/cwap-802-11-probe-requestresponse/) sent by wireless devices
|
||||
- Beacon Sniff: Sniff [beacon frames](https://en.wikipedia.org/wiki/Beacon_frame) sent by wireless acccess points
|
||||
- Beacon Spam Random: Spam hundreds of random beacon frames to wireless devices within range
|
||||
- Rick Roll Beacon: Broadcast the rick roll lyrics as WiFi access points
|
||||
- Bluetooth Sniffer: Sniff bluetooth devices within range
|
||||
- Detect Card Skimmers: Detect bluetooth enabled credit card skimmers
|
||||
- Packet Monitor: Show WiFi packet density on a given channel using a time bar graph
|
||||
- Deauth Sniff: Detect deauthentication packets sent on all channels
|
||||
- Draw: Just doodle on the screen or whatever
|
||||
- Update Firmware: Update Marauder firmware over the air via web interface
|
||||
|
||||
### Developing
|
||||
- Emulate Bluetooth: Emulate a bluetooth device with a specific name
|
||||
|
||||
# Do It Yourself
|
||||
|
||||
## Hardware
|
||||
This project requires the following hardware in order to work:
|
||||
- Any ESP32 Development Board
|
||||
- 2.8" TFT Touch Screen w/ ili9341
|
||||
- Jumper Wires
|
||||
- Breadboard
|
||||
|
||||
### Connections
|
||||
Make the following connections between your 2.8" TFT Screen and your ESP32 board. You may need to refer to a pinout sheet specific to the ESP32 dev board you have chosen. For more infomation about this circuit, please refer to [this schematic](https://github.com/justcallmekoko/ESP32Marauder/blob/master/schematics/Schematic_ESP32-Marauder-2_ESP32-Marauder-2-Schematic_20191007113616_png.png)
|
||||
|
||||
| 2.8" TFT | ESP32 |
|
||||
| -------- | ------ |
|
||||
| VCC | VCC |
|
||||
| GND | GND |
|
||||
| CS | GPIO17 |
|
||||
| RESET | GPIO5 |
|
||||
| D/C | GPIO16 |
|
||||
| MOSI | GPIO23 |
|
||||
| SCK | GPIO18 |
|
||||
| LED | GPIO32 |
|
||||
| MISO | GPIO19 |
|
||||
| T_CLK | GPIO18 |
|
||||
| T_CS | GPIO21 |
|
||||
| T_DI | GPIO23 |
|
||||
| T_DO | GPIO19 |
|
||||
| T_IRQ | N/C |
|
||||
|
||||
## Flashing Firmware
|
||||
### Using Arduino IDE
|
||||
1. Install the [Arduino IDE](https://www.arduino.cc/en/main/software)
|
||||
2. In the Arduino IDE, go to `File`>`Preferences`
|
||||
3. Add the following URL to `Additional Boards Manager URLs:`
|
||||
- https://dl.espressif.com/dl/package_esp32_index.json
|
||||
4. Go to `Tools`>`Board`>`Boards Manager`, search for `esp32` and install `esp32 by Espressif Systems`
|
||||
5. Install Spacehuhn's [SimpleList](https://github.com/spacehuhn/SimpleList) library in your Arduino IDE
|
||||
- Download the SimpleList repo
|
||||
- In the Arduino IDE, go to `Sketch`>`Include Library`>`Add .ZIP Library...` and add the SimpleList-master.zip you just downloaded
|
||||
<!---6. Install Bodmer's [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library in your Arduino IDE--->
|
||||
6. Install my fork of Bodmer's [TFT_eSPI](https://github.com/justcallmekoko/TFT_eSPI) library in your Arduino IDE
|
||||
- Download the TFT_eSPI repo
|
||||
- In the Arduino IDE, go to `Sketch`>`Include Library`>`Add .ZIP Library...` and add the TFT-eSPI-master.zip you just downloaded
|
||||
- Make the following modifications shown in [this issue](https://github.com/justcallmekoko/ESP32Marauder/issues/2#issuecomment-555695918) to the TFT_eSPI library you just installed
|
||||
7. Follow [these instructions](https://github.com/me-no-dev/arduino-esp32fs-plugin) for installing ESP32 Spiffs Tool
|
||||
8. Install the [CH340 Drivers](https://github.com/justcallmekoko/ESP32Marauder/blob/master/Drivers/CH34x_Install_Windows_v3_4.EXE)
|
||||
9. Download or clone this repository
|
||||
10. Open `esp32_marauder.ino`
|
||||
11. Plug your ESP32 into a USB port and select the COM port under `Tools`>`Port`
|
||||
12. Select `LOLIN D32` under `Tools`>`Boards`
|
||||
13. Click `ESP32 Sketch Data Upload` and wait for the SPIFFS upload to finish
|
||||
14. Click the upload button
|
||||
|
||||
## Updating Firmware
|
||||
There are multiple options available to update the Marauder firmware. If you have already built the project from this repo, you can just pull the latest commit and flash the firmware using the Arduino IDE (see [here](#using-arduino-ide)).
|
||||
If you own an ESP32 Marauder (v0.4.0 or later) and have not build the project, you can follow these instructions for installing the latest update over the air via Marauder's web interface.
|
||||
|
||||
1. Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the Marauder firmware
|
||||
2. With Marauder powered on, select the main menu option `Update Firmware`
|
||||
- Marauder will display details on screen about the status of the update
|
||||
3. Connect to the MarauderOTA WiFi network from your computer
|
||||
- password: justcallmekoko
|
||||
4. On your web browser, navigate to `http://192.168.4.1`
|
||||
5. Enter the username and password
|
||||
- Username: admin
|
||||
- Password: admin
|
||||
6. Click the `Browse` button and select the .bin file you downloaded from the releases
|
||||
7. Click `Update`
|
||||
- Marauder will automatically reboot once the update has been applied
|
||||
|
||||
## Enclosure
|
||||
The ESP32 Marauder sold on Tindie comes with its own 3D printed enclosure. If you want to replace the enclosure that came with yours or you want to try to fit your own hardware in an enclosure and have access to a 3D printer, you can download the STL files [here](https://github.com/justcallmekoko/ESP32Marauder/tree/master/3Dfiles) or from [Thingiverse](https://www.thingiverse.com/thing:4146626).
|
||||
## Getting Started
|
||||
Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the firmware.
|
||||
|
||||
Instructions from Thingiverse
|
||||
Components of the project:
|
||||
- ESP32 Marauder
|
||||
- 4 M2.5x10 Hex screws
|
||||
- Enclosure face plate
|
||||
- Enclosure body
|
||||
|
||||
How to do the thing:
|
||||
1. Print both the face plate and the body
|
||||
2. Mount the face plate onto the screen of the Marauder by putting the pegs through the holes on the screen PCB
|
||||
3. Lower the Marauder into the body of the enclosure and ensure the battery sits within the trench in the center of the body
|
||||
4. Fasten the face plate to the body using 4 M2.5x10 hex screws.
|
||||
- The top of the screws should be flush with the surface of the face plate
|
||||
|
||||
# Under Development
|
||||
Currently the ESP32 Marauder has limited firmware capabilities. Most of the work so far has been put into designing the hardware. New firmware features will be added over time and will eventually reach a point where this project will be a fully capable hacking machine.
|
||||
|
||||
# Special Thanks
|
||||
- [Spacehuhn](https://github.com/spacehuhn) for an easy to use linked list library [SimpleList](https://github.com/spacehuhn/SimpleList)
|
||||
- Also a well designed menu structure. I adapted it to the TFT GUI because it worked perfectly
|
||||
- [Ivanseidel](https://github.com/ivanseidel) for providing a thread safe [LinkedList](https://github.com/ivanseidel/LinkedList) library
|
||||
- [Bodmer](https://github.com/Bodmer) for a comprehensive TFT touch screen library [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI)
|
||||
- [HyderHasnain](https://github.com/hyderhasnain) for an adaptable [line graph](https://github.com/hyderhasnain/arduino_touchscreen_controller/blob/master/Code/AccelGraph_Original.ino) to be used as the packet monitor
|
||||
Check out the project [wiki](https://github.com/justcallmekoko/ESP32Marauder/wiki) for a full overview of the ESP32 Marauder
|
||||
|
||||
# For Sale Now
|
||||
You can buy the ESP32 Marauder using [this link](https://www.tindie.com/products/justcallmekoko/esp32-marauder/)
|
||||
|
||||
459
a32u4_marauder/a32u4_marauder.ino
Normal file
459
a32u4_marauder/a32u4_marauder.ino
Normal file
@@ -0,0 +1,459 @@
|
||||
#include <hidboot.h>
|
||||
#include <usbhub.h>
|
||||
#include "Keyboard.h"
|
||||
|
||||
#define Serial Serial1
|
||||
|
||||
// Satisfy the IDE, which needs to see the include statment in the ino too.
|
||||
#ifdef dobogusinclude
|
||||
#include <spi4teensy3.h>
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
|
||||
#define CAPS_LOCK 0x39
|
||||
#define NUM_LOCK 0x53
|
||||
#define SCROLL_LOCK 0x47
|
||||
#define PRINT_SCREEN 0x46
|
||||
#define NUM_1 0x59
|
||||
#define NUM_2 0x5A
|
||||
#define NUM_3 0x5B
|
||||
#define NUM_4 0x5C
|
||||
#define NUM_5 0x5D
|
||||
#define NUM_6 0x5E
|
||||
#define NUM_7 0x5F
|
||||
#define NUM_8 0x60
|
||||
#define NUM_9 0x61
|
||||
#define NUM_0 0x62
|
||||
|
||||
#define KEY_CAPS_LOCK 0x01
|
||||
#define KEY_NUM_LOCK 0x02
|
||||
#define KEY_SCROLL_LOCK 0x04
|
||||
#define KEY_PRINT_SCREEN 0x05
|
||||
#define KEY_NUM_1 0x31
|
||||
#define KEY_NUM_2 0x32
|
||||
#define KEY_NUM_3 0x33
|
||||
#define KEY_NUM_4 0x34
|
||||
#define KEY_NUM_5 0x35
|
||||
#define KEY_NUM_6 0x36
|
||||
#define KEY_NUM_7 0x37
|
||||
#define KEY_NUM_8 0x38
|
||||
#define KEY_NUM_9 0x39
|
||||
#define KEY_NUM_0 0x30
|
||||
|
||||
String bufferStr = "";
|
||||
String last = "";
|
||||
|
||||
int defaultDelay = 0;
|
||||
|
||||
bool shift = false;
|
||||
bool num_lock = false; // false is working half way
|
||||
|
||||
USB Usb;
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
||||
uint32_t next_time;
|
||||
|
||||
class KbdRptParser : public KeyboardReportParser{
|
||||
public:
|
||||
uint8_t _parse(uint8_t key);
|
||||
String _getChar(uint8_t key);
|
||||
protected:
|
||||
void OnControlKeysChanged(uint8_t before, uint8_t after);
|
||||
|
||||
void OnKeyDown (uint8_t mod, uint8_t key);
|
||||
void OnKeyUp (uint8_t mod, uint8_t key);
|
||||
void OnKeyPressed(uint8_t key);
|
||||
|
||||
void _press(uint8_t key);
|
||||
void _release(uint8_t key);
|
||||
};
|
||||
|
||||
void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key){
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
int parsedKey = _parse(key);
|
||||
if(parsedKey == key){
|
||||
uint8_t c = OemToAscii(mod, key);
|
||||
OnKeyPressed(c);
|
||||
if(c != 0x20 && c != 0x00) _press(c);
|
||||
else _press(key);
|
||||
}else _press(parsedKey);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
|
||||
void KbdRptParser::OnKeyUp(uint8_t mod, uint8_t key){
|
||||
int parsedKey = _parse(key);
|
||||
if(parsedKey == key){
|
||||
uint8_t c = OemToAscii(mod, key);
|
||||
OnKeyPressed(c);
|
||||
if(c != 0x20 && c != 0x00){
|
||||
_release(c);
|
||||
Serial.print((char)c);
|
||||
}
|
||||
else{
|
||||
_release(key);
|
||||
Serial.print("0x");
|
||||
Serial.print(key, HEX);
|
||||
}
|
||||
}else{
|
||||
_release(parsedKey);
|
||||
Serial.print(_getChar(key));
|
||||
}
|
||||
}
|
||||
|
||||
void KbdRptParser::OnControlKeysChanged(uint8_t before, uint8_t after) {
|
||||
|
||||
MODIFIERKEYS beforeMod;
|
||||
*((uint8_t*)&beforeMod) = before;
|
||||
|
||||
MODIFIERKEYS afterMod;
|
||||
*((uint8_t*)&afterMod) = after;
|
||||
|
||||
//left
|
||||
if(beforeMod.bmLeftCtrl != afterMod.bmLeftCtrl){
|
||||
if(afterMod.bmLeftCtrl) Keyboard.press(KEY_LEFT_CTRL);
|
||||
else Keyboard.release(KEY_LEFT_CTRL);
|
||||
Serial.print("<ctrl "+(String)afterMod.bmLeftCtrl+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmLeftShift != afterMod.bmLeftShift){
|
||||
if(afterMod.bmLeftShift) Keyboard.press(KEY_LEFT_SHIFT);
|
||||
else Keyboard.release(KEY_LEFT_SHIFT);
|
||||
shift = afterMod.bmLeftShift;
|
||||
//Serial.print("<shift "+(String)afterMod.bmLeftShift+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmLeftAlt != afterMod.bmLeftAlt){
|
||||
if(afterMod.bmLeftAlt) Keyboard.press(KEY_LEFT_ALT);
|
||||
else Keyboard.release(KEY_LEFT_ALT);
|
||||
Serial.print("<alt "+(String)afterMod.bmLeftAlt+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmLeftGUI != afterMod.bmLeftGUI){
|
||||
if(afterMod.bmLeftGUI) Keyboard.press(KEY_LEFT_GUI);
|
||||
else Keyboard.release(KEY_LEFT_GUI);
|
||||
Serial.print("<gui "+(String)afterMod.bmLeftGUI+">");
|
||||
}
|
||||
|
||||
//right
|
||||
if(beforeMod.bmRightCtrl != afterMod.bmRightCtrl){
|
||||
if(afterMod.bmRightCtrl) Keyboard.press(KEY_RIGHT_CTRL);
|
||||
else Keyboard.release(KEY_RIGHT_CTRL);
|
||||
Serial.print("<ctrl "+(String)afterMod.bmRightCtrl+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmRightShift != afterMod.bmRightShift){
|
||||
if(afterMod.bmRightShift) Keyboard.press(KEY_RIGHT_SHIFT);
|
||||
else Keyboard.release(KEY_RIGHT_SHIFT);
|
||||
shift = afterMod.bmLeftShift;
|
||||
//Serial.print("<shift "+(String)afterMod.bmRightShift+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmRightAlt != afterMod.bmRightAlt){
|
||||
if(afterMod.bmRightAlt) Keyboard.press(KEY_RIGHT_ALT);
|
||||
else Keyboard.release(KEY_RIGHT_ALT);
|
||||
Serial.print("<alt "+(String)afterMod.bmRightAlt+">");
|
||||
}
|
||||
|
||||
if(beforeMod.bmRightGUI != afterMod.bmRightGUI){
|
||||
if(afterMod.bmRightGUI) Keyboard.press(KEY_RIGHT_GUI);
|
||||
else Keyboard.release(KEY_RIGHT_GUI);
|
||||
Serial.print("<gui "+(String)afterMod.bmRightGUI+">");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void KbdRptParser::OnKeyPressed(uint8_t key){
|
||||
/*Serial.print("ASCII: \"");
|
||||
Serial.print((char)key);
|
||||
Serial.print("\" = 0x");
|
||||
Serial.print(key, HEX);
|
||||
Serial.print("; ");*/
|
||||
};
|
||||
|
||||
uint8_t KbdRptParser::_parse(uint8_t key){
|
||||
/*
|
||||
Serial.print("0x");
|
||||
Serial.print(key, HEX);
|
||||
Serial.print(" = ");*/
|
||||
switch(key){
|
||||
case CAPS_LOCK: return KEY_CAPS_LOCK; break; // CAPS
|
||||
case NUM_LOCK: return KEY_NUM_LOCK; break; // NUM LOCK
|
||||
case SCROLL_LOCK: return KEY_SCROLL_LOCK; break; // SCROLL LOCK
|
||||
case PRINT_SCREEN: return KEY_PRINT_SCREEN; break; // PRINT SCREEN
|
||||
case NUM_1 : if (!num_lock) return KEY_NUM_1; break;
|
||||
case NUM_2 : if (!num_lock) return KEY_NUM_2; break;
|
||||
case NUM_3 : if (!num_lock) return KEY_NUM_3; break;
|
||||
case NUM_4 : if (!num_lock) return KEY_NUM_4; break;
|
||||
case NUM_5 : if (!num_lock) return KEY_NUM_5; break;
|
||||
case NUM_6 : if (!num_lock) return KEY_NUM_6; break;
|
||||
case NUM_7 : if (!num_lock) return KEY_NUM_7; break;
|
||||
case NUM_8 : if (!num_lock) return KEY_NUM_8; break;
|
||||
case NUM_9 : if (!num_lock) return KEY_NUM_9; break;
|
||||
case NUM_0 : if (!num_lock) return KEY_NUM_0; break;
|
||||
case 0x2C: return 0x20; break; // SPACE
|
||||
case 40: return KEY_RETURN; break;
|
||||
case 41: return KEY_ESC; break;
|
||||
case 42: return KEY_BACKSPACE; break;
|
||||
case 43: return KEY_TAB; break;
|
||||
case 58: return KEY_F1; break;
|
||||
case 59: return KEY_F2; break;
|
||||
case 60: return KEY_F3; break;
|
||||
case 61: return KEY_F4; break;
|
||||
case 62: return KEY_F5; break;
|
||||
case 63: return KEY_F6; break;
|
||||
case 64: return KEY_F7; break;
|
||||
case 65: return KEY_F8; break;
|
||||
case 66: return KEY_F9; break;
|
||||
case 67: return KEY_F10; break;
|
||||
case 68: return KEY_F11; break;
|
||||
case 69: return KEY_F12; break;
|
||||
case 73: return KEY_INSERT; break;
|
||||
case 74: return KEY_HOME; break;
|
||||
case 75: return KEY_PAGE_UP; break;
|
||||
case 76: return KEY_DELETE; break;
|
||||
case 77: return KEY_END; break;
|
||||
case 78: return KEY_PAGE_DOWN; break;
|
||||
case 79: return KEY_RIGHT_ARROW; break;
|
||||
case 80: return KEY_LEFT_ARROW; break;
|
||||
case 81: return KEY_DOWN_ARROW; break;
|
||||
case 82: return KEY_UP_ARROW; break;
|
||||
case 88: return KEY_RETURN; break;
|
||||
//=====[DE-Keyboard]=====//
|
||||
case 0x64: return 236; break; // <
|
||||
case 0x32: return 92; break; // #
|
||||
//======================//
|
||||
default: {
|
||||
//Serial.print(" N/A ");
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String KbdRptParser::_getChar(uint8_t key){
|
||||
switch(key){
|
||||
case CAPS_LOCK: return "<CAPS_LOCK>"; break; // CAPS
|
||||
case NUM_LOCK: return "<NUM_LOCK>"; break; // NUM LOCK
|
||||
case SCROLL_LOCK: return "<SCROLL_LOCK>"; break; // SCROLL LOCK
|
||||
case PRINT_SCREEN: return "<PRINT_SCREEN>"; break; // PRINT SCREEN
|
||||
//case NUM_1 : if (num_lock) return "<NUM_1>"; break;
|
||||
//case NUM_2 : if (num_lock) return "<NUM_2>"; break;
|
||||
//case NUM_3 : if (num_lock) return "<NUM_3>"; break;
|
||||
//case NUM_4 : if (num_lock) return "<NUM_4>"; break;
|
||||
//case NUM_5 : if (num_lock) return "<NUM_5>"; break;
|
||||
//case NUM_6 : if (num_lock) return "<NUM_6>"; break;
|
||||
//case NUM_7 : if (num_lock) return "<NUM_7>"; break;
|
||||
//case NUM_8 : if (num_lock) return "<NUM_8>"; break;
|
||||
//case NUM_9 : if (num_lock) return "<NUM_9>"; break;
|
||||
//case NUM_0 : if (num_lock) return "<NUM_0>"; break;
|
||||
case 0x2C: return " "; break;
|
||||
case 40: return "<RETURN>\n"; break;
|
||||
case 41: return "<ESC>\n"; break;
|
||||
case 42: return "<BACKSPCAE>"; break;
|
||||
case 43: return "<TAB>\n"; break;
|
||||
case 58: return "<F1>\n"; break;
|
||||
case 59: return "<F2>\n"; break;
|
||||
case 60: return "<F3>\n"; break;
|
||||
case 61: return "<F4>\n"; break;
|
||||
case 62: return "<F5>\n"; break;
|
||||
case 63: return "<F6>\n"; break;
|
||||
case 64: return "<F7>\n"; break;
|
||||
case 65: return "<F8>\n"; break;
|
||||
case 66: return "<F9>\n"; break;
|
||||
case 67: return "<F10>\n"; break;
|
||||
case 68: return "<F11>\n"; break;
|
||||
case 69: return "<F12>\n"; break;
|
||||
case 73: return "<INSERT>"; break;
|
||||
case 74: return "<HOME>\n"; break;
|
||||
case 75: return "<PAGE_UP>\n"; break;
|
||||
case 76: return "<DELETE>"; break;
|
||||
case 77: return "<END>\n"; break;
|
||||
case 78: return "<PAGE_DOWN>\n"; break;
|
||||
case 79: return "<RIGHT_ARROW>\n"; break;
|
||||
case 80: return "<LEFT_ARROW>\n"; break;
|
||||
case 81: return "<DOWN_ARROW>\n"; break;
|
||||
case 82: return "<UP_ARROW>\n"; break;
|
||||
case 88: return "<RETURN>\n"; break;
|
||||
//=====[DE-Keyboard]=====//
|
||||
case 0x64: {
|
||||
if(shift) return "<";
|
||||
else return ">";
|
||||
break;
|
||||
}
|
||||
case 0x32:{
|
||||
if(shift) return "'";
|
||||
else return "#";
|
||||
break;
|
||||
}
|
||||
//======================//
|
||||
default: {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KbdRptParser::_press(uint8_t key){
|
||||
/*Serial.print("0x");
|
||||
Serial.print(key, HEX);
|
||||
Serial.println(" DOWN");*/
|
||||
Keyboard.press(key);
|
||||
}
|
||||
|
||||
void KbdRptParser::_release(uint8_t key){
|
||||
/*Serial.print("0x");
|
||||
Serial.print(key, HEX);
|
||||
Serial.println(" UP");
|
||||
Serial.println();*/
|
||||
Keyboard.release(key);
|
||||
}
|
||||
|
||||
KbdRptParser parser;
|
||||
|
||||
void Line(String _line)
|
||||
{
|
||||
int firstSpace = _line.indexOf(" ");
|
||||
if(firstSpace == -1) Press(_line);
|
||||
else if(_line.substring(0,firstSpace) == "STRING"){
|
||||
for(int i=firstSpace+1;i<_line.length();i++) Keyboard.write(_line[i]);
|
||||
}
|
||||
else if(_line.substring(0,firstSpace) == "DELAY"){
|
||||
int delaytime = _line.substring(firstSpace + 1).toInt();
|
||||
delay(delaytime);
|
||||
}
|
||||
else if(_line.substring(0,firstSpace) == "DEFAULTDELAY") defaultDelay = _line.substring(firstSpace + 1).toInt();
|
||||
else if(_line.substring(0,firstSpace) == "REM"){} //nothing :/
|
||||
else if(_line.substring(0,firstSpace) == "REPLAY") {
|
||||
int replaynum = _line.substring(firstSpace + 1).toInt();
|
||||
while(replaynum)
|
||||
{
|
||||
Line(last);
|
||||
--replaynum;
|
||||
}
|
||||
} else{
|
||||
String remain = _line;
|
||||
|
||||
while(remain.length() > 0){
|
||||
int latest_space = remain.indexOf(" ");
|
||||
if (latest_space == -1){
|
||||
Press(remain);
|
||||
remain = "";
|
||||
}
|
||||
else{
|
||||
Press(remain.substring(0, latest_space));
|
||||
remain = remain.substring(latest_space + 1);
|
||||
}
|
||||
delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
Keyboard.releaseAll();
|
||||
delay(defaultDelay);
|
||||
}
|
||||
|
||||
|
||||
void Press(String b){
|
||||
if(b.length() == 1) Keyboard.press(char(b[0]));
|
||||
else if (b.equals("ENTER")) Keyboard.press(KEY_RETURN);
|
||||
else if (b.equals("CTRL")) Keyboard.press(KEY_LEFT_CTRL);
|
||||
else if (b.equals("SHIFT")) Keyboard.press(KEY_LEFT_SHIFT);
|
||||
else if (b.equals("ALT")) Keyboard.press(KEY_LEFT_ALT);
|
||||
else if (b.equals("GUI")) Keyboard.press(KEY_LEFT_GUI);
|
||||
else if (b.equals("UP") || b.equals("UPARROW")) Keyboard.press(KEY_UP_ARROW);
|
||||
else if (b.equals("DOWN") || b.equals("DOWNARROW")) Keyboard.press(KEY_DOWN_ARROW);
|
||||
else if (b.equals("LEFT") || b.equals("LEFTARROW")) Keyboard.press(KEY_LEFT_ARROW);
|
||||
else if (b.equals("RIGHT") || b.equals("RIGHTARROW")) Keyboard.press(KEY_RIGHT_ARROW);
|
||||
else if (b.equals("DELETE")) Keyboard.press(KEY_DELETE);
|
||||
else if (b.equals("PAGEUP")) Keyboard.press(KEY_PAGE_UP);
|
||||
else if (b.equals("PAGEDOWN")) Keyboard.press(KEY_PAGE_DOWN);
|
||||
else if (b.equals("HOME")) Keyboard.press(KEY_HOME);
|
||||
else if (b.equals("ESC")) Keyboard.press(KEY_ESC);
|
||||
else if (b.equals("BACKSPACE")) Keyboard.press(KEY_BACKSPACE);
|
||||
else if (b.equals("INSERT")) Keyboard.press(KEY_INSERT);
|
||||
else if (b.equals("TAB")) Keyboard.press(KEY_TAB);
|
||||
else if (b.equals("END")) Keyboard.press(KEY_END);
|
||||
else if (b.equals("CAPSLOCK")) Keyboard.press(KEY_CAPS_LOCK);
|
||||
else if (b.equals("F1")) Keyboard.press(KEY_F1);
|
||||
else if (b.equals("F2")) Keyboard.press(KEY_F2);
|
||||
else if (b.equals("F3")) Keyboard.press(KEY_F3);
|
||||
else if (b.equals("F4")) Keyboard.press(KEY_F4);
|
||||
else if (b.equals("F5")) Keyboard.press(KEY_F5);
|
||||
else if (b.equals("F6")) Keyboard.press(KEY_F6);
|
||||
else if (b.equals("F7")) Keyboard.press(KEY_F7);
|
||||
else if (b.equals("F8")) Keyboard.press(KEY_F8);
|
||||
else if (b.equals("F9")) Keyboard.press(KEY_F9);
|
||||
else if (b.equals("F10")) Keyboard.press(KEY_F10);
|
||||
else if (b.equals("F11")) Keyboard.press(KEY_F11);
|
||||
else if (b.equals("F12")) Keyboard.press(KEY_F12);
|
||||
else if (b.equals("SPACE")) Keyboard.press(' ');
|
||||
//else Serial.println("not found :'"+b+"'("+String(b.length())+")");
|
||||
}
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
//Serial1.begin(115200);
|
||||
Keyboard.begin();
|
||||
delay(2000);
|
||||
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
// Turn signal LED off
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
|
||||
//Serial1.println("\n\nLogging keys...\n");
|
||||
/*
|
||||
for(int i=0;i<256;i++){
|
||||
|
||||
int key = parser._parse(i);
|
||||
if(key == i){
|
||||
Keyboard.print((String)i+" ");
|
||||
Keyboard.write(i);
|
||||
delay(200);
|
||||
Keyboard.write(KEY_RETURN);
|
||||
}
|
||||
}*/
|
||||
|
||||
if(Usb.Init() == -1) Serial.println("OSC did not start.");
|
||||
|
||||
delay(200);
|
||||
|
||||
next_time = millis() + 5000;
|
||||
|
||||
HidKeyboard.SetReportParser(0, &parser);
|
||||
|
||||
}
|
||||
|
||||
void loop(){
|
||||
Usb.Task();
|
||||
|
||||
if(Serial.available()) {
|
||||
bufferStr = Serial.readStringUntil("END");
|
||||
//Serial.println(bufferStr);
|
||||
}
|
||||
|
||||
if(bufferStr.length() > 0){
|
||||
|
||||
bufferStr.replace("\r","\n");
|
||||
bufferStr.replace("\n\n","\n");
|
||||
|
||||
while(bufferStr.length() > 0){
|
||||
int latest_return = bufferStr.indexOf("\n");
|
||||
if(latest_return == -1){
|
||||
//Serial.println("run: "+bufferStr);
|
||||
Line(bufferStr);
|
||||
bufferStr = "";
|
||||
} else{
|
||||
//Serial.println("run: '"+bufferStr.substring(0, latest_return)+"'");
|
||||
Line(bufferStr.substring(0, latest_return));
|
||||
last=bufferStr.substring(0, latest_return);
|
||||
bufferStr = bufferStr.substring(latest_return + 1);
|
||||
}
|
||||
}
|
||||
|
||||
bufferStr = "";
|
||||
Serial.write(0x99);
|
||||
//Serial.println("done");
|
||||
}
|
||||
}
|
||||
372
bootloaders/BootloaderMassStorage2.hex
Normal file
372
bootloaders/BootloaderMassStorage2.hex
Normal file
@@ -0,0 +1,372 @@
|
||||
:046800000C940038BC
|
||||
:1068100084B7877F84BF0FB6F894A89580916000F5
|
||||
:10682000886180936000109260000FBE90E080E865
|
||||
:106830000FB6F89480936100909361000FBEC1E0A1
|
||||
:10684000C5BF82E085BF12D7C0936F0083E08093FD
|
||||
:106850008100789480910001882339F081E091E0F3
|
||||
:106860000E94D93D0E94623DF5CF8091800291E067
|
||||
:10687000980F909380028F3F89F78FE99FE00197EF
|
||||
:10688000F1F700C000008091E00081608093E0009B
|
||||
:1068900082E49CED90938C0280938B029CE088E1D3
|
||||
:1068A0000FB6F894A895809360000FBE9093600097
|
||||
:1068B000FFCF0895089581E091E00C94BC3D81E004
|
||||
:1068C00091E00C947B3D81D010928002089591302C
|
||||
:1068D00039F0923051F480E290E02CEE31E009C0C2
|
||||
:1068E00082E190E02CE032E004C080E090E020E023
|
||||
:1068F00030E0FA01318320830895611520E77207A3
|
||||
:106900008105910558F4AB01BC014F7755276627E7
|
||||
:10691000772781E0452B462B472B09F080E08170DB
|
||||
:106920000895BF92CF92DF92EF92FF920F931F9341
|
||||
:10693000CF93DF93EC01E8A0FF8C0BA11AA126E511
|
||||
:10694000E216F10468F080913C01807F85608093BD
|
||||
:106950003C0181E2809346011092470180E02BC008
|
||||
:10696000B62E6701C6018E199F098017910750F452
|
||||
:10697000C601BB2011F0F7D101C02FD13FEFC31AE0
|
||||
:10698000D30AF0CFC801A0E0B0E029E0880F991F3A
|
||||
:10699000AA1FBB1F2A95D1F74C895D896E897F8913
|
||||
:1069A0008A019B01081B190B2A0B3B0B0C8B1D8BBF
|
||||
:1069B0002E8B3F8B81E0DF91CF911F910F91FF9044
|
||||
:1069C000EF90DF90CF90BF900895EF92FF920F93DA
|
||||
:1069D0001F93CF93DF93EC018B8D8F31A0F48D311A
|
||||
:1069E00008F0BAC08231E1F138F4882309F4B4C068
|
||||
:1069F000833009F466C0B5C08A3109F48CC08B318C
|
||||
:106A000009F4A2C0AEC0883209F47FC010F5853207
|
||||
:106A100009F0A7C01092F1001092F1001092F1005D
|
||||
:106A200085E58093F1001092F1001092F10082E070
|
||||
:106A30008093F1001092F1008091E8008E778093AE
|
||||
:106A4000E8008C899D89AE89BF890897A109B109A1
|
||||
:106A500076C08A3209F457C08F3209F47DC081C0F4
|
||||
:106A60000F8D1E8D8C8D837019F48D8D882341F0D0
|
||||
:106A700080913C01807F856080933C0184E278C0F6
|
||||
:106A800078010532110518F084E2E82EF12C40E07F
|
||||
:106A900050E0B7018EE192E020D460E070E0C801E0
|
||||
:106AA0008E199F09E6D38091E8008E778093E800E5
|
||||
:106AB0008C899D89AE89BF898E199F09A109B10969
|
||||
:106AC0003EC01F8D012F133108F002E1E02EF12CA2
|
||||
:106AD00040E050E0B7018AE391E0FFD3812F90E0DE
|
||||
:106AE00060E070E08E199F09C4D38091E8008E7732
|
||||
:106AF0008093E8008C899D89AE89BF89801B9109AC
|
||||
:106B0000A109B1091CC060E001C061E0CE0109DF4C
|
||||
:106B1000882391F133C01092F1001092F10010928D
|
||||
:106B2000F1001092F1008091E8008E778093E800E8
|
||||
:106B30008C899D89AE89BF890497A109B1098C8B85
|
||||
:106B40009D8BAE8BBF8B1AC08F8D837091E082308E
|
||||
:106B500009F490E0909300011C8A1D8A1E8A1F8A06
|
||||
:106B60000DC080913C01807F856080933C0180E274
|
||||
:106B7000809346011092470180E00AC080913C0159
|
||||
:106B8000807F80933C01109246011092470181E082
|
||||
:106B9000DF91CF911F910F91FF90EF9008959B018E
|
||||
:106BA00036952795260FE22FF0E0E80FF91F60FFDA
|
||||
:106BB0000EC080818F70942F9295907F892B808357
|
||||
:106BC00084E0569547958A95E1F74183089540837F
|
||||
:106BD000842F807F852B818308954F925F926F92DF
|
||||
:106BE0007F928F929F92AF92BF92CF92DF92EF925D
|
||||
:106BF000FF920F931F93CF93DF93CDB7DEB7D250A1
|
||||
:106C00000FB6F894DEBF0FBECDBF8C0140E050E060
|
||||
:106C100060E072E0CE010196A9D38091E8008B7705
|
||||
:106C20008093E8000330110508F486C00330110595
|
||||
:106C300051F480EAFE013196ACE4B1E001900D928E
|
||||
:106C40008A95E1F779C08091A6019091A7018150C2
|
||||
:106C5000904C880F991F880F991F0817190778F40F
|
||||
:106C60008091E6019091E7018150904C880F991F27
|
||||
:106C7000880F991F0817190708F040C05DC09C01D4
|
||||
:106C80002D5C3F4F2017310758F34801881A990AA5
|
||||
:106C9000982C8824990CCE0101967C0154019EEF1A
|
||||
:106CA000B91A2401612C712CC4018F779927892B83
|
||||
:106CB00019F4C301B20166D2F701418150E0542FAB
|
||||
:106CC00044278081482BC301B201A0D26401F2E0C5
|
||||
:106CD000CF0ED11CC6018F779927892B31F4B401CF
|
||||
:106CE0006E57710980E090E06FD282E0E80EF11CEF
|
||||
:106CF000AC14BD0409F4B4CF4601D3CF9C012F5F7F
|
||||
:106D00003F4F20173107C0F0081B190B102F002729
|
||||
:106D1000110FFE0131967F01C12CD12CF701619139
|
||||
:106D20007F01C8018C0D9D1DA3D2FFEFCF1ADF0A92
|
||||
:106D3000C11482E0D80691F7DE5F0FB6F894DEBF8B
|
||||
:106D40000FBECDBFDF91CF911F910F91FF90EF90BC
|
||||
:106D5000DF90CF90BF90AF909F908F907F906F907B
|
||||
:106D60005F904F900895AF92BF92CF92DF92EF92D3
|
||||
:106D7000FF920F931F93CF93DF93CDB7DEB7D2501F
|
||||
:106D80000FB6F894DEBF0FBECDBF9E012F5F3F4F01
|
||||
:106D9000790120E032E0F701A90111924150504001
|
||||
:106DA000E1F783309105B8F4019708F58EE3E2E44A
|
||||
:106DB000F2E0D70101900D928A95E1F785E5C15087
|
||||
:106DC000DE4F8883CF5FD1408AEAC050DE4F888390
|
||||
:106DD000C050D2408AC08330910591F580EAECE43E
|
||||
:106DE000F1E0D70101900D928A95E1F77EC048EF5E
|
||||
:106DF0005FE060E070E0C701D2DE4FEF5FE061E08E
|
||||
:106E000070E0C701CCDE6091A6017091A70110E08F
|
||||
:106E1000CB0101966C011C3011F0AC0102C04FEFA8
|
||||
:106E20005FE0C701BCDE1F5FB6011D3089F76091CE
|
||||
:106E3000E6017091E7014FEF5FE0C701B0DE55C09A
|
||||
:106E40002091A6013091A7012150304C220F331F11
|
||||
:106E5000220F331F8217930770F42091E6013091BF
|
||||
:106E6000E7012150304C220F331F220F331F8217AE
|
||||
:106E70009307E8F43AC0A9014D5C5F4F48175907E2
|
||||
:106E800060F3FC01E21BF30B9F01322F2227330F2B
|
||||
:106E9000AE014F5F5D4FD7012E193F09F901EA0F8F
|
||||
:106EA000FB1FE491ED93A417B507C1F7D6CFA90155
|
||||
:106EB0004F5F5F4F48175907C0F08C01021B130B3F
|
||||
:106EC000102F0027110F5E01FFEFAF1AFDEFBF0A71
|
||||
:106ED00067010E191F09C8018C0D9D1DC8D1F6014F
|
||||
:106EE00081936F01EA15FB05B1F740E050E060E0E7
|
||||
:106EF00072E0C701F2D18091E8008E778093E800BC
|
||||
:106F0000DE5F0FB6F894DEBF0FBECDBFDF91CF912D
|
||||
:106F10001F910F91FF90EF90DF90CF90BF90AF90B7
|
||||
:026F20000895D2
|
||||
:1070000055C00000B4C00000B2C00000B0C0000015
|
||||
:10701000AEC00000ACC00000AAC00000A8C00000C4
|
||||
:10702000A6C00000A4C000003EC30000F4C30000DE
|
||||
:107030009EC000009CC000009AC0000098C00000E4
|
||||
:1070400096C0000094C0000092C0000090C00000F4
|
||||
:107050008FC000008CC000008AC0000088C0000003
|
||||
:1070600086C0000084C0000082C0000080C0000014
|
||||
:107070007EC000007CC000007AC0000078C0000024
|
||||
:1070800076C0000074C0000072C0000070C0000034
|
||||
:107090006EC000006CC000006AC0000068C0000044
|
||||
:1070A00066C0000064C0000062C0000011241FBE62
|
||||
:1070B000CFEFDAE0DEBFCDBF83E090E0BAD080FD55
|
||||
:1070C00012C004B601FE0AC081E020918B0230910B
|
||||
:1070D0008C0222343C4D19F080E001C081E094B76D
|
||||
:1070E0009D7F94BF11C004B603FE0AC081E02091C9
|
||||
:1070F0008B0230918C0222343C4D19F080E001C0AB
|
||||
:1071000080E094B7977F94BF20E030E0F90145918B
|
||||
:1071100054918823B9F04F3F5F4FA1F084B7877F28
|
||||
:1071200084BF0FB6F894A895809160008861809321
|
||||
:107130006000109260000FBE10928C0210928B02C1
|
||||
:10714000F901099512E0A0E0B1E0E6E1FEE702C036
|
||||
:1071500005900D92A038B107D9F722E0A0E8B2E07F
|
||||
:1071600001C01D92AB38B207E1F752DB52C648CFDF
|
||||
:107170001F920F920FB60F9211240F900FBE0F9017
|
||||
:107180001F901895CF92DF92EF92FF926B017C01D6
|
||||
:10719000B4DB8823A1F08FB7F89407B600FCFDCFCD
|
||||
:1071A000F999FECF93E0F60190935700E89507B662
|
||||
:1071B00000FCFDCF91E190935700E8958FBFFF90C1
|
||||
:1071C000EF90DF90CF900895CF92DF92EF92FF92F1
|
||||
:1071D0006B017C0192DB8823A1F08FB7F89407B68E
|
||||
:1071E00000FCFDCFF999FECF95E0F6019093570092
|
||||
:1071F000E89507B600FCFDCF91E190935700E89524
|
||||
:107200008FBFFF90EF90DF90CF90089507B600FCFE
|
||||
:10721000FDCFF999FECF21E0FB010A012093570031
|
||||
:10722000E8951124089521E2FC01209357008491F0
|
||||
:10723000089529E0FC012093570084910895E1E02E
|
||||
:10724000F0E089E080935700849108959FB7F89407
|
||||
:1072500007B600FCFDCFF999FECF809529E0E1E06B
|
||||
:10726000F0E0082E20935700E8959FBF0895B7C51A
|
||||
:10727000BEC5EF92FF920F931F93CF93DF937C01D4
|
||||
:107280008B016115710521F0FB01C081D18102C024
|
||||
:10729000C0E0D0E07ED1811119C0CE15DF05A8F481
|
||||
:1072A0008091E80085FD0DC08091E8008E77809385
|
||||
:1072B000E8000115110571F3F801D183C08385E061
|
||||
:1072C00005C01092F1002196E8CF80E0DF91CF91C8
|
||||
:1072D0001F910F91FF90EF900895CF92DF92EF9260
|
||||
:1072E000FF920F931F93CF93DF93EC018B017A01F1
|
||||
:1072F00050D1811132C0E114F10439F0F7018081DD
|
||||
:107300009181081B190BC80FD91FC12CD12C011555
|
||||
:10731000110511F18091E80085FD15C08091E8000C
|
||||
:107320008E778093E800E114F10449F0F701808141
|
||||
:107330009181C80ED91ED182C08285E00EC029D1AC
|
||||
:10734000882329F30AC089918093F1000150110923
|
||||
:10735000FFEFCF1ADF0ADBCF80E0DF91CF911F91E3
|
||||
:107360000F91FF90EF90DF90CF900895CF92DF9232
|
||||
:10737000EF92FF920F931F93CF93DF93EC018B015A
|
||||
:107380007A0107D1811132C0E114F10439F0F7011B
|
||||
:1073900080819181081B190BC80FD91FC12CD12CDA
|
||||
:1073A0000115110511F18091E80085FD15C080914E
|
||||
:1073B000E8008B778093E800E114F10449F0F701CD
|
||||
:1073C00080819181C80ED91ED182C08285E00EC015
|
||||
:1073D000E0D0882329F30AC08091F10089930150FD
|
||||
:1073E0001109FFEFCF1ADF0ADBCF80E0DF91CF91E9
|
||||
:1073F0001F910F91FF90EF90DF90CF900895209113
|
||||
:10740000890230918A022617370748F06115710505
|
||||
:1074100039F42091E8002E772093E80001C0B901EB
|
||||
:10742000FC0120E06115710571F18EB38823E9F14B
|
||||
:107430008530E9F18091E80083FD3BC08091E80050
|
||||
:1074400082FD2DC08091E80080FFECCF2091F300F9
|
||||
:107450008091F20090E0922B6115710551F0883017
|
||||
:10746000910538F421912093F10061507109019642
|
||||
:10747000F3CF21E0089709F020E08091E8008E77B3
|
||||
:107480008093E800CFCF2111D0CF09C08EB38823DD
|
||||
:1074900061F0853061F08091E80083FD0AC0809141
|
||||
:1074A000E80082FFF3CF80E0089582E0089583E052
|
||||
:1074B000089581E008958F708093E900EBEEF0E08D
|
||||
:1074C000808181608083EDEEF0E010826093EC00BB
|
||||
:1074D00040838091EE00881F8827881F08950F93AE
|
||||
:1074E0001F93CF93DF93062FEC0110E0101771F17B
|
||||
:1074F0006881611103C01F5F2596F8CF2C81A98197
|
||||
:10750000BA819B81862F8F70873010F080E01FC07A
|
||||
:10751000223010F442E001C046E0E8E0F0E020E074
|
||||
:10752000EA17FB0720F42F5FEE0FFF1FF9CF22951C
|
||||
:10753000207F422B50E4959F90011124661F6627FF
|
||||
:10754000661F622BB8DF8111D6CFE0CF81E0DF91DB
|
||||
:10755000CF911F910F9108958091830287FF0FC0F3
|
||||
:107560008091E80082FD04C08EB38111F9CF10C074
|
||||
:107570008091E8008B770AC08EB3882349F0809110
|
||||
:10758000E80080FFF9CF8091E8008E778093E800D3
|
||||
:1075900008952091E4003091E50095E64091EC00DB
|
||||
:1075A000842F817040FF22C08091E80080FD1CC0C4
|
||||
:1075B0008EB3882399F0853099F08091EB0085FD9A
|
||||
:1075C00011C04091E4005091E5002417350731F3D4
|
||||
:1075D000915011F09A01E2CF84E0089582E008957D
|
||||
:1075E00083E0089581E0089580E008954091E800E7
|
||||
:1075F00042FFDECF08950F931F93CF93DF9346D0C2
|
||||
:107600004DD0C8EDD0E088818F77888388818068ED
|
||||
:10761000888388818F7D888319BC1EBA109281026D
|
||||
:1076200000EE10E0F80180818B7F8083888181608B
|
||||
:10763000888342E060E080E03EDFE1EEF0E08081C0
|
||||
:107640008E7F8083E2EEF0E08081816080838081A4
|
||||
:1076500088608083F80180818E7F8083888180614B
|
||||
:107660008883DF91CF911F910F910895E8EDF0E0AD
|
||||
:1076700080818F7E8083E7EDF0E080818160808370
|
||||
:1076800084E082BF81E080938202B5CFE8EDF0E034
|
||||
:1076900080818E7F80831092E20008951092DA003C
|
||||
:1076A0001092E10008951F920F920FB60F921124CD
|
||||
:1076B0002F933F934F935F936F937F938F939F93FA
|
||||
:1076C000AF93BF93EF93FF938091DA0080FF1BC0CD
|
||||
:1076D0008091D80080FF17C08091DA008E7F809360
|
||||
:1076E000DA008091D90080FF0BC080E189BD82E182
|
||||
:1076F00089BD09B400FEFDCF81E08EBBDAD803C09E
|
||||
:1077000019BC1EBAD7D88091E10080FF17C08091C4
|
||||
:10771000E20080FF13C08091E2008E7F8093E20040
|
||||
:107720008091E20080618093E2008091D8008062C5
|
||||
:107730008093D80019BC85E08EBBC3D18091E10055
|
||||
:1077400084FF2EC08091E20084FF2AC080E189BDC1
|
||||
:1077500082E189BD09B400FEFDCF8091D8008F7D04
|
||||
:107760008093D8008091E1008F7E8093E10080912A
|
||||
:10777000E2008F7E8093E2008091E200816080933E
|
||||
:10778000E20080918102882311F084E007C080919B
|
||||
:10779000E30087FD02C081E001C083E08EBB91D190
|
||||
:1077A0008091E10083FF26C08091E20083FF22C028
|
||||
:1077B0008091E100877F8093E10082E08EBB109290
|
||||
:1077C00081028091E1008E7F8093E1008091E20050
|
||||
:1077D0008E7F8093E2008091E20080618093E200DE
|
||||
:1077E00042E060E080E067DE8091F0008860809396
|
||||
:1077F000F00067D1FF91EF91BF91AF919F918F9171
|
||||
:107800007F916F915F914F913F912F910F900FBE9C
|
||||
:107810000F901F9018951F920F920FB60F92112480
|
||||
:107820002F933F934F935F936F937F938F939F9388
|
||||
:10783000AF93BF93CF93DF93EF93FF93C091E90092
|
||||
:10784000CF708091EC00D82FD17080FDD0E81092DD
|
||||
:10785000E9008091F000877F8093F00078941ED03B
|
||||
:107860001092E9008091F00088608093F000CD2BA9
|
||||
:10787000CF70C093E900FF91EF91DF91CF91BF915D
|
||||
:10788000AF919F918F917F916F915F914F913F91B8
|
||||
:107890002F910F900FBE0F901F9018951F93CF93AD
|
||||
:1078A000DF9300D0CDB7DEB7E3E8F2E08BE892E0FB
|
||||
:1078B0002091F10021938E179F07D1F700D8809176
|
||||
:1078C000E80083FFEAC080918302909184029530A2
|
||||
:1078D00009F46FC030F4913071F168F0933059F1D0
|
||||
:1078E000DCC0983009F4A9C0993009F4B5C09630CD
|
||||
:1078F00009F0D3C07FC0803899F0823809F0CDC03C
|
||||
:10790000809187028F70873008F0C7C08093E900AC
|
||||
:107910008091EB0085FB882780F91092E90001C077
|
||||
:1079200080E09091E800977F9093E8008093F100C9
|
||||
:107930001092F1008DC0282F2D7F09F0AEC082304B
|
||||
:1079400009F0ABC08091850281112AC08091870225
|
||||
:107950008F702FEF280F263008F09FC08093E9002A
|
||||
:107960002091EB0020FF1CC0933021F48091EB00AC
|
||||
:10797000806214C09091EB0090619093EB0021E045
|
||||
:1079800030E0A90102C0440F551F8A95E2F74093E9
|
||||
:10799000EA001092EA008091EB0088608093EB008F
|
||||
:1079A0001092E9008091E800877F8093E800D4DDA1
|
||||
:1079B00074C0811172C0109185021F778091E3001D
|
||||
:1079C0008078812B8093E3008091E800877F80930B
|
||||
:1079D000E800C2DD8091E80080FFFCCF8091E300E9
|
||||
:1079E00080688093E300111102C082E001C083E04F
|
||||
:1079F0008EBB53C08058823008F04FC06091870220
|
||||
:107A000070918802AE014F5F5F4F80918502909127
|
||||
:107A100086020E946734BC01892B09F43EC0909114
|
||||
:107A2000E800977F9093E80089819A81E8DC809153
|
||||
:107A3000E8008B778093E80030C0803871F5809142
|
||||
:107A4000E800877F8093E800809181028093F100B5
|
||||
:107A50008091E8008E77A9CF81111FC080918502A7
|
||||
:107A60009091860299270297C4F48091E800877F5D
|
||||
:107A70008093E80080918502809381026DDD809182
|
||||
:107A80008102811106C08091E30087FD02C081E080
|
||||
:107A900001C084E08EBB0E945B348091E80083FFCC
|
||||
:107AA0000AC08091E800877F8093E8008091EB0016
|
||||
:107AB00080628093EB000F900F90DF91CF911F9128
|
||||
:107AC00008950895CF938EB3882399F0C091E9006B
|
||||
:107AD000CF709091EC00892F817090FD80E8C82BC9
|
||||
:107AE0001092E9008091E80083FDD8DECF70C0934A
|
||||
:107AF000E900CF910895CF93DF932091E80023FF11
|
||||
:107B000038C0FC01208130E040918702509188020A
|
||||
:107B10004217530771F5209184022E3F81F02F3FC9
|
||||
:107B200041F520918302213221F5EC018091E8009A
|
||||
:107B3000877F8093E80010DD81E088AF1AC0209134
|
||||
:107B40008302213AB1F42091E800277F2093E800D6
|
||||
:107B50002091E80020FFFCCFFC01838581508093B9
|
||||
:107B6000F1008091E8008E778093E800DF91CF915B
|
||||
:107B7000F3CCDF91CF910895CF93DF93EC01FC011B
|
||||
:107B80003C968DE2DF011D928A95E9F782E08C83B5
|
||||
:107B9000898761E0CE010196A2DC882331F061E0A3
|
||||
:107BA000CE010696DF91CF919ACC80E0DF91CF9104
|
||||
:107BB0000895EF92FF920F931F93CF93DF9300D01E
|
||||
:107BC000CDB7DEB72EB3243009F000C18C01FC0123
|
||||
:107BD00086818F708093E9008091E80082FFBDC0AC
|
||||
:107BE00086818F708093E9001A8219827801FCE007
|
||||
:107BF000EF0EF11CAE014F5F5F4F6FE070E0C70109
|
||||
:107C0000B5DBF801853021F480AD882399F3A5C058
|
||||
:107C100084859585A685B78585359345A244B3446B
|
||||
:107C200061F4F801918D8385981738F4808D8F71F8
|
||||
:107C300021F4828D8150803180F08091EB00806250
|
||||
:107C40008093EB00F80181818F708093E90080912F
|
||||
:107C5000EB0080628093EB0080C01A821982780169
|
||||
:107C6000FBE1EF0EF11CF801628D70E0AE014F5F99
|
||||
:107C70005F4FC7017BDB853029F4F80180AD882395
|
||||
:107C800091F36BC08091E8008B778093E800F80156
|
||||
:107C9000808D87FF04C081818F708093E900C801C7
|
||||
:107CA0000E94633491E09827F80197AB45E553E5CE
|
||||
:107CB00062E473E543A754A765A776A74089518975
|
||||
:107CC0006289738947A750AB61AB72AB4489558910
|
||||
:107CD0006689778943AB54AB65AB76AB811109C03C
|
||||
:107CE000452B462B472B29F08091EB008062809337
|
||||
:107CF000EB00F80186818F708093E9008091EB00A2
|
||||
:107D0000F80185FF04C080AD8823C1F326C08181BE
|
||||
:107D10008F708093E9008091EB0085FF05C0F8012A
|
||||
:107D200080AD8823C1F319C01A8219827801FBE261
|
||||
:107D3000EF0EF11CAE014F5F5F4F6DE070E0C701C9
|
||||
:107D4000CCDA853029F4F80180AD882399F305C099
|
||||
:107D50008091E8008E778093E800F80180AD882359
|
||||
:107D6000A9F126812F7081E090E0AC0102C0440FA0
|
||||
:107D7000551F2A95E2F74093EA001092EA0021810C
|
||||
:107D80002F7001C0880F2A95EAF78093EA001092BD
|
||||
:107D9000EA0086818F708093E9008091EB0080611A
|
||||
:107DA0008093EB008091EB0088608093EB008181F1
|
||||
:107DB0008F708093E9008091EB0080618093EB00ED
|
||||
:107DC0008091EB0088608093EB0010AE0F900F90D5
|
||||
:107DD000DF91CF911F910F91FF90EF900895F99946
|
||||
:107DE000FECF92BD81BDF89A992780B50895262FC0
|
||||
:107DF000F999FECF92BD81BDF89A019700B40216A1
|
||||
:107E000039F01FBA20BD0FB6F894FA9AF99A0FBE4E
|
||||
:067E10000895F894FFCF75
|
||||
:107E16000100834000000104400000010100000051
|
||||
:107E2600000000000000000000000000000000004C
|
||||
:107E3600000000000000000000000000000000003C
|
||||
:107E460000000000000000000000700000000000BC
|
||||
:107E5600000A000000000000000000004C554641EA
|
||||
:107E660020424F4F54202008000000000000000070
|
||||
:107E76000000000000000000000000004146004C29
|
||||
:107E8600004100530048000F00262E004200490022
|
||||
:107E96004E0000000000000000000000464C415368
|
||||
:107EA6004820202042494E0000000000000000004B
|
||||
:107EB600000020084E1202000068000041450045FF
|
||||
:107EC60000500052004F000F00144D002E004200DB
|
||||
:107ED60049004E00000000000000000045455052D9
|
||||
:107EE6004F4D202042494E000000000000000000D7
|
||||
:107EF600000020084E120F00FF03000009022000B8
|
||||
:107F0600010100803209040000020806500007053E
|
||||
:107F16008302400005070504024000051201100116
|
||||
:107F260000000008EB03452001000000000100806E
|
||||
:107F360000021F0000004C55464100000000426F41
|
||||
:107F46006F746C6F61646572000000000000302E73
|
||||
:107F56003030EB3C906D6B646F7366730000020407
|
||||
:107F660001000210005600F8010016000100000092
|
||||
:107F7600000000000000000029785634124C5546D7
|
||||
:107F86004120424F4F542020464154313220202078
|
||||
:107FA000F1C812C933C93FC944C949C94FC9089565
|
||||
:087FB000089508950895089555
|
||||
:107FE000DFCFDFCFDFCFDFCFDFCFDFCFDFCFDFCF21
|
||||
:087FF000DFCFDFCFDFCFDFCFD1
|
||||
:087FF8000070000030DFFBDC2B
|
||||
:040000030000700089
|
||||
:00000001FF
|
||||
File diff suppressed because one or more lines are too long
49
esp32_marauder/BatteryInterface.cpp
Normal file
49
esp32_marauder/BatteryInterface.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "BatteryInterface.h"
|
||||
#include "lang_var.h"
|
||||
BatteryInterface::BatteryInterface() {
|
||||
|
||||
}
|
||||
|
||||
void BatteryInterface::main(uint32_t currentTime) {
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
if (currentTime != 0) {
|
||||
if (currentTime - initTime >= 3000) {
|
||||
//Serial.println("Checking Battery Level");
|
||||
this->initTime = millis();
|
||||
int8_t new_level = this->getBatteryLevel();
|
||||
//this->battery_level = this->getBatteryLevel();
|
||||
if (this->battery_level != new_level) {
|
||||
Serial.println(text00 + (String)new_level);
|
||||
this->battery_level = new_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BatteryInterface::RunSetup() {
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
this->initTime = millis();
|
||||
#endif
|
||||
}
|
||||
|
||||
int8_t BatteryInterface::getBatteryLevel() {
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
Wire.beginTransmission(IP5306_ADDR);
|
||||
Wire.write(0x78);
|
||||
if (Wire.endTransmission(false) == 0 &&
|
||||
Wire.requestFrom(0x75, 1)) {
|
||||
this->i2c_supported = true;
|
||||
switch (Wire.read() & 0xF0) {
|
||||
case 0xE0: return 25;
|
||||
case 0xC0: return 50;
|
||||
case 0x80: return 75;
|
||||
case 0x00: return 100;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
this->i2c_supported = false;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
32
esp32_marauder/BatteryInterface.h
Normal file
32
esp32_marauder/BatteryInterface.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef BatteryInterface_h
|
||||
#define BatteryInterface_h
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
#include <Wire.h>
|
||||
#endif
|
||||
|
||||
#define I2C_SDA 33
|
||||
#define I2C_SCL 22
|
||||
#define IP5306_ADDR 0x75
|
||||
|
||||
class BatteryInterface {
|
||||
private:
|
||||
uint32_t initTime = 0;
|
||||
|
||||
public:
|
||||
int8_t battery_level = 0;
|
||||
int8_t old_level = 0;
|
||||
bool i2c_supported = false;
|
||||
|
||||
BatteryInterface();
|
||||
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
int8_t getBatteryLevel();
|
||||
};
|
||||
|
||||
#endif
|
||||
203
esp32_marauder/Buffer.cpp
Normal file
203
esp32_marauder/Buffer.cpp
Normal file
@@ -0,0 +1,203 @@
|
||||
#include "Buffer.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
Buffer::Buffer(){
|
||||
bufA = (uint8_t*)malloc(BUF_SIZE);
|
||||
bufB = (uint8_t*)malloc(BUF_SIZE);
|
||||
}
|
||||
|
||||
void Buffer::open(fs::FS* fs, String fn){
|
||||
int i=0;
|
||||
do{
|
||||
fileName = "/"+fn+"_"+(String)i+".pcap";
|
||||
i++;
|
||||
} while(fs->exists(fileName));
|
||||
|
||||
Serial.println(fileName);
|
||||
|
||||
file = fs->open(fileName, FILE_WRITE);
|
||||
file.close();
|
||||
|
||||
bufSizeA = 0;
|
||||
bufSizeB = 0;
|
||||
|
||||
writing = true;
|
||||
|
||||
write(uint32_t(0xa1b2c3d4)); // magic number
|
||||
write(uint16_t(2)); // major version number
|
||||
write(uint16_t(4)); // minor version number
|
||||
write(int32_t(0)); // GMT to local correction
|
||||
write(uint32_t(0)); // accuracy of timestamps
|
||||
write(uint32_t(SNAP_LEN)); // max length of captured packets, in octets
|
||||
write(uint32_t(105)); // data link type
|
||||
|
||||
//useSD = true;
|
||||
}
|
||||
|
||||
void Buffer::close(fs::FS* fs){
|
||||
if(!writing) return;
|
||||
forceSave(fs);
|
||||
writing = false;
|
||||
Serial.println(text01);
|
||||
}
|
||||
|
||||
void Buffer::addPacket(uint8_t* buf, uint32_t len){
|
||||
|
||||
// buffer is full -> drop packet
|
||||
if((useA && bufSizeA + len >= BUF_SIZE && bufSizeB > 0) || (!useA && bufSizeB + len >= BUF_SIZE && bufSizeA > 0)){
|
||||
//Serial.print(";");
|
||||
return;
|
||||
}
|
||||
|
||||
if(useA && bufSizeA + len + 16 >= BUF_SIZE && bufSizeB == 0){
|
||||
useA = false;
|
||||
//Serial.println("\nswitched to buffer B");
|
||||
}
|
||||
else if(!useA && bufSizeB + len + 16 >= BUF_SIZE && bufSizeA == 0){
|
||||
useA = true;
|
||||
//Serial.println("\nswitched to buffer A");
|
||||
}
|
||||
|
||||
uint32_t microSeconds = micros(); // e.g. 45200400 => 45s 200ms 400us
|
||||
uint32_t seconds = (microSeconds/1000)/1000; // e.g. 45200400/1000/1000 = 45200 / 1000 = 45s
|
||||
|
||||
microSeconds -= seconds*1000*1000; // e.g. 45200400 - 45*1000*1000 = 45200400 - 45000000 = 400us (because we only need the offset)
|
||||
|
||||
write(seconds); // ts_sec
|
||||
write(microSeconds); // ts_usec
|
||||
write(len); // incl_len
|
||||
write(len); // orig_len
|
||||
|
||||
write(buf, len); // packet payload
|
||||
}
|
||||
|
||||
void Buffer::write(int32_t n){
|
||||
uint8_t buf[4];
|
||||
buf[0] = n;
|
||||
buf[1] = n >> 8;
|
||||
buf[2] = n >> 16;
|
||||
buf[3] = n >> 24;
|
||||
write(buf,4);
|
||||
}
|
||||
|
||||
void Buffer::write(uint32_t n){
|
||||
uint8_t buf[4];
|
||||
buf[0] = n;
|
||||
buf[1] = n >> 8;
|
||||
buf[2] = n >> 16;
|
||||
buf[3] = n >> 24;
|
||||
write(buf,4);
|
||||
}
|
||||
|
||||
void Buffer::write(uint16_t n){
|
||||
uint8_t buf[2];
|
||||
buf[0] = n;
|
||||
buf[1] = n >> 8;
|
||||
write(buf,2);
|
||||
}
|
||||
|
||||
void Buffer::write(uint8_t* buf, uint32_t len){
|
||||
if(!writing) return;
|
||||
|
||||
if(useA){
|
||||
memcpy(&bufA[bufSizeA], buf, len);
|
||||
bufSizeA += len;
|
||||
}else{
|
||||
memcpy(&bufB[bufSizeB], buf, len);
|
||||
bufSizeB += len;
|
||||
}
|
||||
}
|
||||
|
||||
void Buffer::save(fs::FS* fs){
|
||||
if(saving) return; // makes sure the function isn't called simultaneously on different cores
|
||||
|
||||
// buffers are already emptied, therefor saving is unecessary
|
||||
if((useA && bufSizeB == 0) || (!useA && bufSizeA == 0)){
|
||||
//Serial.printf("useA: %s, bufA %u, bufB %u\n",useA ? "true" : "false",bufSizeA,bufSizeB); // for debug porpuses
|
||||
return;
|
||||
}
|
||||
|
||||
//Serial.println("saving file");
|
||||
|
||||
uint32_t startTime = millis();
|
||||
uint32_t finishTime;
|
||||
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println(text02 + fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
|
||||
saving = true;
|
||||
|
||||
uint32_t len;
|
||||
|
||||
if(useA){
|
||||
file.write(bufB, bufSizeB);
|
||||
len = bufSizeB;
|
||||
bufSizeB = 0;
|
||||
}
|
||||
else{
|
||||
file.write(bufA, bufSizeA);
|
||||
len = bufSizeA;
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
finishTime = millis() - startTime;
|
||||
|
||||
//Serial.printf("\n%u bytes written for %u ms\n", len, finishTime);
|
||||
|
||||
saving = false;
|
||||
|
||||
}
|
||||
|
||||
void Buffer::forceSave(fs::FS* fs){
|
||||
uint32_t len = bufSizeA + bufSizeB;
|
||||
if(len == 0) return;
|
||||
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println(text02+fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
|
||||
saving = true;
|
||||
writing = false;
|
||||
|
||||
if(useA){
|
||||
|
||||
if(bufSizeB > 0){
|
||||
file.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
}
|
||||
|
||||
if(bufSizeA > 0){
|
||||
file.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(bufSizeA > 0){
|
||||
file.write(bufA, bufSizeA);
|
||||
bufSizeA = 0;
|
||||
}
|
||||
|
||||
if(bufSizeB > 0){
|
||||
file.write(bufB, bufSizeB);
|
||||
bufSizeB = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
//Serial.printf("saved %u bytes\n",len);
|
||||
|
||||
saving = false;
|
||||
writing = true;
|
||||
}
|
||||
44
esp32_marauder/Buffer.h
Normal file
44
esp32_marauder/Buffer.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef Buffer_h
|
||||
#define Buffer_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include "settings.h"
|
||||
//#include "SD_MMC.h"
|
||||
|
||||
#define BUF_SIZE 3 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 2324 // max len of each recieved packet
|
||||
|
||||
//extern bool useSD;
|
||||
|
||||
extern Settings settings_obj;
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer();
|
||||
void open(fs::FS* fs, String fn = "");
|
||||
void close(fs::FS* fs);
|
||||
void addPacket(uint8_t* buf, uint32_t len);
|
||||
void save(fs::FS* fs);
|
||||
void forceSave(fs::FS* fs);
|
||||
private:
|
||||
void write(int32_t n);
|
||||
void write(uint32_t n);
|
||||
void write(uint16_t n);
|
||||
void write(uint8_t* buf, uint32_t len);
|
||||
|
||||
uint8_t* bufA;
|
||||
uint8_t* bufB;
|
||||
|
||||
uint32_t bufSizeA = 0;
|
||||
uint32_t bufSizeB = 0;
|
||||
|
||||
bool writing = false; // acceppting writes to buffer
|
||||
bool useA = true; // writing to bufA or bufB
|
||||
bool saving = false; // currently saving onto the SD card
|
||||
|
||||
String fileName = "/0.pcap";
|
||||
File file;
|
||||
};
|
||||
|
||||
#endif
|
||||
575
esp32_marauder/CommandLine.cpp
Normal file
575
esp32_marauder/CommandLine.cpp
Normal file
@@ -0,0 +1,575 @@
|
||||
#include "CommandLine.h"
|
||||
|
||||
CommandLine::CommandLine() {
|
||||
}
|
||||
|
||||
void CommandLine::RunSetup() {
|
||||
Serial.println(this->ascii_art);
|
||||
|
||||
Serial.println(F("\n\n--------------------------------\n"));
|
||||
Serial.println(F(" ESP32 Marauder \n"));
|
||||
Serial.println(" " + version_number + "\n");
|
||||
Serial.println(F(" By: justcallmekoko\n"));
|
||||
Serial.println(F("--------------------------------\n\n"));
|
||||
|
||||
Serial.print("> ");
|
||||
}
|
||||
|
||||
String CommandLine::getSerialInput() {
|
||||
String input = "";
|
||||
|
||||
if (Serial.available() > 0)
|
||||
input = Serial.readStringUntil('\n');
|
||||
|
||||
input.trim();
|
||||
return input;
|
||||
}
|
||||
|
||||
void CommandLine::main(uint32_t currentTime) {
|
||||
String input = this->getSerialInput();
|
||||
|
||||
this->runCommand(input);
|
||||
|
||||
if (input != "")
|
||||
Serial.print("> ");
|
||||
}
|
||||
|
||||
LinkedList<String> CommandLine::parseCommand(String input, char* delim) {
|
||||
LinkedList<String> cmd_args;
|
||||
|
||||
if (input != "") {
|
||||
|
||||
char fancy[input.length() + 1] = {};
|
||||
input.toCharArray(fancy, input.length() + 1);
|
||||
|
||||
char* ptr = strtok(fancy, delim);
|
||||
|
||||
while (ptr != NULL) {
|
||||
cmd_args.add(String(ptr));
|
||||
|
||||
ptr = strtok(NULL, delim);
|
||||
}
|
||||
}
|
||||
|
||||
return cmd_args;
|
||||
}
|
||||
|
||||
int CommandLine::argSearch(LinkedList<String>* cmd_args_list, String key) {
|
||||
for (int i = 0; i < cmd_args_list->size(); i++) {
|
||||
if (cmd_args_list->get(i) == key)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CommandLine::checkValueExists(LinkedList<String>* cmd_args_list, int index) {
|
||||
if (index < cmd_args_list->size() - 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommandLine::inRange(int max, int index) {
|
||||
if ((index >= 0) && (index < max))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommandLine::apSelected() {
|
||||
for (int i = 0; i < access_points->size(); i++) {
|
||||
if (access_points->get(i).selected)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommandLine::hasSSIDs() {
|
||||
if (ssids->size() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CommandLine::runCommand(String input) {
|
||||
if (input != "")
|
||||
Serial.println("#" + input);
|
||||
else
|
||||
return;
|
||||
|
||||
LinkedList<String> cmd_args = this->parseCommand(input, " ");
|
||||
|
||||
//// Admin commands
|
||||
|
||||
// Help
|
||||
if (cmd_args.get(0) == HELP_CMD) {
|
||||
Serial.println(HELP_HEAD);
|
||||
Serial.println(HELP_CH_CMD);
|
||||
Serial.println(HELP_CLEARAP_CMD_A);
|
||||
Serial.println(HELP_CLEARAP_CMD_B);
|
||||
Serial.println(HELP_REBOOT_CMD);
|
||||
Serial.println(HELP_UPDATE_CMD_A);
|
||||
Serial.println(HELP_UPDATE_CMD_B);
|
||||
|
||||
// WiFi sniff/scan
|
||||
Serial.println(HELP_SCANAP_CMD);
|
||||
Serial.println(HELP_SNIFF_BEACON_CMD);
|
||||
Serial.println(HELP_SNIFF_PROBE_CMD);
|
||||
Serial.println(HELP_SNIFF_PWN_CMD);
|
||||
Serial.println(HELP_SNIFF_ESP_CMD);
|
||||
Serial.println(HELP_SNIFF_DEAUTH_CMD);
|
||||
Serial.println(HELP_SNIFF_PMKID_CMD);
|
||||
Serial.println(HELP_STOPSCAN_CMD);
|
||||
|
||||
// WiFi attack
|
||||
Serial.println(HELP_ATTACK_CMD);
|
||||
|
||||
// WiFi Aux
|
||||
Serial.println(HELP_LIST_AP_CMD_A);
|
||||
Serial.println(HELP_LIST_AP_CMD_B);
|
||||
Serial.println(HELP_SEL_CMD_A);
|
||||
Serial.println(HELP_SEL_CMD_B);
|
||||
Serial.println(HELP_SSID_CMD_A);
|
||||
Serial.println(HELP_SSID_CMD_B);
|
||||
|
||||
// Bluetooth sniff/scan
|
||||
Serial.println(HELP_BT_SNIFF_CMD);
|
||||
Serial.println(HELP_BT_SKIM_CMD);
|
||||
Serial.println(HELP_FOOT);
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop Scan
|
||||
if (cmd_args.get(0) == STOPSCAN_CMD) {
|
||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE) {
|
||||
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
|
||||
//#ifdef HAS_SCREEN
|
||||
// menu_function_obj.changeMenu(menu_function_obj.updateMenu.parentMenu);
|
||||
//#endif
|
||||
WiFi.softAPdisconnect(true);
|
||||
web_obj.shutdownServer();
|
||||
return;
|
||||
}
|
||||
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
|
||||
Serial.println("Stopping WiFi tran/recv");
|
||||
|
||||
// If we don't do this, the text and button coordinates will be off
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.init();
|
||||
menu_function_obj.changeMenu(menu_function_obj.current_menu);
|
||||
#endif
|
||||
}
|
||||
// Channel command
|
||||
else if (cmd_args.get(0) == CH_CMD) {
|
||||
// Search for channel set arg
|
||||
int ch_set = this->argSearch(&cmd_args, "-s");
|
||||
|
||||
if (cmd_args.size() == 1) {
|
||||
Serial.println("Current channel: " + (String)wifi_scan_obj.set_channel);
|
||||
}
|
||||
else if (ch_set != -1) {
|
||||
wifi_scan_obj.set_channel = cmd_args.get(ch_set + 1).toInt();
|
||||
wifi_scan_obj.changeChannel();
|
||||
Serial.println("Set channel: " + (String)wifi_scan_obj.set_channel);
|
||||
}
|
||||
}
|
||||
// Clear APs
|
||||
else if (cmd_args.get(0) == CLEARAP_CMD) {
|
||||
int ap_sw = this->argSearch(&cmd_args, "-a"); // APs
|
||||
int ss_sw = this->argSearch(&cmd_args, "-s"); // SSIDs
|
||||
|
||||
if (ap_sw != -1)
|
||||
wifi_scan_obj.RunClearAPs();
|
||||
|
||||
if (ss_sw != -1)
|
||||
wifi_scan_obj.RunClearSSIDs();
|
||||
}
|
||||
|
||||
else if (cmd_args.get(0) == REBOOT_CMD) {
|
||||
Serial.println("Rebooting...");
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
//// WiFi/Bluetooth Scan/Attack commands
|
||||
if (!wifi_scan_obj.scanning()) {
|
||||
|
||||
// AP Scan
|
||||
if (cmd_args.get(0) == SCANAP_CMD) {
|
||||
int full_sw = -1;
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
|
||||
if (full_sw == -1) {
|
||||
Serial.println("Starting AP scan. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP, TFT_MAGENTA);
|
||||
}
|
||||
else {
|
||||
Serial.println("Starting Full AP scan. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP_FULL, TFT_MAGENTA);
|
||||
}
|
||||
}
|
||||
// Beacon sniff
|
||||
else if (cmd_args.get(0) == SNIFF_BEACON_CMD) {
|
||||
Serial.println("Starting Beacon sniff. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
|
||||
}
|
||||
// Probe sniff
|
||||
else if (cmd_args.get(0) == SNIFF_PROBE_CMD) {
|
||||
Serial.println("Starting Probe sniff. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_MAGENTA);
|
||||
}
|
||||
// Deauth sniff
|
||||
else if (cmd_args.get(0) == SNIFF_DEAUTH_CMD) {
|
||||
Serial.println("Starting Deauth sniff. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);
|
||||
}
|
||||
// Pwn sniff
|
||||
else if (cmd_args.get(0) == SNIFF_PWN_CMD) {
|
||||
Serial.println("Starting Pwnagotchi sniff. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_MAGENTA);
|
||||
}
|
||||
// Espressif sniff
|
||||
else if (cmd_args.get(0) == SNIFF_ESP_CMD) {
|
||||
Serial.println("Starting Espressif device sniff. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_ESPRESSIF, TFT_MAGENTA);
|
||||
}
|
||||
// PMKID sniff
|
||||
else if (cmd_args.get(0) == SNIFF_PMKID_CMD) {
|
||||
int ch_sw = this->argSearch(&cmd_args, "-c");
|
||||
int d_sw = this->argSearch(&cmd_args, "-d"); // Deauth for pmkid
|
||||
|
||||
if (ch_sw != -1) {
|
||||
wifi_scan_obj.set_channel = cmd_args.get(ch_sw + 1).toInt();
|
||||
wifi_scan_obj.changeChannel();
|
||||
Serial.println("Set channel: " + (String)wifi_scan_obj.set_channel);
|
||||
|
||||
}
|
||||
|
||||
if (d_sw == -1) {
|
||||
Serial.println("Starting PMKID sniff on channel " + (String)wifi_scan_obj.set_channel + ". Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);
|
||||
}
|
||||
else {
|
||||
Serial.println("Starting PMKID sniff with deauthentication on channel " + (String)wifi_scan_obj.set_channel + ". Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_ACTIVE_EAPOL, TFT_VIOLET);
|
||||
}
|
||||
}
|
||||
|
||||
//// WiFi attack commands
|
||||
// attack
|
||||
if (cmd_args.get(0) == ATTACK_CMD) {
|
||||
int attack_type_switch = this->argSearch(&cmd_args, "-t"); // Required
|
||||
int list_beacon_sw = this->argSearch(&cmd_args, "-l");
|
||||
int rand_beacon_sw = this->argSearch(&cmd_args, "-r");
|
||||
int ap_beacon_sw = this->argSearch(&cmd_args, "-a");
|
||||
|
||||
if (attack_type_switch == -1) {
|
||||
Serial.println("You must specify an attack type");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
String attack_type = cmd_args.get(attack_type_switch + 1);
|
||||
|
||||
// Branch on attack type
|
||||
// Deauth
|
||||
if (attack_type == ATTACK_TYPE_DEAUTH) {
|
||||
if (!this->apSelected()) {
|
||||
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
|
||||
return;
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
Serial.println("Starting Deauthentication attack. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_DEAUTH, TFT_RED);
|
||||
}
|
||||
// Beacon
|
||||
else if (attack_type == ATTACK_TYPE_BEACON) {
|
||||
// spam by list
|
||||
if (list_beacon_sw != -1) {
|
||||
if (!this->hasSSIDs()) {
|
||||
Serial.println("You don't have any SSIDs in your list. Use " + (String)SSID_CMD);
|
||||
return;
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
Serial.println("Starting Beacon list spam. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_LIST, TFT_RED);
|
||||
}
|
||||
// spam with random
|
||||
else if (rand_beacon_sw != -1) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
Serial.println("Starting random Beacon spam. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_SPAM, TFT_ORANGE);
|
||||
}
|
||||
// Spam from AP list
|
||||
else if (ap_beacon_sw != -1) {
|
||||
if (!this->apSelected()) {
|
||||
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
|
||||
return;
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
Serial.println("Starting Targeted AP Beacon spam. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_AP_SPAM, TFT_MAGENTA);
|
||||
}
|
||||
else {
|
||||
Serial.println("You did not specify a beacon attack type");
|
||||
}
|
||||
}
|
||||
else if (attack_type == ATTACK_TYPE_PROBE) {
|
||||
if (!this->apSelected()) {
|
||||
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
|
||||
return;
|
||||
}
|
||||
Serial.println("Starting Probe spam. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_AUTH, TFT_RED);
|
||||
}
|
||||
else if (attack_type == ATTACK_TYPE_RR) {
|
||||
Serial.println("Starting Rick Roll Beacon spam. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_ATTACK_RICK_ROLL, TFT_YELLOW);
|
||||
}
|
||||
else {
|
||||
Serial.println("Attack type not properly defined");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//// Bluetooth scan/attack commands
|
||||
// Bluetooth scan
|
||||
if (cmd_args.get(0) == BT_SNIFF_CMD) {
|
||||
Serial.println("Starting Bluetooth scan. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);
|
||||
}
|
||||
// Bluetooth CC Skimmer scan
|
||||
else if (cmd_args.get(0) == BT_SKIM_CMD) {
|
||||
Serial.println("Starting Bluetooth CC Skimmer scan. Stop with " + (String)STOPSCAN_CMD);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
|
||||
}
|
||||
|
||||
// Update command
|
||||
if (cmd_args.get(0) == UPDATE_CMD) {
|
||||
int w_sw = this->argSearch(&cmd_args, "-w"); // Web update
|
||||
int sd_sw = this->argSearch(&cmd_args, "-s"); // SD Update
|
||||
|
||||
// Update via OTA
|
||||
if (w_sw != -1) {
|
||||
Serial.println("Starting Marauder OTA Update. Stop with " + (String)STOPSCAN_CMD);
|
||||
wifi_scan_obj.currentScanMode = OTA_UPDATE;
|
||||
//#ifdef HAS_SCREEN
|
||||
// menu_function_obj.changeMenu(menu_function_obj.updateMenu);
|
||||
//#endif
|
||||
web_obj.setupOTAupdate();
|
||||
}
|
||||
// Update via SD
|
||||
else if (sd_sw != -1) {
|
||||
if (!sd_obj.supported) {
|
||||
Serial.println("SD card is not connected. Cannot perform SD Update");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// WiFi aux commands
|
||||
// List access points
|
||||
if (cmd_args.get(0) == LIST_AP_CMD) {
|
||||
int ap_sw = this->argSearch(&cmd_args, "-a");
|
||||
int ss_sw = this->argSearch(&cmd_args, "-s");
|
||||
|
||||
// List APs
|
||||
if (ap_sw != -1) {
|
||||
for (int i = 0; i < access_points->size(); i++) {
|
||||
if (access_points->get(i).selected)
|
||||
Serial.println("[" + (String)i + "] " + access_points->get(i).essid + " (selected)");
|
||||
else
|
||||
Serial.println("[" + (String)i + "] " + access_points->get(i).essid);
|
||||
}
|
||||
}
|
||||
// List SSIDs
|
||||
else if (ss_sw != -1) {
|
||||
for (int i = 0; i < ssids->size(); i++) {
|
||||
if (ssids->get(i).selected)
|
||||
Serial.println("[" + (String)i + "] " + ssids->get(i).essid + " (selected)");
|
||||
else
|
||||
Serial.println("[" + (String)i + "] " + ssids->get(i).essid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Serial.println("You did not specify which list to show");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Select access points or stations
|
||||
else if (cmd_args.get(0) == SEL_CMD) {
|
||||
// Get switches
|
||||
int ap_sw = this->argSearch(&cmd_args, "-a");
|
||||
int ss_sw = this->argSearch(&cmd_args, "-s");
|
||||
|
||||
// select Access points
|
||||
if (ap_sw != -1) {
|
||||
// Get list of indices
|
||||
LinkedList<String> ap_index = this->parseCommand(cmd_args.get(ap_sw + 1), ",");
|
||||
|
||||
// Select ALL APs
|
||||
if (cmd_args.get(ap_sw + 1) == "all") {
|
||||
for (int i = 0; i < access_points->size(); i++) {
|
||||
if (access_points->get(i).selected) {
|
||||
// Unselect "selected" ap
|
||||
AccessPoint new_ap = access_points->get(i);
|
||||
new_ap.selected = false;
|
||||
access_points->set(i, new_ap);
|
||||
}
|
||||
else {
|
||||
// Select "unselected" ap
|
||||
AccessPoint new_ap = access_points->get(i);
|
||||
new_ap.selected = true;
|
||||
access_points->set(i, new_ap);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Select specific APs
|
||||
else {
|
||||
// Mark APs as selected
|
||||
for (int i = 0; i < ap_index.size(); i++) {
|
||||
int index = ap_index.get(i).toInt();
|
||||
if (!this->inRange(access_points->size(), index)) {
|
||||
Serial.println("Index not in range: " + (String)index);
|
||||
continue;
|
||||
}
|
||||
if (access_points->get(index).selected) {
|
||||
// Unselect "selected" ap
|
||||
AccessPoint new_ap = access_points->get(index);
|
||||
new_ap.selected = false;
|
||||
access_points->set(index, new_ap);
|
||||
}
|
||||
else {
|
||||
// Select "unselected" ap
|
||||
AccessPoint new_ap = access_points->get(index);
|
||||
new_ap.selected = true;
|
||||
access_points->set(index, new_ap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// select ssids
|
||||
else if (ss_sw != -1) {
|
||||
// Get list of indices
|
||||
LinkedList<String> ss_index = this->parseCommand(cmd_args.get(ss_sw + 1), ",");
|
||||
|
||||
// Mark APs as selected
|
||||
for (int i = 0; i < ss_index.size(); i++) {
|
||||
int index = ss_index.get(i).toInt();
|
||||
if (!this->inRange(ssids->size(), index)) {
|
||||
Serial.println("Index not in range: " + (String)index);
|
||||
continue;
|
||||
}
|
||||
if (ssids->get(index).selected) {
|
||||
// Unselect "selected" ap
|
||||
ssid new_ssid = ssids->get(index);
|
||||
new_ssid.selected = false;
|
||||
ssids->set(index, new_ssid);
|
||||
}
|
||||
else {
|
||||
// Select "unselected" ap
|
||||
ssid new_ssid = ssids->get(index);
|
||||
new_ssid.selected = true;
|
||||
ssids->set(index, new_ssid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Serial.println("You did not specify which list to select from");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// SSID stuff
|
||||
else if (cmd_args.get(0) == SSID_CMD) {
|
||||
int add_sw = this->argSearch(&cmd_args, "-a");
|
||||
int gen_sw = this->argSearch(&cmd_args, "-g");
|
||||
int spc_sw = this->argSearch(&cmd_args, "-n");
|
||||
int rem_sw = this->argSearch(&cmd_args, "-r");
|
||||
|
||||
// Add ssid
|
||||
if (add_sw != -1) {
|
||||
// Generate random
|
||||
if (gen_sw != -1) {
|
||||
int gen_count = cmd_args.get(gen_sw + 1).toInt();
|
||||
wifi_scan_obj.generateSSIDs(gen_count);
|
||||
}
|
||||
// Add specific
|
||||
else if (spc_sw != -1) {
|
||||
String essid = cmd_args.get(spc_sw + 1);
|
||||
wifi_scan_obj.addSSID(essid);
|
||||
}
|
||||
else {
|
||||
Serial.println("You did not specify how to add SSIDs");
|
||||
}
|
||||
}
|
||||
// Remove SSID
|
||||
else if (rem_sw != -1) {
|
||||
int index = cmd_args.get(rem_sw + 1).toInt();
|
||||
if (!this->inRange(ssids->size(), index)) {
|
||||
Serial.println("Index not in range: " + (String)index);
|
||||
return;
|
||||
}
|
||||
ssids->remove(index);
|
||||
}
|
||||
else {
|
||||
Serial.println("You did not specify whether to add or remove SSIDs");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
145
esp32_marauder/CommandLine.h
Normal file
145
esp32_marauder/CommandLine.h
Normal file
@@ -0,0 +1,145 @@
|
||||
#ifndef CommandLine_h
|
||||
#define CommandLine_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "MenuFunctions.h"
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include "WiFiScan.h"
|
||||
#include "Web.h"
|
||||
#include "SDInterface.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern MenuFunctions menu_function_obj;
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
extern Web web_obj;
|
||||
extern SDInterface sd_obj;
|
||||
extern LinkedList<AccessPoint>* access_points;
|
||||
extern LinkedList<ssid>* ssids;
|
||||
extern const String PROGMEM version_number;
|
||||
|
||||
//// Commands
|
||||
|
||||
// Admin
|
||||
const char PROGMEM CH_CMD[] = "channel";
|
||||
const char PROGMEM CLEARAP_CMD[] = "clearlist";
|
||||
const char PROGMEM REBOOT_CMD[] = "reboot";
|
||||
const char PROGMEM UPDATE_CMD[] = "update";
|
||||
const char PROGMEM HELP_CMD[] = "help";
|
||||
|
||||
// WiFi sniff/scan
|
||||
const char PROGMEM SCANAP_CMD[] = "scanap";
|
||||
const char PROGMEM SNIFF_BEACON_CMD[] = "sniffbeacon";
|
||||
const char PROGMEM SNIFF_PROBE_CMD[] = "sniffprobe";
|
||||
const char PROGMEM SNIFF_PWN_CMD[] = "sniffpwn";
|
||||
const char PROGMEM SNIFF_ESP_CMD[] = "sniffesp";
|
||||
const char PROGMEM SNIFF_DEAUTH_CMD[] = "sniffdeauth";
|
||||
const char PROGMEM SNIFF_PMKID_CMD[] = "sniffpmkid";
|
||||
const char PROGMEM STOPSCAN_CMD[] = "stopscan";
|
||||
|
||||
// WiFi attack
|
||||
const char PROGMEM ATTACK_CMD[] = "attack";
|
||||
const char PROGMEM ATTACK_TYPE_DEAUTH[] = "deauth";
|
||||
const char PROGMEM ATTACK_TYPE_BEACON[] = "beacon";
|
||||
const char PROGMEM ATTACK_TYPE_PROBE[] = "probe";
|
||||
const char PROGMEM ATTACK_TYPE_RR[] = "rickroll";
|
||||
|
||||
// WiFi Aux
|
||||
const char PROGMEM LIST_AP_CMD[] = "list";
|
||||
const char PROGMEM SEL_CMD[] = "select";
|
||||
const char PROGMEM SSID_CMD[] = "ssid";
|
||||
|
||||
// Bluetooth sniff/scan
|
||||
const char PROGMEM BT_SNIFF_CMD[] = "sniffbt";
|
||||
const char PROGMEM BT_SKIM_CMD[] = "sniffskim";
|
||||
|
||||
|
||||
//// Command help messages
|
||||
// Admin
|
||||
const char PROGMEM HELP_HEAD[] = "============ Commands ============";
|
||||
const char PROGMEM HELP_CH_CMD[] = "channel [-s <channel>]";
|
||||
const char PROGMEM HELP_CLEARAP_CMD_A[] = "clearlist -a";
|
||||
const char PROGMEM HELP_CLEARAP_CMD_B[] = "clearlist -s";
|
||||
const char PROGMEM HELP_REBOOT_CMD[] = "reboot";
|
||||
const char PROGMEM HELP_UPDATE_CMD_A[] = "update -s";
|
||||
const char PROGMEM HELP_UPDATE_CMD_B[] = "update -w";
|
||||
|
||||
// WiFi sniff/scan
|
||||
const char PROGMEM HELP_SCANAP_CMD[] = "scanap";
|
||||
const char PROGMEM HELP_SNIFF_BEACON_CMD[] = "sniffbeacon";
|
||||
const char PROGMEM HELP_SNIFF_PROBE_CMD[] = "sniffprobe";
|
||||
const char PROGMEM HELP_SNIFF_PWN_CMD[] = "sniffpwn";
|
||||
const char PROGMEM HELP_SNIFF_ESP_CMD[] = "sniffesp";
|
||||
const char PROGMEM HELP_SNIFF_DEAUTH_CMD[] = "sniffdeauth";
|
||||
const char PROGMEM HELP_SNIFF_PMKID_CMD[] = "sniffpmkid [-c <channel>]";
|
||||
const char PROGMEM HELP_STOPSCAN_CMD[] = "stopscan";
|
||||
|
||||
// WiFi attack
|
||||
const char PROGMEM HELP_ATTACK_CMD[] = "attack -t <beacon [-l/-r/-a]/deauth/probe/rickroll>";
|
||||
|
||||
// WiFi Aux
|
||||
const char PROGMEM HELP_LIST_AP_CMD_A[] = "list -s";
|
||||
const char PROGMEM HELP_LIST_AP_CMD_B[] = "list -a";
|
||||
const char PROGMEM HELP_SEL_CMD_A[] = "select -a <index (comma separated)>";
|
||||
const char PROGMEM HELP_SEL_CMD_B[] = "select -s <index (comma separated)>";
|
||||
const char PROGMEM HELP_SSID_CMD_A[] = "ssid -a [-g <count>/-n <name>]";
|
||||
const char PROGMEM HELP_SSID_CMD_B[] = "ssid -r <index>";
|
||||
|
||||
// Bluetooth sniff/scan
|
||||
const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt";
|
||||
const char PROGMEM HELP_BT_SKIM_CMD[] = "sniffskim";
|
||||
const char PROGMEM HELP_FOOT[] = "==================================";
|
||||
|
||||
|
||||
class CommandLine {
|
||||
private:
|
||||
String getSerialInput();
|
||||
LinkedList<String> parseCommand(String input, char* delim);
|
||||
void runCommand(String input);
|
||||
bool checkValueExists(LinkedList<String>* cmd_args_list, int index);
|
||||
bool inRange(int max, int index);
|
||||
bool apSelected();
|
||||
bool hasSSIDs();
|
||||
int argSearch(LinkedList<String>* cmd_args, String key);
|
||||
|
||||
const char* ascii_art =
|
||||
"\r\n"
|
||||
" @@@@@@ \r\n"
|
||||
" @@@@@@@@ \r\n"
|
||||
" @@@@@@@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@@ @@@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@@ @@@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
"@@@@@@@ @@@@@@@@@@@@@@@@ \r\n"
|
||||
"@@@@@ @@@@@@@@@@@@@@@ \r\n"
|
||||
"@@@@@ @@@@@@@ \r\n"
|
||||
"@@@@@ @@@@@@ \r\n"
|
||||
"@@@@@@ @@@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@@@@@@@\r\n"
|
||||
" @@@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@ @@@@@@ \r\n"
|
||||
" @@@@@@@@@ \r\n"
|
||||
" @@@@@@ \r\n"
|
||||
" @@@@ \r\n"
|
||||
"\r\n";
|
||||
|
||||
public:
|
||||
CommandLine();
|
||||
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,7 @@
|
||||
#include "Display.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
|
||||
/*
|
||||
Big thanks to bodmer for having great TFT and JPEG libraries
|
||||
|
||||
https://github.com/bodmer
|
||||
*/
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
Display::Display()
|
||||
{
|
||||
@@ -18,39 +14,66 @@ void Display::RunSetup()
|
||||
|
||||
// Need to declare new
|
||||
display_buffer = new LinkedList<String>();
|
||||
|
||||
#ifdef SCREEN_BUFFER
|
||||
screen_buffer = new LinkedList<String>();
|
||||
#endif
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(0); // Portrait
|
||||
|
||||
tft.setCursor(0, 0);
|
||||
//tft.setFreeFont(&FreeMonoBold9pt7b);
|
||||
|
||||
// Calibration data
|
||||
//uint16_t calData[5] = { 390, 3516, 253, 3520, 7 }; tft.setRotation(1); // Portrait
|
||||
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait
|
||||
tft.setTouch(calData);
|
||||
#ifndef MARAUDER_MINI
|
||||
|
||||
#ifdef TFT_SHIELD
|
||||
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait with TFT Shield
|
||||
//Serial.println(F("Using TFT Shield"));
|
||||
#else if defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
||||
//Serial.println(F("Using TFT DIY"));
|
||||
#endif
|
||||
tft.setTouch(calData);
|
||||
|
||||
#endif
|
||||
|
||||
//tft.fillScreen(TFT_BLACK);
|
||||
clearScreen();
|
||||
|
||||
|
||||
// Initialize file system
|
||||
// This should probably have its own class
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println("SPIFFS initialisation failed!");
|
||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||
}
|
||||
//Serial.println("SPI_FREQUENCY: " + (String)SPI_FREQUENCY);
|
||||
//Serial.println("SPI_READ_FREQUENCY:" + (String)SPI_READ_FREQUENCY);
|
||||
//Serial.println("SPI_TOUCH_FREQUENCY: " + (String)SPI_TOUCH_FREQUENCY);
|
||||
|
||||
#ifdef KIT
|
||||
pinMode(KIT_LED_BUILTIN, OUTPUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw the title screen
|
||||
drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
void Display::drawFrame()
|
||||
{
|
||||
tft.drawRect(FRAME_X, FRAME_Y, FRAME_W, FRAME_H, TFT_BLACK);
|
||||
}
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
tft.drawCentreString(version_number, 120, 250, 2);
|
||||
void Display::tftDrawRedOnOffButton() {
|
||||
tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, TFT_RED);
|
||||
tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, TFT_DARKGREY);
|
||||
drawFrame();
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString(text03, GREENBUTTON_X + (GREENBUTTON_W / 2), GREENBUTTON_Y + (GREENBUTTON_H / 2));
|
||||
this->SwitchOn = false;
|
||||
}
|
||||
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
|
||||
delay(5000);
|
||||
void Display::tftDrawGreenOnOffButton() {
|
||||
tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, TFT_GREEN);
|
||||
tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, TFT_DARKGREY);
|
||||
drawFrame();
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString(text04, REDBUTTON_X + (REDBUTTON_W / 2) + 1, REDBUTTON_Y + (REDBUTTON_H / 2));
|
||||
this->SwitchOn = true;
|
||||
}
|
||||
|
||||
void Display::tftDrawGraphObjects(byte x_scale)
|
||||
@@ -66,6 +89,13 @@ void Display::tftDrawGraphObjects(byte x_scale)
|
||||
tft.setCursor(3, 228); tft.print("0"); // "-" at bottom of y axis
|
||||
}
|
||||
|
||||
void Display::tftDrawEapolColorKey()
|
||||
{
|
||||
//Display color key
|
||||
tft.setTextSize(1); tft.setTextColor(TFT_WHITE);
|
||||
tft.fillRect(14, 0, 15, 8, TFT_CYAN); tft.setCursor(30, 0); tft.print(" - EAPOL");
|
||||
}
|
||||
|
||||
void Display::tftDrawColorKey()
|
||||
{
|
||||
//Display color key
|
||||
@@ -144,7 +174,7 @@ void Display::tftDrawYScaleButtons(byte y_scale)
|
||||
void Display::tftDrawChannelScaleButtons(int set_channel)
|
||||
{
|
||||
tft.drawFastVLine(178, 0, 20, TFT_WHITE);
|
||||
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Channel:"); tft.print(set_channel);
|
||||
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print(text10); tft.print(set_channel);
|
||||
|
||||
key[4].initButton(&tft, // channel - box
|
||||
164,
|
||||
@@ -213,42 +243,70 @@ void Display::twoPartDisplay(String center_text)
|
||||
void Display::touchToExit()
|
||||
{
|
||||
tft.setTextColor(TFT_BLACK, TFT_LIGHTGREY);
|
||||
tft.fillRect(0,16,HEIGHT_1,16, TFT_LIGHTGREY);
|
||||
tft.drawCentreString("Touch screen to exit",120,16,2);
|
||||
tft.fillRect(0,32,HEIGHT_1,16, TFT_LIGHTGREY);
|
||||
tft.drawCentreString(text11,120,32,2);
|
||||
}
|
||||
|
||||
|
||||
// Function to just draw the screen black
|
||||
void Display::clearScreen()
|
||||
{
|
||||
Serial.println("clearScreen()");
|
||||
//Serial.println(F("clearScreen()"));
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(0, 0);
|
||||
}
|
||||
|
||||
#ifdef SCREEN_BUFFER
|
||||
void Display::scrollScreenBuffer(bool down) {
|
||||
// Scroll screen normal direction (Up)
|
||||
if (!down) {
|
||||
this->screen_buffer->shift();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Display::displayBuffer(bool do_clear)
|
||||
{
|
||||
if (this->display_buffer->size() > 0)
|
||||
{
|
||||
delay(1);
|
||||
|
||||
|
||||
while (display_buffer->size() > 0)
|
||||
{
|
||||
xPos = 0;
|
||||
if ((display_buffer->size() > 0) && (!loading))
|
||||
{
|
||||
printing = true;
|
||||
delay(print_delay_1);
|
||||
yDraw = scroll_line(TFT_RED);
|
||||
tft.setCursor(xPos, yDraw);
|
||||
tft.print(display_buffer->shift());
|
||||
printing = false;
|
||||
delay(print_delay_2);
|
||||
}
|
||||
if (!tteBar)
|
||||
blank[(18+(yStart - TOP_FIXED_AREA) / TEXT_HEIGHT)%19] = xPos;
|
||||
else
|
||||
blank[(18+(yStart - TOP_FIXED_AREA_2) / TEXT_HEIGHT)%19] = xPos;
|
||||
|
||||
#ifndef SCREEN_BUFFER
|
||||
xPos = 0;
|
||||
if ((display_buffer->size() > 0) && (!loading))
|
||||
{
|
||||
printing = true;
|
||||
delay(print_delay_1);
|
||||
yDraw = scroll_line(TFT_RED);
|
||||
tft.setCursor(xPos, yDraw);
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.print(display_buffer->shift());
|
||||
printing = false;
|
||||
delay(print_delay_2);
|
||||
}
|
||||
if (!tteBar)
|
||||
blank[(18+(yStart - TOP_FIXED_AREA) / TEXT_HEIGHT)%19] = xPos;
|
||||
else
|
||||
blank[(18+(yStart - TOP_FIXED_AREA_2) / TEXT_HEIGHT)%19] = xPos;
|
||||
#else
|
||||
xPos = 0;
|
||||
if (this->screen_buffer->size() >= MAX_SCREEN_BUFFER)
|
||||
this->scrollScreenBuffer();
|
||||
|
||||
screen_buffer->add(display_buffer->shift());
|
||||
|
||||
for (int i = 0; i < this->screen_buffer->size(); i++) {
|
||||
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
|
||||
for (int x = 0; x < TFT_WIDTH / CHAR_WIDTH; x++)
|
||||
tft.print(" ");
|
||||
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.print(this->screen_buffer->get(i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,7 +320,7 @@ void Display::showCenterText(String text, int y)
|
||||
|
||||
void Display::initScrollValues(bool tte)
|
||||
{
|
||||
Serial.println("initScrollValues()");
|
||||
//Serial.println(F("initScrollValues()"));
|
||||
yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||
|
||||
xPos = 0;
|
||||
@@ -280,7 +338,7 @@ void Display::initScrollValues(bool tte)
|
||||
yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 18; i++) blank[i] = 0;
|
||||
for(uint8_t i = 0; i < 18; i++) blank[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -318,21 +376,28 @@ int Display::scroll_line(uint32_t color) {
|
||||
|
||||
// Function to setup hardware scroll for TFT screen
|
||||
void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
|
||||
Serial.println("setupScrollAread()");
|
||||
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
|
||||
tft.writedata(tfa >> 8); // Top Fixed Area line count
|
||||
tft.writedata(tfa);
|
||||
tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
|
||||
tft.writedata(YMAX-tfa-bfa);
|
||||
tft.writedata(bfa >> 8); // Bottom Fixed Area line count
|
||||
tft.writedata(bfa);
|
||||
//Serial.println(F("setupScrollArea()"));
|
||||
//Serial.println(" tfa: " + (String)tfa);
|
||||
//Serial.println(" bfa: " + (String)bfa);
|
||||
//Serial.println("yStart: " + (String)this->yStart);
|
||||
#ifndef MARAUDER_MINI
|
||||
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
|
||||
tft.writedata(tfa >> 8); // Top Fixed Area line count
|
||||
tft.writedata(tfa);
|
||||
tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
|
||||
tft.writedata(YMAX-tfa-bfa);
|
||||
tft.writedata(bfa >> 8); // Bottom Fixed Area line count
|
||||
tft.writedata(bfa);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Display::scrollAddress(uint16_t vsp) {
|
||||
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling pointer
|
||||
tft.writedata(vsp>>8);
|
||||
tft.writedata(vsp);
|
||||
#ifndef MARAUDER_MINI
|
||||
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling pointer
|
||||
tft.writedata(vsp>>8);
|
||||
tft.writedata(vsp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -342,18 +407,21 @@ void Display::scrollAddress(uint16_t vsp) {
|
||||
void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
||||
|
||||
// Open the named file (the Jpeg decoder library will close it after rendering image)
|
||||
fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
|
||||
//fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
|
||||
|
||||
//jpegFile.close();
|
||||
|
||||
//ESP32 always seems to return 1 for jpegFile so this null trap does not work
|
||||
if ( !jpegFile ) {
|
||||
Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
|
||||
return;
|
||||
}
|
||||
//if ( !jpegFile ) {
|
||||
// Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
// Use one of the three following methods to initialise the decoder,
|
||||
// the filename can be a String or character array type:
|
||||
|
||||
boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
|
||||
//boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
|
||||
boolean decoded = JpegDec.decodeArray(MarauderTitle, 13578);
|
||||
|
||||
if (decoded) {
|
||||
// print information about the image to the serial port
|
||||
@@ -362,11 +430,20 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
||||
// render the image onto the screen at given coordinates
|
||||
jpegRender(xpos, ypos);
|
||||
}
|
||||
else {
|
||||
Serial.println("Jpeg file format not supported!");
|
||||
}
|
||||
//else {
|
||||
// Serial.println(F("Jpeg file format not supported!"));
|
||||
//}
|
||||
}
|
||||
|
||||
void Display::setupDraw() {
|
||||
this->tft.drawLine(0, 0, 10, 0, TFT_MAGENTA);
|
||||
this->tft.drawLine(0, 0, 0, 10, TFT_GREEN);
|
||||
this->tft.drawLine(0, 0, 0, 0, TFT_CYAN);
|
||||
}
|
||||
|
||||
uint16_t xlast;
|
||||
uint16_t ylast;
|
||||
uint32_t AH;
|
||||
void Display::drawStylus()
|
||||
{
|
||||
uint16_t x = 0, y = 0; // To store the touch coordinates
|
||||
@@ -374,13 +451,61 @@ void Display::drawStylus()
|
||||
// Pressed will be set true is there is a valid touch on the screen
|
||||
boolean pressed = tft.getTouch(&x, &y);
|
||||
|
||||
if ((x <= 10) && (y <= 10) && (pressed)) {
|
||||
//Serial.println(F("Exit draw function"));
|
||||
this->draw_tft = false;
|
||||
this->exit_draw = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw a white spot at the detected coordinates
|
||||
if (pressed) {
|
||||
tft.fillCircle(x, y, 2, TFT_WHITE);
|
||||
// tft.fillCircle(x, y, 2, TFT_WHITE);
|
||||
if ( xlast > 0 && ylast > 0 ) {
|
||||
uint16_t the_color = TFT_WHITE;
|
||||
uint16_t wd = 1;
|
||||
int xlast2;
|
||||
int ylast2;
|
||||
int x2;
|
||||
int y2;
|
||||
int n;
|
||||
int n2 = -wd;
|
||||
xlast2 = xlast - wd;
|
||||
x2 = x - wd;
|
||||
for (n = -wd; n <= wd; n++) {
|
||||
ylast2 = ylast + n;
|
||||
y2 = y + n;
|
||||
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||
}
|
||||
for (n2 = -wd; n2 <= wd; n2++) {
|
||||
xlast2 = xlast + n2;
|
||||
x2 = x + n2;
|
||||
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||
}
|
||||
for (n = wd; n >= -wd; n--) {
|
||||
ylast2 = ylast + n;
|
||||
y2 = y + n;
|
||||
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||
}
|
||||
for (n2 = wd; n2 >= -wd; n2--) {
|
||||
xlast2 = xlast + n2;
|
||||
x2 = x + n2;
|
||||
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||
}
|
||||
// tft.drawLine(xlast, ylast, x, y, TFT_WHITE);
|
||||
}
|
||||
xlast = x;
|
||||
ylast = y;
|
||||
AH = 0;
|
||||
//Serial.print("x,y = ");
|
||||
//Serial.print(x);
|
||||
//Serial.print(",");
|
||||
//Serial.println(y);
|
||||
} else if ( AH < 5 ) {
|
||||
AH++;
|
||||
} else if ( AH == 5 ) {
|
||||
xlast = 0;
|
||||
ylast = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,16 +619,16 @@ void createArray(const char *filename) {
|
||||
uint8_t data;
|
||||
byte line_len = 0;
|
||||
Serial.println("");
|
||||
Serial.println("// Generated by a JPEGDecoder library example sketch:");
|
||||
Serial.println("// https://github.com/Bodmer/JPEGDecoder");
|
||||
Serial.println(F("// Generated by a JPEGDecoder library example sketch:"));
|
||||
Serial.println(F("// https://github.com/Bodmer/JPEGDecoder"));
|
||||
Serial.println("");
|
||||
Serial.println("#if defined(__AVR__)");
|
||||
Serial.println(" #include <avr/pgmspace.h>");
|
||||
Serial.println("#endif");
|
||||
Serial.println(F("#if defined(__AVR__)"));
|
||||
Serial.println(F(" #include <avr/pgmspace.h>"));
|
||||
Serial.println(F("#endif"));
|
||||
Serial.println("");
|
||||
Serial.print ("const uint8_t ");
|
||||
Serial.print (F("const uint8_t "));
|
||||
while (*filename != '.') Serial.print(*filename++);
|
||||
Serial.println("[] PROGMEM = {"); // PROGMEM added for AVR processors, it is ignored by Due
|
||||
Serial.println(F("[] PROGMEM = {")); // PROGMEM added for AVR processors, it is ignored by Due
|
||||
|
||||
while ( jpgFile.available()) {
|
||||
|
||||
@@ -529,13 +654,13 @@ void createArray(const char *filename) {
|
||||
#ifdef ESP8266
|
||||
void Display::listFiles(void) {
|
||||
Serial.println();
|
||||
Serial.println("SPIFFS files found:");
|
||||
Serial.println(F("SPIFFS files found:"));
|
||||
|
||||
fs::Dir dir = SPIFFS.openDir("/"); // Root directory
|
||||
String line = "=====================================";
|
||||
|
||||
Serial.println(line);
|
||||
Serial.println(" File name Size");
|
||||
Serial.println(F(" File name Size"));
|
||||
Serial.println(line);
|
||||
|
||||
while (dir.next()) {
|
||||
@@ -568,22 +693,22 @@ void Display::listFiles(void) {
|
||||
void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
|
||||
|
||||
Serial.println();
|
||||
Serial.println("SPIFFS files found:");
|
||||
Serial.println(F("SPIFFS files found:"));
|
||||
|
||||
Serial.printf("Listing directory: %s\n", "/");
|
||||
String line = "=====================================";
|
||||
|
||||
Serial.println(line);
|
||||
Serial.println(" File name Size");
|
||||
Serial.println(F(" File name Size"));
|
||||
Serial.println(line);
|
||||
|
||||
fs::File root = fs.open(dirname);
|
||||
if (!root) {
|
||||
Serial.println("Failed to open directory");
|
||||
Serial.println(F("Failed to open directory"));
|
||||
return;
|
||||
}
|
||||
if (!root.isDirectory()) {
|
||||
Serial.println("Not a directory");
|
||||
Serial.println(F("Not a directory"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -628,12 +753,12 @@ void Display::updateBanner(String msg)
|
||||
|
||||
this->buildBanner(msg, current_banner_pos);
|
||||
|
||||
this->img.pushSprite(0, 0);
|
||||
this->img.pushSprite(0, STATUS_BAR_WIDTH);
|
||||
|
||||
current_banner_pos--;
|
||||
|
||||
if (current_banner_pos <= 0)
|
||||
current_banner_pos = SCREEN_WIDTH;
|
||||
current_banner_pos = SCREEN_WIDTH + 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -651,7 +776,7 @@ void Display::buildBanner(String msg, int xpos)
|
||||
//img.fillCircle(SCREEN_WIDTH / 2, TEXT_HEIGHT / 2, 10, TFT_ORANGE);
|
||||
|
||||
// Now print text on top of the graphics
|
||||
img.setTextSize(2); // Font size scaling is x1
|
||||
img.setTextSize(BANNER_TEXT_SIZE); // Font size scaling is x1
|
||||
img.setTextFont(0); // Font 4 selected
|
||||
img.setTextColor(TFT_WHITE); // Black text, no background colour
|
||||
img.setTextWrap(false); // Turn of wrap so we can print past end of sprite
|
||||
@@ -664,8 +789,13 @@ void Display::buildBanner(String msg, int xpos)
|
||||
img.print(msg);
|
||||
}
|
||||
|
||||
void Display::main()
|
||||
void Display::main(uint8_t scan_mode)
|
||||
{
|
||||
if ((scan_mode == LV_JOIN_WIFI) ||
|
||||
(scan_mode == LV_ADD_SSID))
|
||||
lv_task_handler();
|
||||
return;
|
||||
}
|
||||
// End SPIFFS_functions
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,119 +1,165 @@
|
||||
#ifndef Display_h
|
||||
#define Display_h
|
||||
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <JPEGDecoder.h>
|
||||
//#include <SimpleList.h>
|
||||
#include <LinkedList.h>
|
||||
#include <SPI.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
#define HEIGHT_1 240
|
||||
#define WIDTH_1 320
|
||||
#define STANDARD_FONT_CHAR_LIMIT 40 // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 16 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 7
|
||||
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
|
||||
bool run_setup = true;
|
||||
|
||||
// For the byte we read from the serial port
|
||||
byte data = 0;
|
||||
|
||||
// A few test variables used during debugging
|
||||
boolean change_colour = 1;
|
||||
boolean selected = 1;
|
||||
|
||||
//void addNodes(Menu* menu, String name, Menu* child, std::function<void()> callable);
|
||||
//void changeMenu(Menu* menu);
|
||||
//void showMenuList(Menu* menu, int layer);
|
||||
|
||||
public:
|
||||
Display();
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
String version_number = "v0.4.5";
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
bool tteBar = false;
|
||||
bool draw_tft = false;
|
||||
|
||||
int TOP_FIXED_AREA_2 = 32;
|
||||
int print_delay_1, print_delay_2 = 10;
|
||||
int current_banner_pos = SCREEN_WIDTH;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
//Menu mainMenu;
|
||||
//Menu wifiMenu;
|
||||
//Menu bluetoothMenu;
|
||||
|
||||
LinkedList<String>* display_buffer;
|
||||
|
||||
// The initial y coordinate of the top of the bottom text line
|
||||
uint16_t yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||
|
||||
// Keep track of the drawing x coordinate
|
||||
uint16_t xPos = 0;
|
||||
|
||||
// The initial y coordinate of the top of the scrolling area
|
||||
uint16_t yStart = TOP_FIXED_AREA;
|
||||
// yArea must be a integral multiple of TEXT_HEIGHT
|
||||
uint16_t yArea = YMAX - TOP_FIXED_AREA - BOT_FIXED_AREA;
|
||||
|
||||
// We have to blank the top line each time the display is scrolled, but this takes up to 13 milliseconds
|
||||
// for a full width line, meanwhile the serial buffer may be filling... and overflowing
|
||||
// We can speed up scrolling of short text lines by just blanking the character we drew
|
||||
int blank[19]; // We keep all the strings pixel lengths to optimise the speed of the top line blanking
|
||||
|
||||
void tftDrawGraphObjects(byte x_scale);
|
||||
void tftDrawColorKey();
|
||||
void tftDrawXScaleButtons(byte x_scale);
|
||||
void tftDrawYScaleButtons(byte y_scale);
|
||||
void tftDrawChannelScaleButtons(int set_channel);
|
||||
void tftDrawExitScaleButtons();
|
||||
void buildBanner(String msg, int xpos);
|
||||
void clearScreen();
|
||||
void displayBuffer(bool do_clear = false);
|
||||
void drawJpeg(const char *filename, int xpos, int ypos);
|
||||
void drawStylus();
|
||||
void getTouchWhileFunction(bool pressed);
|
||||
void initScrollValues(bool tte = false);
|
||||
void jpegInfo();
|
||||
void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void main();
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
int scroll_line(uint32_t color);
|
||||
void setupScrollArea(uint16_t tfa, uint16_t bfa);
|
||||
void showCenterText(String text, int y);
|
||||
void touchToExit();
|
||||
void twoPartDisplay(String center_text);
|
||||
void updateBanner(String msg);
|
||||
};
|
||||
#endif
|
||||
#ifndef Display_h
|
||||
#define Display_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <JPEGDecoder.h>
|
||||
//#include <SimpleList.h>
|
||||
#include <LinkedList.h>
|
||||
#include <SPI.h>
|
||||
#include <lvgl.h>
|
||||
#include <Ticker.h>
|
||||
//#include <M5Stack.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
// WiFi stuff
|
||||
#define OTA_UPDATE 100
|
||||
#define SHOW_INFO 101
|
||||
#define WIFI_SCAN_OFF 0
|
||||
#define WIFI_SCAN_PROBE 1
|
||||
#define WIFI_SCAN_AP 2
|
||||
#define WIFI_SCAN_PWN 3
|
||||
#define WIFI_SCAN_EAPOL 4
|
||||
#define WIFI_SCAN_DEAUTH 5
|
||||
#define WIFI_SCAN_ALL 6
|
||||
#define WIFI_PACKET_MONITOR 7
|
||||
#define WIFI_ATTACK_BEACON_SPAM 8
|
||||
#define WIFI_ATTACK_RICK_ROLL 9
|
||||
#define BT_SCAN_ALL 10
|
||||
#define BT_SCAN_SKIMMERS 11
|
||||
#define WIFI_SCAN_ESPRESSIF 12
|
||||
#define LV_JOIN_WIFI 13
|
||||
#define LV_ADD_SSID 14
|
||||
#define WIFI_ATTACK_BEACON_LIST 15
|
||||
|
||||
/*
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
*/
|
||||
|
||||
// #define KIT
|
||||
// #define TFT_DIY
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
bool SwitchOn = false;
|
||||
|
||||
bool run_setup = true;
|
||||
|
||||
// For the byte we read from the serial port
|
||||
byte data = 0;
|
||||
|
||||
// A few test variables used during debugging
|
||||
boolean change_colour = 1;
|
||||
boolean selected = 1;
|
||||
|
||||
void drawFrame();
|
||||
|
||||
#ifdef SCREEN_BUFFER
|
||||
void scrollScreenBuffer(bool down = false);
|
||||
#endif
|
||||
|
||||
//void addNodes(Menu* menu, String name, Menu* child, std::function<void()> callable);
|
||||
//void changeMenu(Menu* menu);
|
||||
//void showMenuList(Menu* menu, int layer);
|
||||
//static void lv_tick_handler();
|
||||
|
||||
public:
|
||||
Display();
|
||||
//Ticker tick;
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
const String PROGMEM version_number = MARAUDER_VERSION;
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
bool tteBar = false;
|
||||
bool draw_tft = false;
|
||||
bool exit_draw = false;
|
||||
|
||||
int TOP_FIXED_AREA_2 = 48;
|
||||
int print_delay_1, print_delay_2 = 10;
|
||||
int current_banner_pos = SCREEN_WIDTH;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
//Menu mainMenu;
|
||||
//Menu wifiMenu;
|
||||
//Menu bluetoothMenu;
|
||||
|
||||
LinkedList<String>* display_buffer;
|
||||
|
||||
#ifdef SCREEN_BUFFER
|
||||
LinkedList<String>* screen_buffer;
|
||||
#endif
|
||||
|
||||
// The initial y coordinate of the top of the bottom text line
|
||||
uint16_t yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||
|
||||
// Keep track of the drawing x coordinate
|
||||
uint16_t xPos = 0;
|
||||
|
||||
// The initial y coordinate of the top of the scrolling area
|
||||
uint16_t yStart = TOP_FIXED_AREA_2;
|
||||
// yArea must be a integral multiple of TEXT_HEIGHT
|
||||
uint16_t yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
||||
|
||||
// We have to blank the top line each time the display is scrolled, but this takes up to 13 milliseconds
|
||||
// for a full width line, meanwhile the serial buffer may be filling... and overflowing
|
||||
// We can speed up scrolling of short text lines by just blanking the character we drew
|
||||
int blank[19]; // We keep all the strings pixel lengths to optimise the speed of the top line blanking
|
||||
|
||||
//void initLVGL();
|
||||
//void deinitLVGL();
|
||||
//void joinWiFiGFX();
|
||||
void tftDrawRedOnOffButton();
|
||||
void tftDrawGreenOnOffButton();
|
||||
void tftDrawGraphObjects(byte x_scale);
|
||||
void tftDrawEapolColorKey();
|
||||
void tftDrawColorKey();
|
||||
void tftDrawXScaleButtons(byte x_scale);
|
||||
void tftDrawYScaleButtons(byte y_scale);
|
||||
void tftDrawChannelScaleButtons(int set_channel);
|
||||
void tftDrawExitScaleButtons();
|
||||
void buildBanner(String msg, int xpos);
|
||||
void clearScreen();
|
||||
void displayBuffer(bool do_clear = false);
|
||||
void drawJpeg(const char *filename, int xpos, int ypos);
|
||||
void setupDraw();
|
||||
void drawStylus();
|
||||
void getTouchWhileFunction(bool pressed);
|
||||
void initScrollValues(bool tte = false);
|
||||
void jpegInfo();
|
||||
void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void main(uint8_t scan_mode);
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
int scroll_line(uint32_t color);
|
||||
void setupScrollArea(uint16_t tfa, uint16_t bfa);
|
||||
void showCenterText(String text, int y);
|
||||
void touchToExit();
|
||||
void twoPartDisplay(String center_text);
|
||||
void updateBanner(String msg);
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
42
esp32_marauder/LedInterface.cpp
Normal file
42
esp32_marauder/LedInterface.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "LedInterface.h"
|
||||
|
||||
LedInterface::LedInterface() {
|
||||
|
||||
}
|
||||
|
||||
void LedInterface::RunSetup() {
|
||||
//Serial.println("Setting neopixel to black...");
|
||||
strip.setBrightness(0);
|
||||
strip.begin();
|
||||
strip.setPixelColor(0, strip.Color(0, 0, 0));
|
||||
strip.show();
|
||||
delay(100);
|
||||
strip.setBrightness(50);
|
||||
strip.setPixelColor(0, strip.Color(0, 0, 0));
|
||||
strip.show();
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void LedInterface::main(uint32_t currentTime) {
|
||||
strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256));
|
||||
strip.show();
|
||||
|
||||
this->current_fade_itter++;
|
||||
|
||||
this->wheel_pos = this->wheel_pos - this->wheel_speed;
|
||||
if (this->wheel_pos < 0)
|
||||
this->wheel_pos = 255;
|
||||
};
|
||||
|
||||
uint32_t LedInterface::Wheel(byte WheelPos) {
|
||||
WheelPos = 255 - WheelPos;
|
||||
if(WheelPos < 85) {
|
||||
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
|
||||
}
|
||||
if(WheelPos < 170) {
|
||||
WheelPos -= 85;
|
||||
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
|
||||
}
|
||||
WheelPos -= 170;
|
||||
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
|
||||
}
|
||||
31
esp32_marauder/LedInterface.h
Normal file
31
esp32_marauder/LedInterface.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef LedInterface_h
|
||||
#define LedInterface_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
#define PIN 25
|
||||
#define Pixels 1
|
||||
|
||||
extern Adafruit_NeoPixel strip;
|
||||
|
||||
class LedInterface {
|
||||
|
||||
private:
|
||||
uint32_t initTime = 0;
|
||||
|
||||
int current_fade_itter = 1;
|
||||
int wheel_pos = 255;
|
||||
int wheel_speed = 1; // lower = slower
|
||||
|
||||
uint32_t Wheel(byte WheelPos);
|
||||
|
||||
public:
|
||||
LedInterface();
|
||||
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,119 +1,221 @@
|
||||
#ifndef MenuFunctions_h
|
||||
#define MenuFunctions_h
|
||||
|
||||
#include "WiFiScan.h"
|
||||
#include "Display.h"
|
||||
#include "Web.h"
|
||||
|
||||
extern Display display_obj;
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
extern Web web_obj;
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
|
||||
#define FLASH_BUTTON 0
|
||||
|
||||
// Icon definitions
|
||||
#define ATTACKS 0
|
||||
#define BEACON_SNIFF 1
|
||||
#define BLUETOOTH 2
|
||||
#define BLUETOOTH_SNIFF 3
|
||||
#define DEAUTH_SNIFF 4
|
||||
#define DRAW 5
|
||||
#define PACKET_MONITOR 6
|
||||
#define PROBE_SNIFF 7
|
||||
#define SCANNERS 8
|
||||
#define CC_SKIMMERS 9
|
||||
#define SNIFFERS 10
|
||||
#define WIFI 11
|
||||
#define BEACON_SPAM 12
|
||||
#define RICK_ROLL 13
|
||||
#define REBOOT 14
|
||||
#define GENERAL_APPS 15
|
||||
#define UPDATE 16
|
||||
#define DEVICE 17
|
||||
#define DEVICE_INFO 18
|
||||
|
||||
struct Menu;
|
||||
|
||||
// Individual Nodes of a menu
|
||||
|
||||
struct MenuNode {
|
||||
String name;
|
||||
uint16_t color;
|
||||
int icon;
|
||||
TFT_eSPI_Button* button;
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
// Full Menus
|
||||
struct Menu {
|
||||
String name;
|
||||
LinkedList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
uint8_t selected;
|
||||
};
|
||||
|
||||
|
||||
class MenuFunctions
|
||||
{
|
||||
private:
|
||||
Menu* current_menu;
|
||||
|
||||
// Main menu stuff
|
||||
Menu mainMenu;
|
||||
|
||||
Menu wifiMenu;
|
||||
Menu bluetoothMenu;
|
||||
Menu generalMenu;
|
||||
Menu deviceMenu;
|
||||
|
||||
// Device menu stuff
|
||||
Menu updateMenu;
|
||||
Menu infoMenu;
|
||||
|
||||
// WiFi menu stuff
|
||||
Menu wifiSnifferMenu;
|
||||
Menu wifiScannerMenu;
|
||||
Menu wifiAttackMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
Menu bluetoothScannerMenu;
|
||||
|
||||
// Menu icons
|
||||
|
||||
|
||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
|
||||
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
|
||||
void showMenuList(Menu* menu, int layer);
|
||||
void orientDisplay();
|
||||
|
||||
public:
|
||||
MenuFunctions();
|
||||
|
||||
uint16_t x = -1, y = -1;
|
||||
boolean pressed = false;
|
||||
|
||||
void buildButtons(Menu* menu);
|
||||
void changeMenu(Menu* menu);
|
||||
void displayCurrentMenu();
|
||||
void main();
|
||||
void RunSetup();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef MenuFunctions_h
|
||||
#define MenuFunctions_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
#define BATTERY_ANALOG_ON 0
|
||||
|
||||
#include "WiFiScan.h"
|
||||
#include "Display.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
#include "esp_interface.h"
|
||||
#include "a32u4_interface.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#include <SwitchLib.h>
|
||||
extern SwitchLib u_btn;
|
||||
extern SwitchLib d_btn;
|
||||
extern SwitchLib l_btn;
|
||||
extern SwitchLib r_btn;
|
||||
extern SwitchLib c_btn;
|
||||
#endif
|
||||
|
||||
extern Display display_obj;
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
extern Web web_obj;
|
||||
extern SDInterface sd_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern EspInterface esp_obj;
|
||||
extern A32u4Interface a32u4_obj;
|
||||
extern Settings settings_obj;
|
||||
|
||||
#define FLASH_BUTTON 0
|
||||
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
#define BATTERY_PIN 13
|
||||
#define ANALOG_PIN 34
|
||||
#define CHARGING_PIN 27
|
||||
#endif
|
||||
|
||||
// Icon definitions
|
||||
#define ATTACKS 0
|
||||
#define BEACON_SNIFF 1
|
||||
#define BLUETOOTH 2
|
||||
#define BLUETOOTH_SNIFF 3
|
||||
#define DEAUTH_SNIFF 4
|
||||
#define DRAW 5
|
||||
#define PACKET_MONITOR 6
|
||||
#define PROBE_SNIFF 7
|
||||
#define SCANNERS 8
|
||||
#define CC_SKIMMERS 9
|
||||
#define SNIFFERS 10
|
||||
#define WIFI 11
|
||||
#define BEACON_SPAM 12
|
||||
#define RICK_ROLL 13
|
||||
#define REBOOT 14
|
||||
#define GENERAL_APPS 15
|
||||
#define UPDATE 16
|
||||
#define DEVICE 17
|
||||
#define DEVICE_INFO 18
|
||||
#define SD_UPDATE 19
|
||||
#define WEB_UPDATE 20
|
||||
#define EAPOL 21
|
||||
#define STATUS_BAT 22
|
||||
#define STATUS_SD 23
|
||||
#define PWNAGOTCHI 24
|
||||
#define ESPRESSIF 25
|
||||
#define SHUTDOWN 26
|
||||
#define BEACON_LIST 27
|
||||
#define GENERATE 28
|
||||
#define CLEAR_ICO 29
|
||||
#define KEYBOARD_ICO 30
|
||||
#define JOIN_WIFI 31
|
||||
#define ESP_UPDATE_ICO 32
|
||||
#define BAD_USB_ICO 33
|
||||
#define TEST_BAD_USB_ICO 34
|
||||
#define LANGUAGE 35
|
||||
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void add_ssid_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void write_bad_usb_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void load_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void test_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event);
|
||||
PROGMEM static void setting_dropdown_cb(lv_obj_t * btn, lv_event_t event);
|
||||
PROGMEM static void save_as_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
PROGMEM static lv_obj_t * save_as_kb;
|
||||
|
||||
struct Menu;
|
||||
|
||||
// Individual Nodes of a menu
|
||||
|
||||
struct MenuNode {
|
||||
String name;
|
||||
String command;
|
||||
uint16_t color;
|
||||
int icon;
|
||||
TFT_eSPI_Button* button;
|
||||
bool selected;
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
// Full Menus
|
||||
struct Menu {
|
||||
String name;
|
||||
LinkedList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
uint8_t selected = 0;
|
||||
};
|
||||
|
||||
|
||||
class MenuFunctions
|
||||
{
|
||||
private:
|
||||
|
||||
String u_result = "";
|
||||
|
||||
uint32_t initTime = 0;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
// Main menu stuff
|
||||
Menu mainMenu;
|
||||
|
||||
Menu wifiMenu;
|
||||
Menu bluetoothMenu;
|
||||
Menu badusbMenu;
|
||||
Menu generalMenu;
|
||||
Menu deviceMenu;
|
||||
|
||||
// Device menu stuff
|
||||
Menu whichUpdateMenu;
|
||||
Menu failedUpdateMenu;
|
||||
Menu confirmMenu;
|
||||
Menu espUpdateMenu;
|
||||
Menu updateMenu;
|
||||
Menu settingsMenu;
|
||||
Menu specSettingMenu;
|
||||
Menu infoMenu;
|
||||
Menu languageMenu;
|
||||
|
||||
// WiFi menu stuff
|
||||
Menu wifiSnifferMenu;
|
||||
Menu wifiAttackMenu;
|
||||
Menu wifiGeneralMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
Menu bluetoothGeneralMenu;
|
||||
|
||||
// Settings things menus
|
||||
Menu shutdownWiFiMenu;
|
||||
Menu shutdownBLEMenu;
|
||||
Menu generateSSIDsMenu;
|
||||
Menu clearSSIDsMenu;
|
||||
Menu clearAPsMenu;
|
||||
|
||||
static void lv_tick_handler();
|
||||
|
||||
// Menu icons
|
||||
|
||||
|
||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
|
||||
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable, bool selected = false, String command = "");
|
||||
void updateStatusBar();
|
||||
void battery(bool initial = false);
|
||||
void battery2(bool initial = false);
|
||||
void showMenuList(Menu* menu, int layer);
|
||||
String callSetting(String key);
|
||||
void runBoolSetting(String ley);
|
||||
void displaySetting(String key, Menu* menu, int index);
|
||||
void buttonSelected(uint8_t b);
|
||||
void buttonNotSelected(uint8_t b);
|
||||
|
||||
public:
|
||||
MenuFunctions();
|
||||
|
||||
Menu* current_menu;
|
||||
|
||||
Ticker tick;
|
||||
|
||||
uint16_t x = -1, y = -1;
|
||||
boolean pressed = false;
|
||||
|
||||
String loaded_file = "";
|
||||
|
||||
void initLVGL();
|
||||
void deinitLVGL();
|
||||
void joinWiFiGFX();
|
||||
void addSSIDGFX();
|
||||
void addAPGFX();
|
||||
void displaySettingsGFX();
|
||||
void writeBadUSB();
|
||||
|
||||
void buildButtons(Menu* menu);
|
||||
void changeMenu(Menu* menu);
|
||||
void drawStatusBar();
|
||||
void displayCurrentMenu();
|
||||
void main(uint32_t currentTime);
|
||||
void RunSetup();
|
||||
void orientDisplay();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
225
esp32_marauder/SDInterface.cpp
Normal file
225
esp32_marauder/SDInterface.cpp
Normal file
@@ -0,0 +1,225 @@
|
||||
#include "SDInterface.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
bool SDInterface::initSD() {
|
||||
String display_string = "";
|
||||
|
||||
#ifdef KIT
|
||||
pinMode(SD_DET, INPUT);
|
||||
if (digitalRead(SD_DET) == LOW) {
|
||||
Serial.println(F("SD Card Detect Pin Detected"));
|
||||
}
|
||||
else {
|
||||
Serial.println(F("SD Card Detect Pin Not Detected"));
|
||||
this->supported = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!SD.begin(SD_CS)) {
|
||||
Serial.println(F("Failed to mount SD Card"));
|
||||
this->supported = false;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
this->supported = true;
|
||||
this->cardType = SD.cardType();
|
||||
//if (cardType == CARD_MMC)
|
||||
// Serial.println(F("SD: MMC Mounted"));
|
||||
//else if(cardType == CARD_SD)
|
||||
// Serial.println(F("SD: SDSC Mounted"));
|
||||
//else if(cardType == CARD_SDHC)
|
||||
// Serial.println(F("SD: SDHC Mounted"));
|
||||
//else
|
||||
// Serial.println(F("SD: UNKNOWN Card Mounted"));
|
||||
|
||||
this->cardSizeMB = SD.cardSize() / (1024 * 1024);
|
||||
|
||||
//Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||
|
||||
if (this->supported) {
|
||||
const int NUM_DIGITS = log10(this->cardSizeMB) + 1;
|
||||
|
||||
char sz[NUM_DIGITS + 1];
|
||||
|
||||
sz[NUM_DIGITS] = 0;
|
||||
for ( size_t i = NUM_DIGITS; i--; this->cardSizeMB /= 10)
|
||||
{
|
||||
sz[i] = '0' + (this->cardSizeMB % 10);
|
||||
display_string.concat((String)sz[i]);
|
||||
}
|
||||
|
||||
this->card_sz = sz;
|
||||
}
|
||||
|
||||
buffer_obj = Buffer();
|
||||
|
||||
if (!SD.exists("/SCRIPTS")) {
|
||||
Serial.println("/SCRIPTS does not exist. Creating...");
|
||||
|
||||
SD.mkdir("/SCRIPTS");
|
||||
Serial.println("/SCRIPTS created");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::addPacket(uint8_t* buf, uint32_t len) {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
buffer_obj.addPacket(buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::openCapture(String file_name) {
|
||||
if (this->supported)
|
||||
buffer_obj.open(&SD, file_name);
|
||||
}
|
||||
|
||||
void SDInterface::runUpdate() {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
|
||||
display_obj.tft.println(F(text15));
|
||||
#endif
|
||||
File updateBin = SD.open("/update.bin");
|
||||
if (updateBin) {
|
||||
if(updateBin.isDirectory()){
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[0]));
|
||||
#endif
|
||||
Serial.println(F("Error, update.bin is not a file"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
updateBin.close();
|
||||
return;
|
||||
}
|
||||
|
||||
size_t updateSize = updateBin.size();
|
||||
|
||||
if (updateSize > 0) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[1]));
|
||||
#endif
|
||||
Serial.println(F("Try to start update"));
|
||||
this->performUpdate(updateBin, updateSize);
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[2]));
|
||||
#endif
|
||||
Serial.println(F("Error, file is empty"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
updateBin.close();
|
||||
|
||||
// whe finished remove the binary from sd card to indicate end of the process
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[3]));
|
||||
#endif
|
||||
Serial.println(F("rebooting..."));
|
||||
//SD.remove("/update.bin");
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[4]));
|
||||
#endif
|
||||
Serial.println(F("Could not load update.bin from sd root"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
||||
if (Update.begin(updateSize)) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[5] + String(updateSize));
|
||||
display_obj.tft.println(F(text_table2[6]));
|
||||
#endif
|
||||
size_t written = Update.writeStream(updateSource);
|
||||
if (written == updateSize) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[7] + String(written) + text_table2[10]);
|
||||
#endif
|
||||
Serial.println("Written : " + String(written) + " successfully");
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[8] + String(written) + "/" + String(updateSize) + text_table2[9]);
|
||||
#endif
|
||||
Serial.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?");
|
||||
}
|
||||
if (Update.end()) {
|
||||
Serial.println("OTA done!");
|
||||
if (Update.isFinished()) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[11]));
|
||||
#endif
|
||||
Serial.println(F("Update successfully completed. Rebooting."));
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(text_table2[12]);
|
||||
#endif
|
||||
Serial.println("Update not finished? Something went wrong!");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[13] + String(Update.getError()));
|
||||
#endif
|
||||
Serial.println("Error Occurred. Error #: " + String(Update.getError()));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[14]);
|
||||
#endif
|
||||
Serial.println("Not enough space to begin OTA");
|
||||
}
|
||||
}
|
||||
|
||||
bool SDInterface::checkDetectPin() {
|
||||
#ifdef KIT
|
||||
if (digitalRead(SD_DET) == LOW)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDInterface::main() {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Saving packet...");
|
||||
buffer_obj.forceSave(&SD);
|
||||
}
|
||||
else if (!this->supported) {
|
||||
if (checkDetectPin()) {
|
||||
delay(100);
|
||||
this->initSD();
|
||||
}
|
||||
}
|
||||
}
|
||||
48
esp32_marauder/SDInterface.h
Normal file
48
esp32_marauder/SDInterface.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef SDInterface_h
|
||||
#define SDInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include "SD.h"
|
||||
#include "Buffer.h"
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include <Update.h>
|
||||
|
||||
extern Buffer buffer_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
#ifdef KIT
|
||||
#define SD_DET 4
|
||||
#endif
|
||||
|
||||
class SDInterface {
|
||||
|
||||
private:
|
||||
bool checkDetectPin();
|
||||
|
||||
public:
|
||||
uint8_t cardType;
|
||||
//uint64_t cardSizeBT;
|
||||
//uint64_t cardSizeKB;
|
||||
uint64_t cardSizeMB;
|
||||
//uint64_t cardSizeGB;
|
||||
bool supported = false;
|
||||
bool do_save = true;
|
||||
|
||||
String card_sz;
|
||||
|
||||
bool initSD();
|
||||
|
||||
void addPacket(uint8_t* buf, uint32_t len);
|
||||
void openCapture(String file_name = "");
|
||||
void runUpdate();
|
||||
void performUpdate(Stream &updateSource, size_t updateSize);
|
||||
void main();
|
||||
//void savePacket(uint8_t* buf, uint32_t len);
|
||||
};
|
||||
|
||||
#endif
|
||||
36
esp32_marauder/TemperatureInterface.cpp
Normal file
36
esp32_marauder/TemperatureInterface.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "TemperatureInterface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
|
||||
TemperatureInterface::TemperatureInterface() {
|
||||
|
||||
}
|
||||
|
||||
void TemperatureInterface::RunSetup() {
|
||||
this->initTime = millis();
|
||||
this->current_temp = this->getCurrentTemp();
|
||||
}
|
||||
|
||||
uint8_t TemperatureInterface::getCurrentTemp() {
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
return ((temprature_sens_read() - 32) / 1.8);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TemperatureInterface::main(uint32_t currentTime) {
|
||||
if (currentTime != 0) {
|
||||
if (currentTime - initTime >= 100) {
|
||||
//Serial.println("Checking Battery Level");
|
||||
this->initTime = millis();
|
||||
this->current_temp = this->getCurrentTemp();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
esp32_marauder/TemperatureInterface.h
Normal file
24
esp32_marauder/TemperatureInterface.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef TemperatureInterface_h
|
||||
#define TemperatureInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class TemperatureInterface {
|
||||
|
||||
private:
|
||||
uint32_t initTime = 0;
|
||||
|
||||
public:
|
||||
TemperatureInterface();
|
||||
|
||||
uint8_t current_temp = 0;
|
||||
uint8_t old_temp = 0;
|
||||
|
||||
uint8_t getCurrentTemp();
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Web.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
WebServer server(80);
|
||||
|
||||
@@ -9,8 +10,9 @@ Web::Web()
|
||||
|
||||
void Web::main()
|
||||
{
|
||||
//Serial.println("Running the shits");
|
||||
// Notify if client has connected to the update server
|
||||
|
||||
|
||||
int current_sta = WiFi.softAPgetStationNum();
|
||||
|
||||
if (current_sta < this->num_sta)
|
||||
@@ -26,6 +28,7 @@ void Web::main()
|
||||
Serial.println(this->num_sta);
|
||||
}
|
||||
|
||||
|
||||
server.handleClient();
|
||||
delay(1);
|
||||
}
|
||||
@@ -40,41 +43,58 @@ void Web::onJavaScript(void) {
|
||||
|
||||
void Web::setupOTAupdate()
|
||||
{
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
uint8_t newMACAddress[] = {0x06, 0x07, 0x0D, 0x09, 0x0E, 0x0D};
|
||||
|
||||
display_obj.tft.print("Configuring update server...\n\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(text_table3[0]);
|
||||
#endif
|
||||
Serial.println("Configuring update server...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
#endif
|
||||
|
||||
// Start WiFi AP
|
||||
Serial.println("Initializing WiFi...");
|
||||
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_wifi_init(&wifi_scan_obj.cfg);
|
||||
//esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||
if (esp_wifi_set_storage(WIFI_STORAGE_FLASH) != ESP_OK)
|
||||
Serial.println("Could not set WiFi Storage!");
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
esp_wifi_start();
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
Serial.println("Starting softAP...");
|
||||
esp_wifi_set_mac(WIFI_IF_AP, &newMACAddress[0]);
|
||||
WiFi.softAP(ssid, password);
|
||||
Serial.println("");
|
||||
|
||||
display_obj.tft.print("SSID: ");
|
||||
display_obj.tft.println(ssid);
|
||||
display_obj.tft.print("IP address: ");
|
||||
display_obj.tft.print(WiFi.softAPIP());
|
||||
display_obj.tft.print("\n");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
Serial.println("Displaying settings to TFT...");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(text_table1[2]);
|
||||
display_obj.tft.println(ssid);
|
||||
display_obj.tft.print(text_table3[1]);
|
||||
display_obj.tft.print(WiFi.softAPIP());
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.softAPIP());
|
||||
|
||||
/*use mdns for host name resolution*/
|
||||
/*
|
||||
if (!MDNS.begin(host)) { //http://esp32.local
|
||||
Serial.println("Error setting up MDNS responder!");
|
||||
while (1) {
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
Serial.println("mDNS responder started");
|
||||
*/
|
||||
|
||||
// return javascript jquery
|
||||
Serial.println("Setting server behavior...");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
server.on("/jquery.min.js", HTTP_GET, onJavaScript);
|
||||
/*return index page which is stored in serverIndex */
|
||||
server.on("/", HTTP_GET, [this]() {
|
||||
@@ -93,11 +113,12 @@ void Web::setupOTAupdate()
|
||||
}, [this]() {
|
||||
HTTPUpload& upload = server.upload();
|
||||
if (upload.status == UPLOAD_FILE_START) {
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
display_obj.tft.print("Update: ");
|
||||
display_obj.tft.print(upload.filename.c_str());
|
||||
display_obj.tft.print("\n");
|
||||
//display_obj.updateBanner(menu_function_obj.current_menu->name);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
display_obj.tft.print(text_table3[2]);
|
||||
display_obj.tft.print(upload.filename.c_str());
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
Serial.printf("Update: %s\n", upload.filename.c_str());
|
||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
|
||||
Update.printError(Serial);
|
||||
@@ -107,30 +128,23 @@ void Web::setupOTAupdate()
|
||||
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
||||
Update.printError(Serial);
|
||||
}
|
||||
//display_obj.tft.println(upload.totalSize);
|
||||
/*
|
||||
String display_string = "";
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
for (int i = 0; i < 40; i++) {
|
||||
display_string.concat(" ");
|
||||
}
|
||||
*/
|
||||
display_obj.tft.setTextColor(TFT_CYAN);
|
||||
display_obj.tft.fillRect(0, 164, 240, 8, TFT_BLACK);
|
||||
//delay(1);
|
||||
//display_obj.tft.print(display_string);
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
display_obj.tft.print("Bytes complete: ");
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_CYAN);
|
||||
display_obj.tft.fillRect(0, 164, 240, 8, TFT_BLACK);
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
display_obj.tft.print(text_table3[3]);
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
|
||||
//Serial.println(upload.totalSize);
|
||||
} else if (upload.status == UPLOAD_FILE_END) {
|
||||
if (Update.end(true)) { //true to set the size to the current progress
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.print("Update Success: ");
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\nRebooting...\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.print(text_table3[4]);
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print(text_table2[3]);
|
||||
#endif
|
||||
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
|
||||
delay(1000);
|
||||
} else {
|
||||
@@ -138,9 +152,27 @@ void Web::setupOTAupdate()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Serial.println("Finished setting server behavior");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
Serial.println("Starting server...");
|
||||
server.begin();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.println("\nCompleted update server setup");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.println(text_table3[5]);
|
||||
#endif
|
||||
Serial.println("Completed update server setup");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
}
|
||||
|
||||
void Web::shutdownServer() {
|
||||
Serial.println("Closing Update Server...");
|
||||
server.stop();
|
||||
WiFi.mode(WIFI_OFF);
|
||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||
esp_wifi_stop();
|
||||
esp_wifi_deinit();
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
Code taken from espressif ESP32 OTA Update example
|
||||
*/
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WebServer.h>
|
||||
@@ -12,22 +14,32 @@ Code taken from espressif ESP32 OTA Update example
|
||||
#include <Update.h>
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include "WiFiScan.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
|
||||
class Web
|
||||
{
|
||||
private:
|
||||
|
||||
const char* host = "esp32marauder";
|
||||
const char* ssid = "MarauderOTA";
|
||||
const char* password = "justcallmekoko";
|
||||
PROGMEM const char* host = "esp32marauder";
|
||||
PROGMEM const char* ssid = "MarauderOTA";
|
||||
PROGMEM const char* password = "justcallmekoko";
|
||||
|
||||
bool serving = false;
|
||||
|
||||
int num_sta = 0;
|
||||
|
||||
const char* loginIndex =
|
||||
PROGMEM const char* loginIndex =
|
||||
"<form name='loginForm'>"
|
||||
"<table width='20%' bgcolor='A09F9F' align='center'>"
|
||||
"<tr>"
|
||||
@@ -72,7 +84,7 @@ class Web
|
||||
* Server Index Page
|
||||
*/
|
||||
|
||||
const char* serverIndex =
|
||||
PROGMEM const char* serverIndex =
|
||||
"<script src='/jquery.min.js'></script>"
|
||||
"Because the lack of an asynchronous webserver in this Arduino sketch like 'ESPAsyncWebServer', <br/>"
|
||||
"both file 'serverIndex' and 'jquery.min.js' can't be read from the webserver at the same time. <br/><br/>"
|
||||
@@ -121,8 +133,9 @@ class Web
|
||||
Web();
|
||||
|
||||
void main();
|
||||
static void onJavaScript();
|
||||
PROGMEM static void onJavaScript();
|
||||
void setupOTAupdate();
|
||||
void shutdownServer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,42 +1,108 @@
|
||||
#ifndef WiFiScan_h
|
||||
#define WiFiScan_h
|
||||
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEUtils.h>
|
||||
#include <BLEScan.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
#include "configs.h"
|
||||
|
||||
//#include <BLEDevice.h>
|
||||
//#include <BLEUtils.h>
|
||||
//#include <BLEScan.h>
|
||||
//#include <BLEAdvertisedDevice.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// Testing NimBLE
|
||||
#ifdef HAS_BT
|
||||
#include <NimBLEDevice.h>
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <math.h>
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "Display.h"
|
||||
#ifdef HAS_BT
|
||||
#include "esp_bt.h"
|
||||
#endif
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include "SDInterface.h"
|
||||
#include "Buffer.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "TemperatureInterface.h"
|
||||
#include "settings.h"
|
||||
#include "Assets.h"
|
||||
#include "flipperLED.h"
|
||||
//#include "MenuFunctions.h"
|
||||
|
||||
#define bad_list_length 3
|
||||
|
||||
#define OTA_UPDATE 100
|
||||
#define SHOW_INFO 101
|
||||
#define ESP_UPDATE 102
|
||||
#define WIFI_SCAN_OFF 0
|
||||
#define WIFI_SCAN_PROBE 1
|
||||
#define WIFI_SCAN_AP 2
|
||||
#define WIFI_SCAN_ST 3
|
||||
#define WIFI_SCAN_DEAUTH 4
|
||||
#define WIFI_SCAN_ALL 5
|
||||
#define WIFI_PACKET_MONITOR 6
|
||||
#define WIFI_ATTACK_BEACON_SPAM 7
|
||||
#define WIFI_ATTACK_RICK_ROLL 8
|
||||
#define BT_SCAN_ALL 9
|
||||
#define BT_SCAN_SKIMMERS 10
|
||||
#define WIFI_SCAN_PWN 3
|
||||
#define WIFI_SCAN_EAPOL 4
|
||||
#define WIFI_SCAN_DEAUTH 5
|
||||
#define WIFI_SCAN_ALL 6
|
||||
#define WIFI_PACKET_MONITOR 7
|
||||
#define WIFI_ATTACK_BEACON_SPAM 8
|
||||
#define WIFI_ATTACK_RICK_ROLL 9
|
||||
#define BT_SCAN_ALL 10
|
||||
#define BT_SCAN_SKIMMERS 11
|
||||
#define WIFI_SCAN_ESPRESSIF 12
|
||||
#define LV_JOIN_WIFI 13
|
||||
#define LV_ADD_SSID 14
|
||||
#define WIFI_ATTACK_BEACON_LIST 15
|
||||
#define WIFI_SCAN_TARGET_AP 16
|
||||
#define LV_SELECT_AP 17
|
||||
#define WIFI_ATTACK_AUTH 18
|
||||
#define WIFI_ATTACK_MIMIC 19
|
||||
#define WIFI_ATTACK_DEAUTH 20
|
||||
#define WIFI_ATTACK_AP_SPAM 21
|
||||
#define WIFI_SCAN_TARGET_AP_FULL 22
|
||||
#define WIFI_SCAN_ACTIVE_EAPOL 23
|
||||
|
||||
#define GRAPH_REFRESH 100
|
||||
|
||||
#define MAX_CHANNEL 14
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
extern SDInterface sd_obj;
|
||||
extern Buffer buffer_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern TemperatureInterface temp_obj;
|
||||
extern Settings settings_obj;
|
||||
extern flipperLED flipper_led;
|
||||
|
||||
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
|
||||
//int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3);
|
||||
|
||||
struct ssid {
|
||||
String essid;
|
||||
int bssid[6];
|
||||
bool selected;
|
||||
};
|
||||
|
||||
struct AccessPoint {
|
||||
String essid;
|
||||
int channel;
|
||||
int bssid[6];
|
||||
bool selected;
|
||||
LinkedList<char>* beacon;
|
||||
};
|
||||
|
||||
class WiFiScan
|
||||
{
|
||||
private:
|
||||
// Settings
|
||||
int channel_hop_delay = 1;
|
||||
bool force_pmkid = false;
|
||||
bool force_probe = false;
|
||||
bool save_pcap = false;
|
||||
|
||||
int x_pos; //position along the graph x axis
|
||||
float y_pos_x; //current graph y axis position of X value
|
||||
float y_pos_x_old = 120; //old y axis position of X value
|
||||
@@ -50,18 +116,23 @@ class WiFiScan
|
||||
|
||||
bool do_break = false;
|
||||
|
||||
bool wsl_bypass_enabled = false;
|
||||
|
||||
//int num_beacon = 0; // GREEN
|
||||
//int num_probe = 0; // BLUE
|
||||
//int num_deauth = 0; // RED
|
||||
|
||||
uint32_t initTime = 0;
|
||||
bool run_setup = true;
|
||||
int set_channel = 1;
|
||||
void initWiFi(uint8_t scan_mode);
|
||||
int bluetoothScanTime = 5;
|
||||
int packets_sent = 0;
|
||||
const wifi_promiscuous_filter_t filt = {.filter_mask=WIFI_PROMIS_FILTER_MASK_MGMT | WIFI_PROMIS_FILTER_MASK_DATA};
|
||||
BLEScan* pBLEScan;
|
||||
#ifdef HAS_BT
|
||||
NimBLEScan* pBLEScan;
|
||||
#endif
|
||||
|
||||
//String connected_network = "";
|
||||
String alfa = "1234567890qwertyuiopasdfghjkklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM_";
|
||||
|
||||
char* rick_roll[8] = {
|
||||
@@ -89,8 +160,8 @@ class WiFiScan
|
||||
} __attribute__((packed)) WifiMgmtHdr;
|
||||
|
||||
typedef struct {
|
||||
WifiMgmtHdr hdr;
|
||||
uint8_t payload[0];
|
||||
WifiMgmtHdr hdr;
|
||||
} wifi_ieee80211_packet_t;
|
||||
|
||||
// barebones packet
|
||||
@@ -106,36 +177,133 @@ class WiFiScan
|
||||
/*36*/ 0x00
|
||||
};
|
||||
|
||||
void packetMonitorMain();
|
||||
void changeChannel();
|
||||
/*uint8_t auth_packet[128] = {0xB0, 0x00, 0x3C, 0x00, // Frame Control, Duration
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Dest
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Dest BSSID
|
||||
0x00, 0x01, // Sequence number
|
||||
0x00, 0x00, // Algo
|
||||
0x01, 0x00, // Auth sequence number
|
||||
0x00, 0x00, // Status Code
|
||||
0x7F, 0x08,
|
||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40,
|
||||
0xDD, 0x0B, 0x00, 0x17, 0xF2, 0x0A, 0x00, 0x01, // Say it was Apple
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0xDD, 0x0A, 0x00,
|
||||
0x10, 0x18, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00
|
||||
};*/
|
||||
uint8_t auth_packet[65] = {0xb0, 0x00, 0x3c, 0x00,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x7f, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x40, 0xdd, 0x0b, 0x00, 0x17, 0xf2, 0x0a,
|
||||
0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0xdd,
|
||||
0x0a, 0x00, 0x10, 0x18, 0x02, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00};
|
||||
|
||||
uint8_t prob_req_packet[128] = {0x40, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Destination
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Source
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Dest
|
||||
0x01, 0x00, // Sequence
|
||||
0x00, // SSID Parameter
|
||||
0x00, // SSID Length
|
||||
/* SSID */
|
||||
};
|
||||
|
||||
uint8_t deauth_frame_default[26] = {
|
||||
0xc0, 0x00, 0x3a, 0x01,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0xff, 0x02, 0x00
|
||||
};
|
||||
|
||||
void startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_string);
|
||||
|
||||
void packetMonitorMain(uint32_t currentTime);
|
||||
void eapolMonitorMain(uint32_t currentTime);
|
||||
void updateMidway();
|
||||
void tftDrawXScalButtons();
|
||||
void tftDrawYScaleButtons();
|
||||
void tftDrawChannelScaleButtons();
|
||||
void tftDrawColorKey();
|
||||
void tftDrawGraphObjects();
|
||||
void sendProbeAttack(uint32_t currentTime);
|
||||
void sendDeauthAttack(uint32_t currentTime);
|
||||
void sendDeauthFrame(uint8_t bssid[6], int channel);
|
||||
void broadcastRandomSSID(uint32_t currentTime);
|
||||
void broadcastCustomBeacon(uint32_t current_time, ssid custom_ssid);
|
||||
void broadcastCustomBeacon(uint32_t current_time, AccessPoint custom_ssid);
|
||||
void broadcastSetSSID(uint32_t current_time, char* ESSID);
|
||||
void RunRickRoll(uint8_t scan_mode, uint16_t color);
|
||||
void RunBeaconSpam(uint8_t scan_mode, uint16_t color);
|
||||
void RunAPScan(uint8_t scan_mode, uint16_t color);
|
||||
//void RunRickRoll(uint8_t scan_mode, uint16_t color);
|
||||
//void RunBeaconSpam(uint8_t scan_mode, uint16_t color);
|
||||
//void RunProbeFlood(uint8_t scan_mode, uint16_t color);
|
||||
//void RunDeauthFlood(uint8_t scan_mode, uint16_t color);
|
||||
void RunMimicFlood(uint8_t scan_mode, uint16_t color);
|
||||
//void RunBeaconList(uint8_t scan_mode, uint16_t color);
|
||||
void RunEspressifScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunPwnScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunBeaconScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunDeauthScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunEapolScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunProbeScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunPacketMonitor(uint8_t scan_mode, uint16_t color);
|
||||
void RunBluetoothScan(uint8_t scan_mode, uint16_t color);
|
||||
static void scanCompleteCB(BLEScanResults scanResults);
|
||||
void RunLvJoinWiFi(uint8_t scan_mode, uint16_t color);
|
||||
#ifdef HAS_BT
|
||||
static void scanCompleteCB(BLEScanResults scanResults);
|
||||
#endif
|
||||
|
||||
//int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3);
|
||||
|
||||
public:
|
||||
WiFiScan();
|
||||
|
||||
//AccessPoint ap_list;
|
||||
|
||||
//LinkedList<ssid>* ssids;
|
||||
|
||||
int set_channel = 1;
|
||||
|
||||
int old_channel = 0;
|
||||
|
||||
bool orient_display = false;
|
||||
bool wifi_initialized = false;
|
||||
bool ble_initialized = false;
|
||||
|
||||
|
||||
String free_ram = "";
|
||||
String old_free_ram = "";
|
||||
String connected_network = "";
|
||||
|
||||
//lv_obj_t * scr = lv_cont_create(NULL, NULL);
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
char* stringToChar(String string);
|
||||
void RunSetup();
|
||||
int clearSSIDs();
|
||||
int clearAPs();
|
||||
bool addSSID(String essid);
|
||||
int generateSSIDs(int count = 20);
|
||||
bool shutdownWiFi();
|
||||
bool shutdownBLE();
|
||||
bool scanning();
|
||||
void joinWiFi(String ssid, String password);
|
||||
String getStaMAC();
|
||||
String getApMAC();
|
||||
String freeRAM();
|
||||
void changeChannel();
|
||||
void changeChannel(int chan);
|
||||
void RunInfo();
|
||||
void RunShutdownWiFi();
|
||||
void RunShutdownBLE();
|
||||
void RunGenerateSSIDs(int count = 20);
|
||||
void RunClearSSIDs();
|
||||
void RunClearAPs();
|
||||
void channelHop();
|
||||
uint8_t currentScanMode = 0;
|
||||
void main(uint32_t currentTime);
|
||||
@@ -143,9 +311,16 @@ class WiFiScan
|
||||
void StopScan(uint8_t scan_mode);
|
||||
|
||||
static void getMAC(char *addr, uint8_t* data, uint16_t offset);
|
||||
static void espressifSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void beaconListSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
};
|
||||
#endif
|
||||
|
||||
69
esp32_marauder/a32u4_interface.cpp
Normal file
69
esp32_marauder/a32u4_interface.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "a32u4_interface.h"
|
||||
|
||||
HardwareSerial MySerial_two(2);
|
||||
|
||||
void A32u4Interface::begin() {
|
||||
MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
|
||||
|
||||
delay(2000);
|
||||
|
||||
Serial.println("Setup A32U4 Serial Interface");
|
||||
|
||||
MySerial_two.println("DELAY 1");
|
||||
|
||||
delay(1000);
|
||||
|
||||
uint8_t a32u4_rep = 0;
|
||||
|
||||
if (MySerial_two.available()) {
|
||||
a32u4_rep = (uint8_t)MySerial_two.read();
|
||||
}
|
||||
|
||||
//display_string.trim();
|
||||
|
||||
//Serial.println("\nDisplay string: " + (String)display_string);
|
||||
|
||||
if (a32u4_rep != 0) {
|
||||
this->supported = true;
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.print("A32U4 Said: ");
|
||||
Serial.println(a32u4_rep);
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void A32u4Interface::runScript(String script) {
|
||||
MySerial_two.println(script);
|
||||
}
|
||||
|
||||
void A32u4Interface::test() {
|
||||
MySerial_two.println("STRING Hello, World!");
|
||||
}
|
||||
|
||||
void A32u4Interface::main(uint32_t current_time) {
|
||||
|
||||
if (current_time - this->initTime >= 1000) {
|
||||
this->initTime = millis();
|
||||
//MySerial_two.write("PING");
|
||||
|
||||
//delay(1);
|
||||
|
||||
if (MySerial_two.available()) {
|
||||
Serial.println("Got A32U4 Serial data");
|
||||
Serial.println(MySerial_two.read());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
30
esp32_marauder/a32u4_interface.h
Normal file
30
esp32_marauder/a32u4_interface.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef a32u4_interface_h
|
||||
#define a32u4_interface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define BAUD32U4 115200
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class A32u4Interface {
|
||||
public:
|
||||
bool supported = false;
|
||||
|
||||
uint32_t initTime;
|
||||
|
||||
void begin();
|
||||
|
||||
void main(uint32_t current_time);
|
||||
void test();
|
||||
void runScript(String script);
|
||||
};
|
||||
|
||||
#endif
|
||||
405
esp32_marauder/configs.h
Normal file
405
esp32_marauder/configs.h
Normal file
@@ -0,0 +1,405 @@
|
||||
#ifndef configs_h
|
||||
|
||||
#define configs_h
|
||||
|
||||
#define POLISH_POTATO
|
||||
|
||||
//#define MARAUDER_MINI
|
||||
//#define MARAUDER_V4
|
||||
//#define MARAUDER_V6
|
||||
//#define MARAUDER_KIT
|
||||
//#define GENERIC_ESP32
|
||||
#define MARAUDER_FLIPPER
|
||||
|
||||
#define MARAUDER_VERSION "v0.9.11"
|
||||
|
||||
//// BUTTON DEFINITIONS
|
||||
#ifdef MARAUDER_MINI
|
||||
#define L_BTN 13
|
||||
#define C_BTN 34
|
||||
#define U_BTN 36
|
||||
#define R_BTN 39
|
||||
#define D_BTN 35
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V4
|
||||
#endif
|
||||
//// END BUTTON DEFINITIONS
|
||||
|
||||
//// DISPLAY DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_SHIELD
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_DIY
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_DIY
|
||||
#define KIT
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 27
|
||||
#define TFT_DC 26
|
||||
#define TFT_RST 5
|
||||
#define TFT_BL 32
|
||||
#define TOUCH_CS 21
|
||||
#define SD_CS 4
|
||||
|
||||
#define SCREEN_BUFFER
|
||||
|
||||
#define MAX_SCREEN_BUFFER 9
|
||||
|
||||
#define BANNER_TEXT_SIZE 1
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 128
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 128
|
||||
#endif
|
||||
|
||||
#define CHAR_WIDTH 6
|
||||
#define SCREEN_WIDTH TFT_WIDTH // Originally 240
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT // Originally 320
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_WIDTH
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT (TFT_HEIGHT/10) // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX TFT_HEIGHT // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
#endif
|
||||
//// END DISPLAY DEFINITIONS
|
||||
|
||||
//// MENU DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define BANNER_TIME 50
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X (TFT_WIDTH/2) // Centre of key
|
||||
#define KEY_Y (TFT_HEIGHT/4.5)
|
||||
#define KEY_W TFT_WIDTH // Width and height
|
||||
#define KEY_H (TFT_HEIGHT/12.8)
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 10
|
||||
#endif
|
||||
//// END MENU DEFINITIONS
|
||||
|
||||
//// SD DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define SD_CS 4
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
#define SD_CS -1
|
||||
#endif
|
||||
//// END SD DEFINITIONS
|
||||
|
||||
//// SCREEN STUFF
|
||||
#ifdef MARAUDER_MINI
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V4
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef GENERIC_ESP32
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifndef HAS_SCREEN
|
||||
#define TFT_CYAN 0
|
||||
#define TFT_BLUE 0
|
||||
#define TFT_RED 0
|
||||
#define TFT_GREEN 0
|
||||
#define TFT_GREY 0
|
||||
#define TFT_GRAY 0
|
||||
#define TFT_MAGENTA 0
|
||||
#define TFT_VIOLET 0
|
||||
#define TFT_ORANGE 0
|
||||
#define TFT_YELLOW 0
|
||||
#define STANDARD_FONT_CHAR_LIMIT 40
|
||||
#define FLASH_BUTTON -1
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <LinkedList.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
#endif
|
||||
//// END SCREEN STUFF
|
||||
|
||||
#endif
|
||||
BIN
esp32_marauder/data/marauder3L1.jpg
Normal file
BIN
esp32_marauder/data/marauder3L1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
esp32_marauder/data/marauder_mini.jpg
Normal file
BIN
esp32_marauder/data/marauder_mini.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@@ -5,6 +5,13 @@ Partition Scheme: Minimal SPIFFS
|
||||
https://www.online-utility.org/image/convert/to/XBM
|
||||
*/
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifndef HAS_SCREEN
|
||||
#define MenuFunctions_h
|
||||
#define Display_h
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include "esp_wifi.h"
|
||||
@@ -16,75 +23,314 @@ https://www.online-utility.org/image/convert/to/XBM
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
#include "WiFiScan.h"
|
||||
#include "MenuFunctions.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
//#include "icons.h"
|
||||
#include "Buffer.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "TemperatureInterface.h"
|
||||
#include "LedInterface.h"
|
||||
#include "esp_interface.h"
|
||||
#include "settings.h"
|
||||
#include "CommandLine.h"
|
||||
#include "lang_var.h"
|
||||
#include "flipperLED.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#include "MenuFunctions.h"
|
||||
#include "a32u4_interface.h"
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#include <SwitchLib.h>
|
||||
SwitchLib u_btn = SwitchLib(U_BTN, 1000, true);
|
||||
SwitchLib d_btn = SwitchLib(D_BTN, 1000, true);
|
||||
SwitchLib l_btn = SwitchLib(L_BTN, 1000, true);
|
||||
SwitchLib r_btn = SwitchLib(R_BTN, 1000, true);
|
||||
SwitchLib c_btn = SwitchLib(C_BTN, 1000, true);
|
||||
#endif
|
||||
|
||||
Display display_obj;
|
||||
WiFiScan wifi_scan_obj;
|
||||
MenuFunctions menu_function_obj;
|
||||
SDInterface sd_obj;
|
||||
Web web_obj;
|
||||
Buffer buffer_obj;
|
||||
BatteryInterface battery_obj;
|
||||
TemperatureInterface temp_obj;
|
||||
LedInterface led_obj;
|
||||
EspInterface esp_obj;
|
||||
Settings settings_obj;
|
||||
CommandLine cli_obj;
|
||||
flipperLED flipper_led;
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
Display display_obj;
|
||||
MenuFunctions menu_function_obj;
|
||||
A32u4Interface a32u4_obj;
|
||||
#endif
|
||||
|
||||
const String PROGMEM version_number = MARAUDER_VERSION;
|
||||
|
||||
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Pixels, PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
|
||||
void backlightOn() {
|
||||
#ifdef HAS_SCREEN
|
||||
#ifdef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#endif
|
||||
|
||||
#ifndef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void backlightOff() {
|
||||
#ifdef HAS_SCREEN
|
||||
#ifdef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#endif
|
||||
|
||||
#ifndef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
pinMode(FLASH_BUTTON, INPUT);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
|
||||
backlightOff();
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
pinMode(BATTERY_PIN, OUTPUT);
|
||||
pinMode(CHARGING_PIN, INPUT);
|
||||
#endif
|
||||
|
||||
// Preset SPI CS pins to avoid bus conflicts
|
||||
#ifdef HAS_SCREEN
|
||||
digitalWrite(TFT_CS, HIGH);
|
||||
#endif
|
||||
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.println("\n\n--------------------------------\n");
|
||||
Serial.println(" ESP32 Marauder \n");
|
||||
Serial.println(" " + display_obj.version_number + "\n");
|
||||
Serial.println(" By: justcallmekoko\n");
|
||||
Serial.println("--------------------------------\n\n");
|
||||
|
||||
//Serial.begin(115200);
|
||||
|
||||
// Run display setup
|
||||
display_obj.RunSetup();
|
||||
//Serial.println("\n\nHello, World!\n");
|
||||
|
||||
// Build menus
|
||||
menu_function_obj.RunSetup();
|
||||
Serial.println("ESP-IDF version is: " + String(esp_get_idf_version()));
|
||||
|
||||
//#ifdef HAS_SCREEN
|
||||
// Serial.println("Has Screen");
|
||||
//#else
|
||||
// Serial.println("Does not have screen");
|
||||
//#endif
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
flipper_led.RunSetup();
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
#endif
|
||||
|
||||
backlightOff();
|
||||
|
||||
// Draw the title screen
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
//showCenterText(version_number, 250);
|
||||
#ifndef MARAUDER_MINI
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, TFT_WIDTH/2, TFT_HEIGHT, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
backlightOn(); // Need this
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
delay(2000);
|
||||
|
||||
display_obj.clearScreen();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
|
||||
display_obj.tft.println(text_table0[0]);
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.tft.println("Marauder " + display_obj.version_number + "\n");
|
||||
|
||||
display_obj.tft.println(text_table0[1]);
|
||||
#endif
|
||||
|
||||
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
|
||||
|
||||
settings_obj.begin();
|
||||
|
||||
//Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting<uint8_t>("Channel"));
|
||||
//if (settings_obj.loadSetting<bool>( "Force PMKID"))
|
||||
// Serial.println("This is a test Force PMKID: true");
|
||||
//else
|
||||
// Serial.println("This is a test Force PMKID: false");
|
||||
|
||||
wifi_scan_obj.RunSetup();
|
||||
|
||||
//Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[2]));
|
||||
#endif
|
||||
|
||||
// Do some SD stuff
|
||||
if(sd_obj.initSD()) {
|
||||
//Serial.println(F("SD Card supported"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[3]));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
Serial.println(F("SD Card NOT Supported"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println(F(text_table0[4]));
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
battery_obj.RunSetup();
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[5]));
|
||||
#endif
|
||||
|
||||
// Temperature stuff
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
temp_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[6]));
|
||||
#endif
|
||||
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
||||
|
||||
// if (battery_obj.i2c_supported) {
|
||||
// Serial.println(F("IP5306 I2C Supported: true"));
|
||||
// }
|
||||
// else
|
||||
// Serial.println(F("IP5306 I2C Supported: false"));
|
||||
#endif
|
||||
|
||||
// Do some LED stuff
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
led_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[7]));
|
||||
|
||||
delay(500);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[8]));
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
delay(2000);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
menu_function_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
//Serial.println(F("\n\n--------------------------------\n"));
|
||||
//Serial.println(F(" ESP32 Marauder \n"));
|
||||
//Serial.println(" " + version_number + "\n");
|
||||
//Serial.println(F(" By: justcallmekoko\n"));
|
||||
//Serial.println(F("--------------------------------\n\n"));
|
||||
|
||||
Serial.println("CLI Ready");
|
||||
cli_obj.RunSetup();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
// get the current time
|
||||
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
|
||||
currentTime = millis();
|
||||
bool mini = false;
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
mini = true;
|
||||
#endif
|
||||
|
||||
// Update all of our objects
|
||||
//if ((!display_obj.draw_tft) &&
|
||||
// (wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
if (!display_obj.draw_tft)
|
||||
#ifdef HAS_SCREEN
|
||||
bool do_draw = display_obj.draw_tft;
|
||||
#else
|
||||
bool do_draw = false;
|
||||
#endif
|
||||
|
||||
if ((!do_draw) && (wifi_scan_obj.currentScanMode != ESP_UPDATE))
|
||||
{
|
||||
display_obj.main();
|
||||
cli_obj.main(currentTime);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
#endif
|
||||
wifi_scan_obj.main(currentTime);
|
||||
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
|
||||
if (wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR)
|
||||
menu_function_obj.main();
|
||||
sd_obj.main();
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
battery_obj.main(currentTime);
|
||||
temp_obj.main(currentTime);
|
||||
#endif
|
||||
settings_obj.main(currentTime);
|
||||
if (((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) && (wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL)) ||
|
||||
(mini)) {
|
||||
#ifdef HAS_SCREEN
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
}
|
||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
||||
web_obj.main();
|
||||
#ifdef HAS_SCREEN
|
||||
delay(1);
|
||||
#else
|
||||
delay(50);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
else if ((display_obj.draw_tft) &&
|
||||
(wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
{
|
||||
display_obj.drawStylus();
|
||||
}
|
||||
#endif
|
||||
else if (wifi_scan_obj.currentScanMode == ESP_UPDATE) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
delay(1);
|
||||
}
|
||||
else if ((display_obj.draw_tft) &&
|
||||
(wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
{
|
||||
display_obj.drawStylus();
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// web_obj.main();
|
||||
//}
|
||||
|
||||
//Serial.println(wifi_scan_obj.currentScanMode);
|
||||
|
||||
//Serial.print("Run Time: ");
|
||||
//Serial.print(millis() - currentTime);
|
||||
//Serial.println("ms");
|
||||
}
|
||||
|
||||
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_flipper.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_flipper.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_kit.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_kit.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_mini.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_mini.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_new_hardware.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_new_hardware.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_old_hardware.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_11_20220731_old_hardware.bin
Normal file
Binary file not shown.
135
esp32_marauder/esp_interface.cpp
Normal file
135
esp32_marauder/esp_interface.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
#include "esp_interface.h"
|
||||
|
||||
HardwareSerial MySerial(1);
|
||||
|
||||
void EspInterface::begin() {
|
||||
pinMode(ESP_RST, OUTPUT);
|
||||
pinMode(ESP_ZERO, OUTPUT);
|
||||
|
||||
delay(100);
|
||||
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
|
||||
Serial.println("Checking for ESP8266...");
|
||||
|
||||
MySerial.begin(BAUD, SERIAL_8N1, 27, 26);
|
||||
|
||||
delay(100);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println("Checking for ESP8266...");
|
||||
#endif
|
||||
|
||||
this->bootRunMode();
|
||||
|
||||
delay(500);
|
||||
|
||||
while (MySerial.available())
|
||||
MySerial.read();
|
||||
|
||||
MySerial.write("PING");
|
||||
|
||||
delay(2000);
|
||||
|
||||
String display_string = "";
|
||||
|
||||
while (MySerial.available()) {
|
||||
display_string.concat((char)MySerial.read());
|
||||
}
|
||||
|
||||
display_string.trim();
|
||||
|
||||
Serial.println("\nDisplay string: " + (String)display_string);
|
||||
|
||||
if (display_string == "ESP8266 Pong") {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.println("ESP8266 Found!");
|
||||
this->supported = true;
|
||||
}
|
||||
else {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void EspInterface::RunUpdate() {
|
||||
this->bootProgramMode();
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(true);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
|
||||
display_obj.tft.println("Waiting for serial data...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EspInterface::bootProgramMode() {
|
||||
Serial.println("[!] Setting ESP12 in program mode...");
|
||||
digitalWrite(ESP_ZERO, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
Serial.println("[!] Complete");
|
||||
Serial.end();
|
||||
Serial.begin(57600);
|
||||
}
|
||||
|
||||
void EspInterface::bootRunMode() {
|
||||
Serial.end();
|
||||
Serial.begin(115200);
|
||||
Serial.println("[!] Setting ESP12 in run mode...");
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, LOW);
|
||||
delay(100);
|
||||
digitalWrite(ESP_RST, HIGH);
|
||||
delay(100);
|
||||
digitalWrite(ESP_ZERO, HIGH);
|
||||
Serial.println("[!] Complete");
|
||||
}
|
||||
|
||||
void EspInterface::program() {
|
||||
if (MySerial.available()) {
|
||||
Serial.write((uint8_t)MySerial.read());
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(".");
|
||||
#endif
|
||||
while (Serial.available()) {
|
||||
MySerial.write((uint8_t)Serial.read());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EspInterface::main(uint32_t current_time) {
|
||||
if (current_time - this->initTime >= 1000) {
|
||||
this->initTime = millis();
|
||||
//MySerial.write("PING");
|
||||
}
|
||||
|
||||
while (MySerial.available()) {
|
||||
Serial.print((char)MySerial.read());
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
MySerial.write((uint8_t)Serial.read());
|
||||
}
|
||||
}
|
||||
35
esp32_marauder/esp_interface.h
Normal file
35
esp32_marauder/esp_interface.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef esp_interface_h
|
||||
#define esp_interface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define ESP_RST 14
|
||||
#define ESP_ZERO 13
|
||||
#define BAUD 115200
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class EspInterface {
|
||||
public:
|
||||
bool supported = false;
|
||||
|
||||
uint32_t initTime;
|
||||
|
||||
void RunUpdate();
|
||||
void bootProgramMode();
|
||||
void bootRunMode();
|
||||
void begin();
|
||||
|
||||
void program();
|
||||
void main(uint32_t current_time);
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user