Compare commits
171 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
31393ad572 | ||
|
|
bace9ecf06 | ||
|
|
eb492c4cb7 | ||
|
|
1f980fe8b3 | ||
|
|
5d6e4ca808 | ||
|
|
c32dc08c18 | ||
|
|
df4f3b8102 | ||
|
|
1317276556 | ||
|
|
c0ec1c789e | ||
|
|
730a95de6d | ||
|
|
c871b1b2ab | ||
|
|
e8e1686918 | ||
|
|
8916178526 | ||
|
|
0a9f4edc94 | ||
|
|
c8dcda421d | ||
|
|
ed9a0ec659 | ||
|
|
07424baf64 | ||
|
|
48e0d08477 | ||
|
|
d7cdbbfd8d | ||
|
|
4435aec8d0 | ||
|
|
0a1e044b9a | ||
|
|
d8795de398 | ||
|
|
6ef37f65dc | ||
|
|
5509197b7b | ||
|
|
4aad42907a | ||
|
|
6eac839d72 | ||
|
|
83eb3e9371 | ||
|
|
e7e314b840 | ||
|
|
871ce80947 | ||
|
|
44a4e39c6f | ||
|
|
13271c29b9 | ||
|
|
f929dff7c5 | ||
|
|
9e3f85dd51 | ||
|
|
4a460db4f4 | ||
|
|
329529bbad | ||
|
|
dc39961eb0 | ||
|
|
4b58ed71c7 | ||
|
|
f3d3a099b7 | ||
|
|
9af90a2346 | ||
|
|
6a40de305d | ||
|
|
39e70995a9 | ||
|
|
0369617968 | ||
|
|
019b8438e9 | ||
|
|
6b12c1ee3d | ||
|
|
f111522ed4 | ||
|
|
3423f33976 | ||
|
|
402a6f3932 | ||
|
|
945f8c4aba | ||
|
|
fae983026d | ||
|
|
8d0f8937a8 | ||
|
|
6e89d0b1a0 | ||
|
|
4d4eed809d | ||
|
|
a2eab76caa | ||
|
|
0a4bb9c2b8 | ||
|
|
7edc57f92d | ||
|
|
e3d2086863 | ||
|
|
22dc0ff396 | ||
|
|
7b2b1b2fe9 |
78
.travis.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
sudo: required
|
||||
|
||||
language: python
|
||||
python: 3.6
|
||||
|
||||
env:
|
||||
global:
|
||||
# The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
|
||||
- APPLICATION_FOLDER="${HOME}/arduino-ide"
|
||||
- SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook"
|
||||
|
||||
before_install:
|
||||
|
||||
- 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
|
||||
- git fetch --tags
|
||||
# Checkout the latest tag
|
||||
- git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
|
||||
- source "${HOME}/scripts/arduino-ci-script/arduino-ci-script.sh"
|
||||
|
||||
#- set_script_verbosity 1
|
||||
#- set_verbose_output_during_compilation "true"
|
||||
|
||||
# Check for library issues that don't affect compilation
|
||||
- set_library_testing "true"
|
||||
|
||||
- set_application_folder "$APPLICATION_FOLDER"
|
||||
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"
|
||||
|
||||
#- install_ide '("1.8.11" "1.8.12" "newest")'
|
||||
- install_ide '("newest")'
|
||||
|
||||
# Install the library from the repository
|
||||
#- 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
|
||||
#- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "boardsmanager.additional.urls=https://dl.espressif.com/dl/package_esp32_index.json" --save-prefs &>/dev/null
|
||||
#- /home/travis/arduino-ide/arduino-1.8.10/arduino --install-boards esp32:esp32 &>/dev/null
|
||||
- pip install pyserial
|
||||
|
||||
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"
|
||||
- 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
|
||||
- USER_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 1)"
|
||||
- REPOSITORY_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 2)"
|
||||
- publish_report_to_repository "$REPORT_GITHUB_TOKEN" "https://github.com/${USER_NAME}/CI-reports.git" "$REPOSITORY_NAME" "build_$(printf "%05d\n" "${TRAVIS_BUILD_NUMBER}")" "false"
|
||||
# Print a tab separated report of all sketch verification results to the log
|
||||
- display_report
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
on_failure: always
|
||||
webhooks:
|
||||
urls:
|
||||
- https://www.travisbuddy.com/
|
||||
on_success: never
|
||||
on_failure: always
|
||||
BIN
3Dfiles/ESP32 Marauder V6 Backplate_external.stl
Normal file
BIN
3Dfiles/ESP32 Marauder V6 Backplate_internal.stl
Normal file
BIN
3Dfiles/ESP32_Marauder_Enclosure_body_3_antenna_sd.stl
Normal file
|
Can't render this file because it contains an unexpected character in line 11 and column 76.
|
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Just Call Me Koko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
90
README.md
@@ -1,79 +1,31 @@
|
||||
# ESP32 Marauder
|
||||
<!---[](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.9.0
|
||||
<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)
|
||||
- [Flashing Firmware](#flashing-firmware)
|
||||
- [Setting Up Arduino IDE](#setting-up-arduino-ide)
|
||||
- [Under Development](#under-development)
|
||||
- [Special Thanks](#special-thanks)
|
||||
- [For Sale Soon](#for-sale-soon)
|
||||
Catch my live stream on [Twitch](https://www.twitch.tv/willstunforfood) where I play games, have just chatting sessions to talk tech, and just generally be an ordinary person who can't figure out how to make proper life decisions.
|
||||
|
||||
## Getting Started
|
||||
Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the firmware.
|
||||
|
||||
# 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.
|
||||
|
||||
### 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
|
||||
|
||||
### Developing
|
||||
- Emulate Bluetooth: Emulate a bluetooth device with a specific name
|
||||
- Packet Monitor: Show WiFi packet density on a given channel using a time bar graph
|
||||
|
||||
# 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
|
||||
|
||||
## Flashing Firmware
|
||||
### Setting Up 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`
|
||||
6. 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
|
||||
7. Install Bodmer's [TFT_eSPI](https://github.com/Bodmer/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
|
||||
8. Follow [these instructions](https://github.com/me-no-dev/arduino-esp32fs-plugin) for installing ESP32 Spiffs Tool
|
||||
9. Install the [CH340 Drivers](https://github.com/justcallmekoko/ESP32Marauder/blob/master/Drivers/CH34x_Install_Windows_v3_4.EXE)
|
||||
|
||||
# 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
|
||||
- [Bodmer](https://github.com/Bodmer) for a comprehensive TFT touch screen library [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI)
|
||||
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/)
|
||||
|
||||
<a href="https://www.tindie.com/stores/justcallmekoko/?ref=offsite_badges&utm_source=sellers_justcallmekoko&utm_medium=badges&utm_campaign=badge_large"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>
|
||||
|
||||
@@ -250,10 +250,10 @@
|
||||
// The RPi typically only works at 20MHz maximum.
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
#define SPI_FREQUENCY 5000000
|
||||
//define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
//#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
300
esp32_marauder/Assets.h
Normal file
43
esp32_marauder/BatteryInterface.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "BatteryInterface.h"
|
||||
|
||||
BatteryInterface::BatteryInterface() {
|
||||
|
||||
}
|
||||
|
||||
void BatteryInterface::main(uint32_t currentTime) {
|
||||
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("Battery Level changed: " + (String)new_level);
|
||||
this->battery_level = new_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BatteryInterface::RunSetup() {
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
int8_t BatteryInterface::getBatteryLevel() {
|
||||
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;
|
||||
}
|
||||
28
esp32_marauder/BatteryInterface.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef BatteryInterface_h
|
||||
#define BatteryInterface_h
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
#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
|
||||
202
esp32_marauder/Buffer.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
#include "Buffer.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("file closed");
|
||||
}
|
||||
|
||||
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("Failed to open file '"+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("Failed to open file '"+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;
|
||||
}
|
||||
41
esp32_marauder/Buffer.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef Buffer_h
|
||||
#define Buffer_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.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;
|
||||
|
||||
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
|
||||
@@ -1,11 +1,16 @@
|
||||
#include "Display.h"
|
||||
|
||||
|
||||
/*
|
||||
Big thanks to bodmer for having great TFT and JPEG libraries
|
||||
|
||||
https://github.com/bodmer
|
||||
*/
|
||||
|
||||
//PROGMEM lv_obj_t * slider_label;
|
||||
//PROGMEM lv_obj_t * ta1;
|
||||
//PROGMEM lv_obj_t * ta2;
|
||||
|
||||
Display::Display()
|
||||
{
|
||||
}
|
||||
@@ -16,7 +21,7 @@ void Display::RunSetup()
|
||||
run_setup = false;
|
||||
|
||||
// Need to declare new
|
||||
display_buffer = new SimpleList<String>();
|
||||
display_buffer = new LinkedList<String>();
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(0); // Portrait
|
||||
@@ -26,36 +31,268 @@ void Display::RunSetup()
|
||||
|
||||
// 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
|
||||
|
||||
#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);
|
||||
|
||||
//tft.fillScreen(TFT_BLACK);
|
||||
clearScreen();
|
||||
|
||||
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);
|
||||
|
||||
|
||||
// Initialize file system
|
||||
// This should probably have its own class
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println("SPIFFS initialisation failed!");
|
||||
Serial.println(F("SPIFFS initialisation failed!"));
|
||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||
}
|
||||
|
||||
//this->initLVGL();
|
||||
|
||||
|
||||
// Draw the title screen
|
||||
drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
//drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
tft.drawCentreString(version_number, 120, 250, 2);
|
||||
//tft.drawCentreString(version_number, 120, 250, 2);
|
||||
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
//digitalWrite(TFT_BL, HIGH);
|
||||
|
||||
delay(5000);
|
||||
//delay(5000);
|
||||
}
|
||||
|
||||
/* Interrupt driven periodic handler */
|
||||
/*
|
||||
void Display::lv_tick_handler()
|
||||
{
|
||||
lv_tick_inc(LVGL_TICK_PERIOD);
|
||||
}*/
|
||||
|
||||
/* Display flushing */
|
||||
/*
|
||||
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
extern Display display_obj;
|
||||
uint16_t c;
|
||||
|
||||
display_obj.tft.startWrite();
|
||||
display_obj.tft.setAddrWindow(area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1));
|
||||
for (int y = area->y1; y <= area->y2; y++) {
|
||||
for (int x = area->x1; x <= area->x2; x++) {
|
||||
c = color_p->full;
|
||||
display_obj.tft.writeColor(c, 1);
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
display_obj.tft.endWrite();
|
||||
lv_disp_flush_ready(disp);
|
||||
}
|
||||
|
||||
|
||||
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
||||
{
|
||||
extern Display display_obj;
|
||||
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
bool touched = display_obj.tft.getTouch(&touchX, &touchY, 600);
|
||||
|
||||
if(!touched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(touchX>WIDTH_1 || touchY > HEIGHT_1)
|
||||
{
|
||||
Serial.println("Y or y outside of expected parameters..");
|
||||
Serial.print("y:");
|
||||
Serial.print(touchX);
|
||||
Serial.print(" x:");
|
||||
Serial.print(touchY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
|
||||
//if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y);
|
||||
|
||||
data->point.x = touchX;
|
||||
data->point.y = touchY;
|
||||
|
||||
Serial.print("Data x");
|
||||
Serial.println(touchX);
|
||||
|
||||
Serial.print("Data y");
|
||||
Serial.println(touchY);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}*/
|
||||
|
||||
void Display::tftDrawGraphObjects(byte x_scale)
|
||||
{
|
||||
//draw the graph objects
|
||||
tft.fillRect(11, 5, x_scale+1, 120, TFT_BLACK); // positive start point
|
||||
tft.fillRect(11, 121, x_scale+1, 119, TFT_BLACK); // negative start point
|
||||
tft.drawFastVLine(10, 5, 230, TFT_WHITE); // y axis
|
||||
tft.drawFastHLine(10, HEIGHT_1 - 1, 310, TFT_WHITE); // x axis
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(1); // set parameters for y axis labels
|
||||
//tft.setCursor(3, 116); tft.print(midway); // "0" at center of ya axis
|
||||
tft.setCursor(3, 6); tft.print("+"); // "+' at top of y axis
|
||||
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
|
||||
tft.setTextSize(1); tft.setTextColor(TFT_WHITE);
|
||||
tft.fillRect(14, 0, 15, 8, TFT_GREEN); tft.setCursor(30, 0); tft.print(" - Beacons");
|
||||
tft.fillRect(14, 8, 15, 8, TFT_RED); tft.setCursor(30, 8); tft.print(" - Deauths");
|
||||
tft.fillRect(14, 16, 15, 8, TFT_BLUE); tft.setCursor(30, 16); tft.print(" - Probes");
|
||||
}
|
||||
|
||||
void Display::tftDrawXScaleButtons(byte x_scale)
|
||||
{
|
||||
tft.drawFastVLine(234, 0, 20, TFT_WHITE);
|
||||
tft.setCursor(208, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("X Scale:"); tft.print(x_scale);
|
||||
|
||||
key[0].initButton(&tft, // x - box
|
||||
220,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_CYAN, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"-",
|
||||
2);
|
||||
key[1].initButton(&tft, // x + box
|
||||
249,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_CYAN, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"+",
|
||||
2);
|
||||
|
||||
key[0].setLabelDatum(1, 5, MC_DATUM);
|
||||
key[1].setLabelDatum(1, 5, MC_DATUM);
|
||||
|
||||
key[0].drawButton();
|
||||
key[1].drawButton();
|
||||
}
|
||||
|
||||
void Display::tftDrawYScaleButtons(byte y_scale)
|
||||
{
|
||||
tft.drawFastVLine(290, 0, 20, TFT_WHITE);
|
||||
tft.setCursor(265, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Y Scale:"); tft.print(y_scale);
|
||||
|
||||
key[2].initButton(&tft, // y - box
|
||||
276,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_MAGENTA, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"-",
|
||||
2);
|
||||
key[3].initButton(&tft, // y + box
|
||||
305,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_MAGENTA, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"+",
|
||||
2);
|
||||
|
||||
key[2].setLabelDatum(1, 5, MC_DATUM);
|
||||
key[3].setLabelDatum(1, 5, MC_DATUM);
|
||||
|
||||
key[2].drawButton();
|
||||
key[3].drawButton();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
key[4].initButton(&tft, // channel - box
|
||||
164,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_BLUE, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"-",
|
||||
2);
|
||||
key[5].initButton(&tft, // channel + box
|
||||
193,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_BLUE, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"+",
|
||||
2);
|
||||
|
||||
key[4].setLabelDatum(1, 5, MC_DATUM);
|
||||
key[5].setLabelDatum(1, 5, MC_DATUM);
|
||||
|
||||
key[4].drawButton();
|
||||
key[5].drawButton();
|
||||
}
|
||||
|
||||
void Display::tftDrawExitScaleButtons()
|
||||
{
|
||||
//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);
|
||||
|
||||
key[6].initButton(&tft, // Exit box
|
||||
137,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
TFT_ORANGE, // Outline
|
||||
TFT_RED, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"X",
|
||||
2);
|
||||
|
||||
key[6].setLabelDatum(1, 5, MC_DATUM);
|
||||
|
||||
key[6].drawButton();
|
||||
}
|
||||
|
||||
void Display::twoPartDisplay(String center_text)
|
||||
{
|
||||
tft.setTextColor(TFT_BLACK, TFT_YELLOW);
|
||||
tft.fillRect(0,16,240,144, TFT_YELLOW);
|
||||
tft.fillRect(0,16,HEIGHT_1,144, TFT_YELLOW);
|
||||
//tft.drawCentreString(center_text,120,82,1);
|
||||
tft.setTextWrap(true);
|
||||
tft.setFreeFont(NULL);
|
||||
@@ -70,15 +307,15 @@ void Display::twoPartDisplay(String center_text)
|
||||
void Display::touchToExit()
|
||||
{
|
||||
tft.setTextColor(TFT_BLACK, TFT_LIGHTGREY);
|
||||
tft.fillRect(0,16,240,16, TFT_LIGHTGREY);
|
||||
tft.drawCentreString("Touch screen to exit",120,16,2);
|
||||
tft.fillRect(0,32,HEIGHT_1,16, TFT_LIGHTGREY);
|
||||
tft.drawCentreString("Touch screen to exit",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);
|
||||
}
|
||||
@@ -98,6 +335,7 @@ void Display::displayBuffer(bool do_clear)
|
||||
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);
|
||||
@@ -119,7 +357,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;
|
||||
@@ -137,7 +375,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +413,10 @@ 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()");
|
||||
Serial.println(F("setupScrollArea()"));
|
||||
Serial.println(" tfa: " + (String)tfa);
|
||||
Serial.println(" bfa: " + (String)bfa);
|
||||
Serial.println("yStart: " + (String)this->yStart);
|
||||
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
|
||||
tft.writedata(tfa >> 8); // Top Fixed Area line count
|
||||
tft.writedata(tfa);
|
||||
@@ -220,10 +461,19 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
||||
jpegRender(xpos, ypos);
|
||||
}
|
||||
else {
|
||||
Serial.println("Jpeg file format not supported!");
|
||||
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
|
||||
@@ -231,13 +481,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,16 +649,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()) {
|
||||
|
||||
@@ -386,13 +684,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()) {
|
||||
@@ -425,22 +723,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;
|
||||
}
|
||||
|
||||
@@ -474,8 +772,164 @@ void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void Display::main()
|
||||
|
||||
void Display::updateBanner(String msg)
|
||||
{
|
||||
this->img.deleteSprite();
|
||||
|
||||
this->img.setColorDepth(8);
|
||||
|
||||
this->img.createSprite(SCREEN_WIDTH, TEXT_HEIGHT);
|
||||
|
||||
this->buildBanner(msg, current_banner_pos);
|
||||
|
||||
this->img.pushSprite(0, STATUS_BAR_WIDTH);
|
||||
|
||||
current_banner_pos--;
|
||||
|
||||
if (current_banner_pos <= 0)
|
||||
current_banner_pos = SCREEN_WIDTH + 2;
|
||||
}
|
||||
|
||||
|
||||
void Display::buildBanner(String msg, int xpos)
|
||||
{
|
||||
int h = TEXT_HEIGHT;
|
||||
|
||||
// We could just use fillSprite(color) but lets be a bit more creative...
|
||||
|
||||
// Fill with rainbow stripes
|
||||
//while (h--) img.drawFastHLine(0, h, SCREEN_WIDTH, 255);
|
||||
|
||||
// Draw some graphics, the text will apear to scroll over these
|
||||
//img.fillRect (SCREEN_WIDTH / 2 - 20, TEXT_HEIGHT / 2 - 10, 40, 20, TFT_YELLOW);
|
||||
//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.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
|
||||
|
||||
// Need to print twice so text appears to wrap around at left and right edges
|
||||
img.setCursor(xpos, 2); // Print text at xpos
|
||||
img.print(msg);
|
||||
|
||||
img.setCursor(xpos - SCREEN_WIDTH, 2); // Print text at xpos - sprite width
|
||||
img.print(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
void Display::initLVGL() {
|
||||
tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler);
|
||||
|
||||
lv_init();
|
||||
|
||||
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
|
||||
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
disp_drv.hor_res = WIDTH_1;
|
||||
disp_drv.ver_res = HEIGHT_1;
|
||||
disp_drv.flush_cb = my_disp_flush;
|
||||
disp_drv.buffer = &disp_buf;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
}
|
||||
|
||||
|
||||
void Display::deinitLVGL() {
|
||||
Serial.println(F("Deinit LVGL"));
|
||||
//lv_deinit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Display::joinWiFiGFX(){
|
||||
|
||||
// Create one text area
|
||||
ta1 = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_width(ta1, LV_HOR_RES / 2 - 20);
|
||||
lv_obj_set_pos(ta1, 5, 20);
|
||||
//lv_ta_set_cursor_type(ta, LV_CURSOR_BLOCK);
|
||||
lv_textarea_set_text(ta1, "");
|
||||
lv_obj_set_event_cb(ta1, ta_event_cb);
|
||||
|
||||
// Create first label
|
||||
lv_obj_t * ssid_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(ssid_label, "SSID:");
|
||||
lv_obj_align(ssid_label, ta1, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
// Create second text area
|
||||
ta2 = lv_textarea_create(lv_scr_act(), ta1);
|
||||
//lv_textarea_set_pwd_mode(ta2, true); // This shit makes it so backspace does not work
|
||||
//lv_textarea_set_pwd_show_time(ta2, 1000);
|
||||
lv_textarea_set_cursor_hidden(ta2, true);
|
||||
lv_obj_align(ta2, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20);
|
||||
|
||||
// Create second label
|
||||
lv_obj_t * pw_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(pw_label, "Password:");
|
||||
lv_obj_align(pw_label, ta2, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
// Create a keyboard and apply the styles
|
||||
kb = lv_keyboard_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_set_event_cb(kb, keyboard_event_cb);
|
||||
|
||||
// Focus it on one of the text areas to start
|
||||
lv_keyboard_set_textarea(kb, ta1);
|
||||
lv_keyboard_set_cursor_manage(kb, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event){
|
||||
extern Display display_obj;
|
||||
lv_keyboard_def_event_cb(kb, event);
|
||||
if(event == LV_EVENT_APPLY){
|
||||
printf("LV_EVENT_APPLY\n");
|
||||
//String ta1_text = lv_textarea_get_text(lv_keyboard_get_textarea(kb));
|
||||
String ta1_text = lv_textarea_get_text(ta1);
|
||||
String ta2_text = lv_textarea_get_text(ta2);
|
||||
Serial.println(ta1_text);
|
||||
Serial.println(ta2_text);
|
||||
//joinWiFi(ta1_text, ta2_text);
|
||||
}else if(event == LV_EVENT_CANCEL){
|
||||
printf("LV_EVENT_CANCEL\n");
|
||||
//lv_textarea_set_text(lv_keyboard_get_textarea(kb), "");
|
||||
display_obj.deinitLVGL();
|
||||
display_obj.exit_draw = true; // set everything back to normal
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ta_event_cb(lv_obj_t * ta, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
if(kb != NULL)
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
|
||||
//else if(event == LV_EVENT_INSERT) {
|
||||
// const char * str = lv_event_get_data();
|
||||
// if(str[0] == '\n') {
|
||||
// printf("Ready\n");
|
||||
// }
|
||||
//}
|
||||
}*/
|
||||
|
||||
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
|
||||
|
||||
@@ -5,19 +5,58 @@
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <JPEGDecoder.h>
|
||||
#include <SimpleList.h>
|
||||
//#include <SimpleList.h>
|
||||
#include <LinkedList.h>
|
||||
#include <SPI.h>
|
||||
#include <lvgl.h>
|
||||
#include <Ticker.h>
|
||||
//#include <M5Stack.h>
|
||||
#include "SPIFFS.h"
|
||||
#include <TFT_eSPI.h>
|
||||
//#include "Free_Fonts.h"
|
||||
#include "Assets.h"
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
#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
|
||||
|
||||
// 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
|
||||
|
||||
#define TFT_SHIELD
|
||||
//#define TFT_DIY
|
||||
|
||||
#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 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
|
||||
@@ -25,7 +64,25 @@
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 8
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
/*
|
||||
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;
|
||||
*/
|
||||
|
||||
class Display
|
||||
{
|
||||
@@ -43,19 +100,25 @@ class Display
|
||||
//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();
|
||||
String version_number = "v0.1";
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
const String PROGMEM version_number = "v0.9.0";
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
bool tteBar = false;
|
||||
bool draw_tft = false;
|
||||
bool exit_draw = false;
|
||||
|
||||
int TOP_FIXED_AREA_2 = 32;
|
||||
int TOP_FIXED_AREA_2 = 48;
|
||||
int print_delay_1, print_delay_2 = 10;
|
||||
int current_banner_pos = SCREEN_WIDTH;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
@@ -63,7 +126,7 @@ class Display
|
||||
//Menu wifiMenu;
|
||||
//Menu bluetoothMenu;
|
||||
|
||||
SimpleList<String>* display_buffer;
|
||||
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;
|
||||
@@ -72,18 +135,30 @@ class Display
|
||||
uint16_t xPos = 0;
|
||||
|
||||
// The initial y coordinate of the top of the scrolling area
|
||||
uint16_t yStart = TOP_FIXED_AREA;
|
||||
uint16_t yStart = TOP_FIXED_AREA_2;
|
||||
// yArea must be a integral multiple of TEXT_HEIGHT
|
||||
uint16_t yArea = YMAX - TOP_FIXED_AREA - BOT_FIXED_AREA;
|
||||
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 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);
|
||||
@@ -91,7 +166,7 @@ class Display
|
||||
void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void main();
|
||||
void main(uint8_t scan_mode);
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
int scroll_line(uint32_t color);
|
||||
@@ -99,5 +174,6 @@ class Display
|
||||
void showCenterText(String text, int y);
|
||||
void touchToExit();
|
||||
void twoPartDisplay(String center_text);
|
||||
void updateBanner(String msg);
|
||||
};
|
||||
#endif
|
||||
|
||||
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
@@ -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
|
||||
@@ -1,11 +1,24 @@
|
||||
#ifndef MenuFunctions_h
|
||||
#define MenuFunctions_h
|
||||
|
||||
#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"
|
||||
|
||||
|
||||
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;
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
@@ -15,68 +28,172 @@ extern WiFiScan wifi_scan_obj;
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define BUTTON_ARRAY_LEN 5
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
|
||||
#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
|
||||
|
||||
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 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;
|
||||
uint16_t color;
|
||||
Menu *childMenu;
|
||||
TFT_eSPI_Button* button;
|
||||
std::function<void()> callable; // Make a function that changes menu to a child menu
|
||||
String name;
|
||||
uint16_t color;
|
||||
int icon;
|
||||
TFT_eSPI_Button* button;
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
// Full Menus
|
||||
struct Menu {
|
||||
String name;
|
||||
SimpleList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
uint8_t selected;
|
||||
String name;
|
||||
LinkedList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
//uint8_t selected;
|
||||
};
|
||||
|
||||
|
||||
class MenuFunctions
|
||||
{
|
||||
private:
|
||||
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 infoMenu;
|
||||
|
||||
// WiFi menu stuff
|
||||
Menu wifiSnifferMenu;
|
||||
Menu wifiScannerMenu;
|
||||
Menu wifiAttackMenu;
|
||||
Menu wifiGeneralMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
Menu bluetoothScannerMenu;
|
||||
Menu bluetoothGeneralMenu;
|
||||
|
||||
// Settings things menus
|
||||
Menu shutdownWiFiMenu;
|
||||
Menu shutdownBLEMenu;
|
||||
Menu generateSSIDsMenu;
|
||||
Menu clearSSIDsMenu;
|
||||
|
||||
static void lv_tick_handler();
|
||||
|
||||
// Menu icons
|
||||
|
||||
|
||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
|
||||
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 drawStatusBar();
|
||||
void updateStatusBar();
|
||||
void battery(bool initial = false);
|
||||
void battery2(bool initial = false);
|
||||
void showMenuList(Menu* menu, int layer);
|
||||
void orientDisplay();
|
||||
|
||||
public:
|
||||
public:
|
||||
MenuFunctions();
|
||||
|
||||
Ticker tick;
|
||||
|
||||
uint16_t x = -1, y = -1;
|
||||
boolean pressed = false;
|
||||
|
||||
String loaded_file = "";
|
||||
|
||||
void initLVGL();
|
||||
void deinitLVGL();
|
||||
void joinWiFiGFX();
|
||||
void addSSIDGFX();
|
||||
void writeBadUSB();
|
||||
|
||||
void buildButtons(Menu* menu);
|
||||
void changeMenu(Menu* menu);
|
||||
void displayCurrentMenu();
|
||||
void main();
|
||||
void main(uint32_t currentTime);
|
||||
void RunSetup();
|
||||
};
|
||||
|
||||
|
||||
BIN
esp32_marauder/PreviousVersions/esp32_marauder_v0_2_20200117.bin
Normal file
180
esp32_marauder/SDInterface.cpp
Normal file
@@ -0,0 +1,180 @@
|
||||
#include "SDInterface.h"
|
||||
|
||||
bool SDInterface::initSD() {
|
||||
String display_string = "";
|
||||
|
||||
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->cardSizeBT = SD.cardSize();
|
||||
//this->cardSizeKB = SD.cardSize() / 1024;
|
||||
this->cardSizeMB = SD.cardSize() / (1024 * 1024);
|
||||
//this->cardSizeGB = SD.cardSize() / (1024 * 1024 * 1024);
|
||||
|
||||
//Serial.printf("SD Card Size: %llu Bytes\n", this->cardSizeBT);
|
||||
//Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||
//Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
||||
|
||||
if (this->supported) {
|
||||
//display_obj.tft.println((byte)(sd_obj.cardSizeMB % 10));
|
||||
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 = display_string;
|
||||
this->card_sz = sz;
|
||||
}
|
||||
|
||||
buffer_obj = Buffer();
|
||||
|
||||
//if (this->supported)
|
||||
// buffer_obj.open(&SD);
|
||||
|
||||
// Check for SCRIPTS folder
|
||||
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)) {
|
||||
//Serial.println("Adding packet to buffer...");
|
||||
buffer_obj.addPacket(buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::openCapture(String file_name) {
|
||||
if (this->supported)
|
||||
buffer_obj.open(&SD, file_name);
|
||||
}
|
||||
|
||||
void SDInterface::runUpdate() {
|
||||
//display_obj.clearScreen();
|
||||
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("Opening /update.bin..."));
|
||||
File updateBin = SD.open("/update.bin");
|
||||
if (updateBin) {
|
||||
if(updateBin.isDirectory()){
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Error, could not find update.bin"));
|
||||
Serial.println(F("Error, update.bin is not a file"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
updateBin.close();
|
||||
return;
|
||||
}
|
||||
|
||||
size_t updateSize = updateBin.size();
|
||||
|
||||
if (updateSize > 0) {
|
||||
display_obj.tft.println(F("Starting SD Update..."));
|
||||
Serial.println(F("Try to start update"));
|
||||
this->performUpdate(updateBin, updateSize);
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Error, update.bin is empty"));
|
||||
Serial.println(F("Error, file is empty"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
return;
|
||||
}
|
||||
|
||||
updateBin.close();
|
||||
|
||||
// whe finished remove the binary from sd card to indicate end of the process
|
||||
display_obj.tft.println(F("rebooting..."));
|
||||
Serial.println(F("rebooting..."));
|
||||
//SD.remove("/update.bin");
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Could not load update.bin from /"));
|
||||
Serial.println(F("Could not load update.bin from sd root"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
||||
if (Update.begin(updateSize)) {
|
||||
display_obj.tft.println("File size: " + String(updateSize));
|
||||
display_obj.tft.println(F("Writing file to partition..."));
|
||||
size_t written = Update.writeStream(updateSource);
|
||||
if (written == updateSize) {
|
||||
display_obj.tft.println("Written: " + String(written) + " successfully");
|
||||
Serial.println("Written : " + String(written) + " successfully");
|
||||
}
|
||||
else {
|
||||
display_obj.tft.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?");
|
||||
Serial.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?");
|
||||
}
|
||||
if (Update.end()) {
|
||||
Serial.println("OTA done!");
|
||||
if (Update.isFinished()) {
|
||||
display_obj.tft.println(F("Update complete"));
|
||||
Serial.println(F("Update successfully completed. Rebooting."));
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println("Update could not complete");
|
||||
Serial.println("Update not finished? Something went wrong!");
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
display_obj.tft.println("Error Occurred. Error #: " + String(Update.getError()));
|
||||
Serial.println("Error Occurred. Error #: " + String(Update.getError()));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
display_obj.tft.println("Not enough space to begin OTA");
|
||||
Serial.println("Not enough space to begin OTA");
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::main() {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Saving packet...");
|
||||
buffer_obj.forceSave(&SD);
|
||||
}
|
||||
}
|
||||
|
||||
//void SDInterface::savePacket(uint8_t* buf, uint32_t len) {
|
||||
// if (this->supported)
|
||||
// buffer_obj.save(
|
||||
//}
|
||||
39
esp32_marauder/SDInterface.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef SDInterface_h
|
||||
#define SDInterface_h
|
||||
|
||||
#include "SD.h"
|
||||
#include "Buffer.h"
|
||||
#include "Display.h"
|
||||
#include <Update.h>
|
||||
|
||||
extern Buffer buffer_obj;
|
||||
extern Display display_obj;
|
||||
|
||||
#define SD_CS 12
|
||||
|
||||
class SDInterface {
|
||||
|
||||
private:
|
||||
|
||||
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
|
||||
33
esp32_marauder/TemperatureInterface.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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() {
|
||||
return ((temprature_sens_read() - 32) / 1.8);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
esp32_marauder/TemperatureInterface.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef TemperatureInterface_h
|
||||
#define TemperatureInterface_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
|
||||
185
esp32_marauder/Web.cpp
Normal file
@@ -0,0 +1,185 @@
|
||||
#include "Web.h"
|
||||
|
||||
WebServer server(80);
|
||||
|
||||
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)
|
||||
{
|
||||
this->num_sta = current_sta;
|
||||
Serial.print("Update server: Client disconnected -> ");
|
||||
Serial.println(this->num_sta);
|
||||
}
|
||||
else if (current_sta > this->num_sta)
|
||||
{
|
||||
this->num_sta = current_sta;
|
||||
Serial.print("Update server: Client connected -> ");
|
||||
Serial.println(this->num_sta);
|
||||
}
|
||||
|
||||
|
||||
server.handleClient();
|
||||
delay(1);
|
||||
}
|
||||
|
||||
// Callback for the embedded jquery.min.js page
|
||||
void Web::onJavaScript(void) {
|
||||
Serial.println("onJavaScript(void)");
|
||||
server.setContentLength(jquery_min_js_v3_2_1_gz_len);
|
||||
server.sendHeader(F("Content-Encoding"), F("gzip"));
|
||||
server.send_P(200, "text/javascript", jquery_min_js_v3_2_1_gz, jquery_min_js_v3_2_1_gz_len);
|
||||
}
|
||||
|
||||
void Web::setupOTAupdate()
|
||||
{
|
||||
uint8_t newMACAddress[] = {0x06, 0x07, 0x0D, 0x09, 0x0E, 0x0D};
|
||||
|
||||
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);
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
display_obj.tft.print("Configuring update server...\n\n");
|
||||
Serial.println("Configuring update server...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
|
||||
// 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(ESP_IF_WIFI_AP, &newMACAddress[0]);
|
||||
WiFi.softAP(ssid, password);
|
||||
Serial.println("");
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
Serial.println("Displaying settings to TFT...");
|
||||
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.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]() {
|
||||
server.sendHeader("Connection", "close");
|
||||
server.send(200, "text/html", loginIndex);
|
||||
});
|
||||
server.on("/serverIndex", HTTP_GET, [this]() {
|
||||
server.sendHeader("Connection", "close");
|
||||
server.send(200, "text/html", serverIndex);
|
||||
});
|
||||
/*handling uploading firmware file */
|
||||
server.on("/update", HTTP_POST, [this]() {
|
||||
server.sendHeader("Connection", "close");
|
||||
server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
|
||||
ESP.restart();
|
||||
}, [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);
|
||||
Serial.printf("Update: %s\n", upload.filename.c_str());
|
||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
|
||||
Update.printError(Serial);
|
||||
}
|
||||
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||
/* flashing firmware to ESP*/
|
||||
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");
|
||||
|
||||
//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");
|
||||
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
|
||||
delay(1000);
|
||||
} else {
|
||||
Update.printError(Serial);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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");
|
||||
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());
|
||||
}
|
||||
132
esp32_marauder/Web.h
Normal file
@@ -0,0 +1,132 @@
|
||||
#ifndef Web_h
|
||||
#define Web_h
|
||||
|
||||
/*
|
||||
Code taken from espressif ESP32 OTA Update example
|
||||
*/
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WebServer.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <Update.h>
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
#include "WiFiScan.h"
|
||||
|
||||
extern Display display_obj;
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
|
||||
class Web
|
||||
{
|
||||
private:
|
||||
|
||||
PROGMEM const char* host = "esp32marauder";
|
||||
PROGMEM const char* ssid = "MarauderOTA";
|
||||
PROGMEM const char* password = "justcallmekoko";
|
||||
|
||||
bool serving = false;
|
||||
|
||||
int num_sta = 0;
|
||||
|
||||
PROGMEM const char* loginIndex =
|
||||
"<form name='loginForm'>"
|
||||
"<table width='20%' bgcolor='A09F9F' align='center'>"
|
||||
"<tr>"
|
||||
"<td colspan=2>"
|
||||
"<center><font size=4><b>ESP32 Login Page</b></font></center>"
|
||||
"<br>"
|
||||
"</td>"
|
||||
"<br>"
|
||||
"<br>"
|
||||
"</tr>"
|
||||
"<td>Username:</td>"
|
||||
"<td><input type='text' size=25 name='userid'><br></td>"
|
||||
"</tr>"
|
||||
"<br>"
|
||||
"<br>"
|
||||
"<tr>"
|
||||
"<td>Password:</td>"
|
||||
"<td><input type='Password' size=25 name='pwd'><br></td>"
|
||||
"<br>"
|
||||
"<br>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td><input type='submit' onclick='check(this.form)' value='Login'></td>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
"</form>"
|
||||
"<script>"
|
||||
"function check(form)"
|
||||
"{"
|
||||
"if(form.userid.value=='admin' && form.pwd.value=='admin')"
|
||||
"{"
|
||||
"window.open('/serverIndex')"
|
||||
"}"
|
||||
"else"
|
||||
"{"
|
||||
" alert('Error Password or Username')/*displays error message*/"
|
||||
"}"
|
||||
"}"
|
||||
"</script>";
|
||||
|
||||
/*
|
||||
* Server Index Page
|
||||
*/
|
||||
|
||||
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/>"
|
||||
"Your web browser probably requests those two files simultaneously and therefore <br/>"
|
||||
"the javascript file failed to load. By a refresh of this page, the browser cash has already <br/>"
|
||||
"load 'serverIndex' file, the web browser will do a second attempt to only read the javascript file. <br/>"
|
||||
"This second attempt, with an idle webserver, will be processed.<br/><br/>"
|
||||
"Long story short, press F5 (refresh web browser) before uploading your firmware. <br/><br/>"
|
||||
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
|
||||
"<input type='file' name='update'>"
|
||||
"<input type='submit' value='Update'>"
|
||||
"</form>"
|
||||
"<div id='prg'>progress: 0%</div>"
|
||||
"<script>"
|
||||
"$('form').submit(function(e){"
|
||||
"e.preventDefault();"
|
||||
"var form = $('#upload_form')[0];"
|
||||
"var data = new FormData(form);"
|
||||
" $.ajax({"
|
||||
"url: '/update',"
|
||||
"type: 'POST',"
|
||||
"data: data,"
|
||||
"contentType: false,"
|
||||
"processData:false,"
|
||||
"xhr: function() {"
|
||||
"var xhr = new window.XMLHttpRequest();"
|
||||
"xhr.upload.addEventListener('progress', function(evt) {"
|
||||
"if (evt.lengthComputable) {"
|
||||
"var per = evt.loaded / evt.total;"
|
||||
"$('#prg').html('progress: ' + Math.round(per*100) + '%');"
|
||||
"}"
|
||||
"}, false);"
|
||||
"return xhr;"
|
||||
"},"
|
||||
"success:function(d, s) {"
|
||||
"console.log('success!')"
|
||||
"},"
|
||||
"error: function (a, b, c) {"
|
||||
"}"
|
||||
"});"
|
||||
"});"
|
||||
"</script>";
|
||||
|
||||
public:
|
||||
|
||||
Web();
|
||||
|
||||
void main();
|
||||
PROGMEM static void onJavaScript();
|
||||
void setupOTAupdate();
|
||||
void shutdownServer();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,44 +1,96 @@
|
||||
#ifndef WiFiScan_h
|
||||
#define WiFiScan_h
|
||||
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEUtils.h>
|
||||
#include <BLEScan.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
//#include <BLEDevice.h>
|
||||
//#include <BLEUtils.h>
|
||||
//#include <BLEScan.h>
|
||||
//#include <BLEAdvertisedDevice.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// Testing NimBLE
|
||||
#include <NimBLEDevice.h>
|
||||
#include <NimBLEAdvertisedDevice.h>
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <math.h>
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_bt.h"
|
||||
#include "Display.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Buffer.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "TemperatureInterface.h"
|
||||
#include "Assets.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_ALL 4
|
||||
#define WIFI_ATTACK_BEACON_SPAM 5
|
||||
#define WIFI_ATTACK_RICK_ROLL 6
|
||||
#define BT_SCAN_ALL 7
|
||||
#define BT_SCAN_SKIMMERS 8
|
||||
#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 GRAPH_REFRESH 100
|
||||
|
||||
#define MAX_CHANNEL 14
|
||||
|
||||
extern Display display_obj;
|
||||
extern SDInterface sd_obj;
|
||||
extern Buffer buffer_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern TemperatureInterface temp_obj;
|
||||
|
||||
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
|
||||
|
||||
struct ssid {
|
||||
String essid;
|
||||
int bssid[6];
|
||||
};
|
||||
|
||||
class WiFiScan
|
||||
{
|
||||
private:
|
||||
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
|
||||
float y_pos_y; //current graph y axis position of Y value
|
||||
float y_pos_y_old = 120; //old y axis position of Y value
|
||||
float y_pos_z; //current graph y axis position of Z value
|
||||
float y_pos_z_old = 120; //old y axis position of Z value
|
||||
int midway = 0;
|
||||
byte x_scale = 1; //scale of graph x axis, controlled by touchscreen buttons
|
||||
byte y_scale = 1;
|
||||
|
||||
bool do_break = 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;
|
||||
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;
|
||||
|
||||
//String connected_network = "";
|
||||
String alfa = "1234567890qwertyuiopasdfghjkklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM_";
|
||||
|
||||
char* rick_roll[8] = {
|
||||
@@ -83,20 +135,68 @@ class WiFiScan
|
||||
/*36*/ 0x00
|
||||
};
|
||||
|
||||
void packetMonitorMain(uint32_t currentTime);
|
||||
void eapolMonitorMain(uint32_t currentTime);
|
||||
void changeChannel();
|
||||
void updateMidway();
|
||||
void tftDrawXScalButtons();
|
||||
void tftDrawYScaleButtons();
|
||||
void tftDrawChannelScaleButtons();
|
||||
void tftDrawColorKey();
|
||||
void tftDrawGraphObjects();
|
||||
void broadcastRandomSSID(uint32_t currentTime);
|
||||
void broadcastCustomBeacon(uint32_t current_time, ssid 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 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);
|
||||
void RunLvJoinWiFi(uint8_t scan_mode, uint16_t color);
|
||||
static void scanCompleteCB(BLEScanResults scanResults);
|
||||
|
||||
public:
|
||||
WiFiScan();
|
||||
|
||||
|
||||
|
||||
//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();
|
||||
|
||||
void RunSetup();
|
||||
int clearSSIDs();
|
||||
bool addSSID(String essid);
|
||||
int generateSSIDs();
|
||||
bool shutdownWiFi();
|
||||
bool shutdownBLE();
|
||||
void joinWiFi(String ssid, String password);
|
||||
String getStaMAC();
|
||||
String getApMAC();
|
||||
String freeRAM();
|
||||
void RunInfo();
|
||||
void RunShutdownWiFi();
|
||||
void RunShutdownBLE();
|
||||
void RunGenerateSSIDs();
|
||||
void RunClearSSIDs();
|
||||
void channelHop();
|
||||
uint8_t currentScanMode = 0;
|
||||
void main(uint32_t currentTime);
|
||||
@@ -104,7 +204,13 @@ 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 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 eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
static void wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
|
||||
};
|
||||
#endif
|
||||
|
||||
66
esp32_marauder/a32u4_interface.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#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;
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
//delay(1);*/
|
||||
}
|
||||
24
esp32_marauder/a32u4_interface.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef a32u4_interface_h
|
||||
#define a32u4_interface_h
|
||||
|
||||
#include "Display.h"
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define BAUD32U4 115200
|
||||
|
||||
extern Display display_obj;
|
||||
|
||||
class A32u4Interface {
|
||||
public:
|
||||
bool supported = false;
|
||||
|
||||
uint32_t initTime;
|
||||
|
||||
void begin();
|
||||
|
||||
void main(uint32_t current_time);
|
||||
void test();
|
||||
void runScript(String script);
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
esp32_marauder/data/marauder3L1.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
@@ -1,7 +1,8 @@
|
||||
/* FLASH SETTINGS
|
||||
Board: LOLIN D32
|
||||
Flash Frequency: 80MHz
|
||||
Partition Scheme: No OTA
|
||||
Partition Scheme: Minimal SPIFFS
|
||||
https://www.online-utility.org/image/convert/to/XBM
|
||||
*/
|
||||
|
||||
#include <WiFi.h>
|
||||
@@ -14,32 +15,185 @@ Partition Scheme: No OTA
|
||||
#include "esp_system.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
#include "WiFiScan.h"
|
||||
#include "MenuFunctions.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
#include "Buffer.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "TemperatureInterface.h"
|
||||
#include "LedInterface.h"
|
||||
#include "esp_interface.h"
|
||||
#include "a32u4_interface.h"
|
||||
//#include "icons.h"
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
*/
|
||||
|
||||
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;
|
||||
A32u4Interface a32u4_obj;
|
||||
|
||||
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Pixels, PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
pinMode(FLASH_BUTTON, INPUT);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
pinMode(BATTERY_PIN, OUTPUT);
|
||||
pinMode(CHARGING_PIN, INPUT);
|
||||
#endif
|
||||
|
||||
// Preset SPI CS pins to avoid bus conflicts
|
||||
digitalWrite(TFT_CS, HIGH);
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.println("\n\n--------------------------------");
|
||||
Serial.println(" ESP32 Marauder ");
|
||||
Serial.println("--------------------------------\n\n");
|
||||
|
||||
//Serial.begin(115200);
|
||||
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
|
||||
// Draw the title screen
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
|
||||
digitalWrite(TFT_BL, HIGH); // Need this
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.clearScreen();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
|
||||
display_obj.tft.println("Giving room for HardwareSerial...");
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.tft.println("Marauder " + display_obj.version_number + "\n");
|
||||
|
||||
display_obj.tft.println("Started Serial");
|
||||
|
||||
Serial.println(F("\n\n--------------------------------\n"));
|
||||
Serial.println(F(" ESP32 Marauder \n"));
|
||||
Serial.println(" " + display_obj.version_number + "\n");
|
||||
Serial.println(F(" By: justcallmekoko\n"));
|
||||
Serial.println(F("--------------------------------\n\n"));
|
||||
|
||||
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
|
||||
|
||||
wifi_scan_obj.RunSetup();
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
display_obj.tft.println("Checked RAM");
|
||||
|
||||
// Do some SD stuff
|
||||
if(sd_obj.initSD()) {
|
||||
Serial.println(F("SD Card supported"));
|
||||
display_obj.tft.println(F("Initialized SD Card"));
|
||||
}
|
||||
else {
|
||||
Serial.println(F("SD Card NOT Supported"));
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println(F("Failed to Initialize SD Card"));
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
}
|
||||
|
||||
// Run display setup
|
||||
display_obj.RunSetup();
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
//display_obj.RunSetup();
|
||||
|
||||
// Build menus
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
//menu_function_obj.RunSetup();
|
||||
|
||||
//display_obj.tft.println("Created Menu Structure");
|
||||
|
||||
// Battery stuff
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
battery_obj.RunSetup();
|
||||
|
||||
display_obj.tft.println(F("Checked battery configuration"));
|
||||
|
||||
// Temperature stuff
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
temp_obj.RunSetup();
|
||||
|
||||
display_obj.tft.println(F("Initialized temperature interface"));
|
||||
|
||||
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"));
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
// Do some LED stuff
|
||||
led_obj.RunSetup();
|
||||
|
||||
display_obj.tft.println(F("Initialized LED Interface"));
|
||||
|
||||
//display_obj.tft.println(F("Starting..."));
|
||||
|
||||
delay(500);
|
||||
|
||||
//display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
// OG Logo Section
|
||||
/*
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
|
||||
// Draw the title screen
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
*/
|
||||
|
||||
esp_obj.begin();
|
||||
|
||||
a32u4_obj.begin(); // This goes last to make sure nothing is messed up when reading serial
|
||||
|
||||
display_obj.tft.println(F("Starting..."));
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
delay(2000);
|
||||
|
||||
menu_function_obj.RunSetup();
|
||||
}
|
||||
|
||||
@@ -51,18 +205,43 @@ void loop()
|
||||
currentTime = millis();
|
||||
|
||||
// Update all of our objects
|
||||
if (!display_obj.draw_tft)
|
||||
//if ((!display_obj.draw_tft) &&
|
||||
// (wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
if ((!display_obj.draw_tft) && (wifi_scan_obj.currentScanMode != ESP_UPDATE))
|
||||
{
|
||||
display_obj.main();
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
wifi_scan_obj.main(currentTime);
|
||||
sd_obj.main();
|
||||
battery_obj.main(currentTime);
|
||||
temp_obj.main(currentTime);
|
||||
esp_obj.main(currentTime);
|
||||
a32u4_obj.main(currentTime);
|
||||
//led_obj.main(currentTime);
|
||||
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
|
||||
menu_function_obj.main();
|
||||
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL))
|
||||
menu_function_obj.main(currentTime);
|
||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
||||
web_obj.main();
|
||||
delay(1);
|
||||
}
|
||||
else
|
||||
else if ((display_obj.draw_tft) &&
|
||||
(wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
{
|
||||
display_obj.drawStylus();
|
||||
}
|
||||
else if (wifi_scan_obj.currentScanMode == ESP_UPDATE) {
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
menu_function_obj.main(currentTime);
|
||||
esp_obj.program();
|
||||
delay(1);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// web_obj.main();
|
||||
//}
|
||||
|
||||
//Serial.println(wifi_scan_obj.currentScanMode);
|
||||
|
||||
//Serial.print("Run Time: ");
|
||||
//Serial.print(millis() - currentTime);
|
||||
|
||||
BIN
esp32_marauder/esp32_marauder_v0_9_0_20210506_new_hardware.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_0_20210506_old_hardware.bin
Normal file
126
esp32_marauder/esp_interface.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
#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);
|
||||
|
||||
display_obj.tft.println("Checking for ESP8266...");
|
||||
|
||||
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") {
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
Serial.println("ESP8266 Found!");
|
||||
this->supported = true;
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
}
|
||||
|
||||
void EspInterface::RunUpdate() {
|
||||
this->bootProgramMode();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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()) {
|
||||
display_obj.tft.print(".");
|
||||
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());
|
||||
}
|
||||
}
|
||||
28
esp32_marauder/esp_interface.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef esp_interface_h
|
||||
#define esp_interface_h
|
||||
|
||||
#include "Display.h"
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define ESP_RST 14
|
||||
#define ESP_ZERO 13
|
||||
#define BAUD 115200
|
||||
|
||||
extern Display display_obj;
|
||||
|
||||
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
|
||||
37
esp8266_marauder/esp8266_marauder.ino
Normal file
@@ -0,0 +1,37 @@
|
||||
// the setup function runs once when you press reset or power the board
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
delay(100);
|
||||
|
||||
// initialize digital pin LED_BUILTIN as an output.
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
}
|
||||
|
||||
// the loop function runs over and over again forever
|
||||
void loop() {
|
||||
//digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||
//delay(1000); // wait for a second
|
||||
//digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
|
||||
//delay(1000); // wait for a second
|
||||
|
||||
if (Serial.available()) {
|
||||
String input = Serial.readString();
|
||||
|
||||
input.trim();
|
||||
|
||||
if (input == "PING") {
|
||||
Serial.println("ESP8266 Pong");
|
||||
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
delay(1);
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
}
|
||||
|
||||
//Serial.println(input);
|
||||
}
|
||||
else
|
||||
delay(1);
|
||||
}
|
||||
240
old_README.md
Normal file
@@ -0,0 +1,240 @@
|
||||
<!---[](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.8.0
|
||||
<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>
|
||||
|
||||
Catch my live stream on [Twitch](https://www.twitch.tv/willstunforfood) where I play games, have just chatting sessions to talk tech, and just generally be an ordinary person who can't figure out how to make proper life decisions.
|
||||
|
||||
Stream Schedule:
|
||||
Mon: 1800 - 2000 EST
|
||||
Wed: 1800 - 2000 EST
|
||||
Sun: 1200 - 1400 EST
|
||||
|
||||
[](http://hits.dwyl.io/justcallmekoko/badges)
|
||||
[](https://travis-ci.com/justcallmekoko/ESP32Marauder)
|
||||
|
||||
# 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](#using-arduino-ide)
|
||||
- [Updating Firmware](#updating-firmware)
|
||||
- [Web Update](#web-update)
|
||||
- [SD Update](#sd-update)
|
||||
- [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. Track features and issues [here](https://github.com/justcallmekoko/ESP32Marauder/issues). Check out [#esp32marauder](https://www.instagram.com/explore/tags/esp32marauder/) on Instagram.
|
||||
**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
|
||||
- Join WiFi: Just join a WiFi network
|
||||
- Shutdown WiFi: Shutdown the Marauder WiFi interface to save some RAM
|
||||
- Generate SSIDs: Add 20 random SSIDs to your list of SSIDs
|
||||
- Add SSID: Use an on-screen keyboard to add your own SSIDs to the SSID list
|
||||
- Clear SSIDs: Clear the list of SSIDs
|
||||
- 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 List: Spam a list of SSIDs and monitoring connection attempts to those networks
|
||||
- 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
|
||||
- Shutdown BLE: Shutdown the Marauder BLE interface to save RAM
|
||||
- Detect Card Skimmers: Detect bluetooth enabled credit card skimmers
|
||||
- Packet Monitor: Show WiFi packet density on a given channel using a time bar graph
|
||||
- EAPOL/PMKID Scan: Capture EAPOL/PMKID frames
|
||||
- Detect Pwnagotchi: Detect any pwnagotchis in range
|
||||
- Detect Espressif: Detect any espressif devices in range
|
||||
- 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 or with SD card
|
||||
- Save PCAP files to SD card
|
||||
|
||||
# Do It Yourself
|
||||
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/diy.png?raw=true" width="800"></p>
|
||||
|
||||
## 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)
|
||||
|
||||
| SD Card | 2.8" TFT | ESP32 |
|
||||
| ------- | -------- | ------ |
|
||||
| | VCC | VCC |
|
||||
| | GND | GND |
|
||||
| | CS | GPIO17 |
|
||||
| | RESET | GPIO5 |
|
||||
| | D/C | GPIO16 |
|
||||
| SD_MOSI | MOSI | GPIO23 |
|
||||
| SD_SCK | SCK | GPIO18 |
|
||||
| | LED | GPIO32 |
|
||||
| SD_MISO | MISO | GPIO19 |
|
||||
| | T_CLK | GPIO18 |
|
||||
| | T_CS | GPIO21 |
|
||||
| | T_DI | GPIO23 |
|
||||
| | T_DO | GPIO19 |
|
||||
| | T_IRQ | |
|
||||
| SD_CS | | GPIO12 |
|
||||
|
||||
For the analog battery circuit, use a 4 to 1 voltage divider, and (optional) a mosfet.
|
||||
For the charge detection circuit, use a 1 to 2 voltage divider (the charge detection is optional and only changes the battery icon colour while charging)
|
||||
| BATTERY | ESP32 |
|
||||
| ------- | ------ |
|
||||
| BAT + | GPIO34 |
|
||||
| MOSFET | GPIO13 |
|
||||
| CHARGE +| GPIO27 |
|
||||
|
||||
## 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`
|
||||
10.5. If you're using the analog battery measuring circuit, go to the MenuFunctions.h and change "#define BATTERY_ANALOG_ON" to 1
|
||||
11. Plug your ESP32 into a USB port and select the COM port under `Tools`>`Port`
|
||||
12. Select `LOLIN D32` under `Tools`>`Boards`
|
||||
12.5 If you want an upscaled version of the logo, go to the data folder and rename "marauder3L1.jpg" to "marauder3L.jpg"
|
||||
13. Click `ESP32 Sketch Data Upload` and wait for the SPIFFS upload to finish
|
||||
14. Click the upload button
|
||||
|
||||
<p align="center">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/m5stack.jpg?raw=true" height="300">
|
||||
<img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/odroid_marauder.jpg?raw=true" height="300">
|
||||
</p>
|
||||
|
||||
## 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](#web-update) for installing the latest update over the air via Marauder's web interface or [these instructions](#sd-update) for installing the latest update using an SD Card.
|
||||
|
||||
### Web Update
|
||||
1. Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the Marauder firmware
|
||||
2. With Marauder powered on, navigate to `Device`>`Update Firmware`>`Web Update`
|
||||
- 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
|
||||
|
||||
### SD Update
|
||||
*Using a Samsung MicroSD card will cause Marauder not to boot*
|
||||
1. Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the Marauder firmware
|
||||
2. Copy the bin file you downloaded to the root of an SD card
|
||||
3. Rename the bin file on the SD card to `update.bin`
|
||||
4. With Marauder powered off, insert the SD card into Marauder
|
||||
5. Power Marauder on and navigate to `Device`>`Update Firmware`>`SD Update`
|
||||
6. Click `Yes` to confirm the 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).
|
||||
|
||||
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
|
||||
|
||||
# Icons
|
||||
I put these here just because
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/attack_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/beacon_sniff_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/beacon_spam_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/bluetooth_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/bluetooth_sniff_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/deauth_sniff_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/device_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/device_info_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/draw_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/eapol_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/espressif_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/general_apps_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/monitor_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/probe_sniff_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/pwnagotchi_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/reboot_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/rick_roll_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/scan_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/sd_update_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/skimmer_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/sniff_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/update_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/web_update_22.bmp">
|
||||
<img alt="Marauder logo" src="https://raw.githubusercontent.com/justcallmekoko/ESP32Marauder/master/pictures/icons/wifi_22.bmp">
|
||||
|
||||
# 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
|
||||
- Also...providing the buffer class used to save pcap files to an SD card
|
||||
- [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
|
||||
|
||||
# For Sale Now
|
||||
You can buy the ESP32 Marauder using [this link](https://www.tindie.com/products/justcallmekoko/esp32-marauder/)
|
||||
BIN
pictures/IMG_0420.JPG
Normal file
|
After Width: | Height: | Size: 7.4 MiB |
BIN
pictures/IMG_0421.JPG
Normal file
|
After Width: | Height: | Size: 7.3 MiB |
BIN
pictures/IMG_0423.JPG
Normal file
|
After Width: | Height: | Size: 7.5 MiB |
BIN
pictures/IMG_0424.JPG
Normal file
|
After Width: | Height: | Size: 8.3 MiB |
BIN
pictures/IMG_0425.JPG
Normal file
|
After Width: | Height: | Size: 6.6 MiB |
BIN
pictures/IMG_0426.JPG
Normal file
|
After Width: | Height: | Size: 7.0 MiB |
BIN
pictures/IMG_1838.JPG
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
pictures/IMG_1840.JPG
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
pictures/IMG_1841.JPG
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
pictures/IMG_1842.JPG
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
pictures/IMG_1844.JPG
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
pictures/IMG_1845.JPG
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
pictures/IMG_1848.JPG
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
pictures/IMG_1849.JPG
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
pictures/IMG_1851.JPG
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
BIN
pictures/IMG_1852.JPG
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
pictures/IMG_1853.JPG
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
pictures/IMG_2519 - Copy.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
pictures/IMG_2520 - Copy.jpg
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
pictures/diy.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
pictures/icons/attack_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/badusb.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/battery_16.bmp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
pictures/icons/beacon_list_22.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/beacon_sniff_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/beacon_spam_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/bluetooth_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/bluetooth_sniff_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/clear_22.bmp
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
pictures/icons/deauth_sniff_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/device_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/device_info_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/draw_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/eapol_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/esp_update.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/espressif_22.bmp
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
pictures/icons/general_apps_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
pictures/icons/generate_22.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/join_wifi_22.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/keyboard_22.bmp
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
pictures/icons/monitor_22.bmp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |