Skip to content

Commit

Permalink
Merge pull request #95 from n0xa/develop
Browse files Browse the repository at this point in the history
Merge Develop changes into main
  • Loading branch information
n0xa committed Feb 14, 2024
2 parents 71228c8 + 9c430ab commit 152693f
Show file tree
Hide file tree
Showing 12 changed files with 770 additions and 79 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: "M5Cardputer",
fqbn: "m5stack:esp32:m5stack_cardputer",
extra_flags: "-DCARDPUTER",
libraries: "M5Cardputer IRRemoteESP8266",
libraries: "M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x0000",
},
Expand All @@ -44,7 +44,7 @@ jobs:
name: "M5StickCPlus2",
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
extra_flags: "-DSTICK_C_PLUS2",
libraries: "M5StickCPlus2 IRRemoteESP8266",
libraries: "M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand All @@ -53,7 +53,7 @@ jobs:
name: "M5StickCPlus",
fqbn: "m5stack:esp32:m5stack_stickc_plus",
extra_flags: "-DSTICK_C_PLUS",
libraries: "M5StickCPlus IRRemoteESP8266",
libraries: "M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand All @@ -63,7 +63,7 @@ jobs:
fqbn: "m5stack:esp32:m5stack_stickc",
extra_flags: "-DSTICK_C",
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
libraries: "[email protected] IRRemoteESP8266",
libraries: "[email protected] IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand Down Expand Up @@ -104,6 +104,43 @@ jobs:
run: |
pip install -U esptool
- name: Setup platform.txt
run: |
baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"
# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)
if [ -z "$latestVersion" ]; then
echo "No version found."
read -p "Press Enter to exit."
exit 1
fi
# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "
prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "
# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

echo "Done."

- name: Compile ${{ matrix.board.name }} Sketch
run: |
set -x
Expand Down Expand Up @@ -200,4 +237,3 @@ jobs:
files: |
M5Nemo-*.bin
51 changes: 51 additions & 0 deletions DEAUTH Prerequisites/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# M5Stick-NEMO - DEAUTHENTICATOR
In order to make the Deauthentication broadcast work properly, you must follow some steps before uncomment the "#define DEAUTHER" line


## Why these prerequisites
Every time you build your project, using ESP boards, compiler will look uppon your code to see if you are trying to use their boards to something not allowed..

As sending deauthentication frames (and some others wifi packets) is not something desireable, they have a funcion called: ieee80211_raw_frame_sanity_check, wich should be "silenced" in order to use this attack.

To do that, we must change some flags on the board "platform.txt" file and declare this function in your code, returning 0, you will see this funcion in the deauth.h file


## What you need to do..
* Win+R, and run: %localappdata%\Arduino15\packages\m5stack\hardware\esp32
* open the folder with the version of your board, it will be something like: 2.1.0, or 2.0.9, or whatever
* in this floder, open the file "platform.txt", you will need to edit this badboy.
* Ctrl+F and search for: build.extra_flags.esp32
- You will find a line that looks like that: 'build.extra_flags.esp32=-DARDUINO_USB_CDC_ON_BOOT=0'
- Add an "-w " after the =, or at the end of the line: 'build.extra_flags.esp32=-w -DARDUINO_USB_CDC_ON_BOOT=0'
* you should make these changes to the lines:
- build.extra_flags.esp32
- build.extra_flags.esp32s2
- build.extra_flags.esp32s3
- build.extra_flags.esp32c3
* Ctrl+F again and search for: compiler.c.elf.libs.esp32
- You will find a line that looks like that: "compiler.c.elf.libs.esp32s3=-lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls....... " this is a huuuuuuge line...
- Add an "-zmuldefs " after the =, shoul look like this: "compiler.c.elf.libs.esp32s3=-zmuldefs -lesp_ringbuf -lefuse -lesp_ipc -ldriver -lesp_pm -lmbedtls .............."
* you should make these changes to the lines:
- compiler.c.elf.libs.esp32
- compiler.c.elf.libs.esp32s2
- compiler.c.elf.libs.esp32s3
- compiler.c.elf.libs.esp32c3
* Save the file
* Restart your arduino IDE
* Note: everytime you update your M5 boards to a new version, you will need to do this again..


## What did I do to help..
I Created a batch file to meka all these changes automatically, you just need to download the "install-prerequisites.bat" file and run.

Mac users: You can use install-prerequisites_MAC.sh (thanks to @danny8972)

Linux users: You can use install-prerequisites_Linux.sh (thanks to @danny8972, Just changed folder address might work just fine)


## Helps?
I'm all ears!

## Thanks
* Thanks to @danny8972 (https://github.com/danny8972) for dev the MAC batch file.

51 changes: 51 additions & 0 deletions DEAUTH Prerequisites/install-prerequisites.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@echo off
setlocal enabledelayedexpansion

set "baseFolder=%localappdata%\Arduino15\packages\m5stack\hardware\esp32"

rem Find the latest version of the folder
set "latestVersion="
for /d %%I in ("%baseFolder%\*") do (
set "latestVersion=%%~nxI"
)

if not defined latestVersion (
echo No version found.
pause
exit /b
)

rem Full path to the file to be edited
set "file=%baseFolder%\%latestVersion%\platform.txt"
set "backupFile=%baseFolder%\%latestVersion%\platform.txt.bkp"
set "prefix=build.extra_flags.esp32"
set "option= -w"

set "prefix2=compiler.c.elf.libs.esp32"
set "option2= -zmuldefs"

set "readyMark=##NEMO_DEAUTH_READY##"

rem Check if the ready mark already exists in the file
findstr /C:"%readyMark%" "%file%" >nul
if %errorlevel% equ 0 (
echo The file is already OK.
pause
exit /b
)

rem Create a backup copy of the original file
copy "%file%" "%backupFile%"

rem Use PowerShell to edit the file
powershell -Command "(Get-Content '%file%') | ForEach-Object { $_ -replace ('^(%prefix%.*?)$', '$1%option%') -replace ('^(%prefix2%.*?)$', '$1%option2%') } | Set-Content '%file%'"

rem Add the ready mark to the end of the file
echo %readyMark%>> "%file%"

rem Open the latest version of the folder in Windows Explorer
start explorer "%baseFolder%\%latestVersion%"

echo Done.
pause

56 changes: 56 additions & 0 deletions DEAUTH Prerequisites/install-prerequisites_MAC.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

baseFolder="$HOME/Library/Arduino15/packages/m5stack/hardware/esp32"

# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)

if [ -z "$latestVersion" ]; then
echo "No version found."
read -p "Press Enter to exit."
exit 1
fi

# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "

prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "

readyMark="##NEMO_DEAUTH_READY##"

# Check if the ready mark already exists in the file
grep -q "$readyMark" "$file"
if [ $? -eq 0 ]; then
echo "The file is already OK."
read -p "Press Enter to exit."
exit 0
fi

# Create a backup copy of the original file
cp "$file" "$backupFile"

# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

# Add the ready mark to the end of the file
echo "$readyMark" >> "$file"

# Open the latest version of the folder in Finder
open "$baseFolder/$latestVersion"

echo "Done."
read -p "Press Enter to exit."
58 changes: 58 additions & 0 deletions DEAUTH Prerequisites/install_prerequisites_Linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

#

baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"

# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)

if [ -z "$latestVersion" ]; then
echo "No version found."
read -p "Press Enter to exit."
exit 1
fi

# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "

prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "

readyMark="##NEMO_DEAUTH_READY##"

# Check if the ready mark already exists in the file
grep -q "$readyMark" "$file"
if [ $? -eq 0 ]; then
echo "The file is already OK."
read -p "Press Enter to exit."
exit 0
fi

# Create a backup copy of the original file
cp "$file" "$backupFile"

# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

# Add the ready mark to the end of the file
echo "$readyMark" >> "$file"

# Open the latest version of the folder in Finder
open "$baseFolder/$latestVersion"

echo "Done."
read -p "Press Enter to exit."
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ NEMO is named after the small, clever and stubborn fish in Finding Nemo. This pr

![M5-Nemo on M5StickC family and M5Cardputer](https://github.com/n0xa/m5stick-nemo/blob/main/M5-Nemo.jpg)

## My Changelog
* Adjusted .github/workflow/compile.yml to compile with the DEAUTH function.
* Added suport to SONG on StickC Plus and Plus2
* Added an "Attack Menu" when seeing details of an Access Point
- Clone Portal (Creates an Evil portal with the same SSID of the target)
- Deauth attack (broadcasts deauthentication frames to devices connected to this Access Point)
- Deauth+Clone (Creates the evil portal with the same SSID and sends deauthentication frames to that AP)
* Added option in Settings to Mount/Unmount SDCard when using M5StickC devices
* Created new file to handle SPI/SD if not using CARDPUTER
* SDCARD is now working on M5StickC Plus2

## My ToDo list
* ideas?

## Features
* [TV B-Gone](http://www.righto.com/2010/11/improved-arduino-tv-b-gone.html) port (thanks to MrArm's [HAKRWATCH](https://github.com/MrARM/hakrwatch)) to shut off many infrared-controlled TVs, projectors and other devices
* [AppleJuice](https://github.com/ECTO-1A/AppleJuice) iOS Bluetooth device pairing spam
Expand Down
Loading

0 comments on commit 152693f

Please sign in to comment.