Skip to content

Commit

Permalink
Merge pull request #11 from ElectronicCats/dev
Browse files Browse the repository at this point in the history
Fix Wardriving bugs
  • Loading branch information
DeimosHall authored Sep 19, 2024
2 parents 8ca37f2 + 339c7cb commit 8bd7c11
Show file tree
Hide file tree
Showing 47 changed files with 808 additions and 546 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ hardware/minino-backups/

# Firmware binaries
/**/build/
/**/build-ota/
/**/build-noota/
/**/managed_components/
/**/build_files/
/**/build_files.tgz
/**/build_files.zip
/**/minino-*.zip

# IDF sdkconfig
/**/sdkconfig
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ Minino can operate in 6 different technologies:

Inspired by projects such as [Amini Project](https://github.com/Ocelot-Offensive-Security/Arsenal) and [USBNugget](https://github.com/HakCat-Tech/USB-Nugget).

## How to build the firmware

Check the [Developer guide](./firmware/README.md) to learn how to build the firmware from scratch.

## How to contribute <img src="https://electroniccats.com/wp-content/uploads/2018/01/fav.png" height="35"><img src="https://raw.githubusercontent.com/gist/ManulMax/2d20af60d709805c55fd784ca7cba4b9/raw/bcfeac7604f674ace63623106eb8bb8471d844a6/github.gif" height="30">

Contributions are welcome!
Expand Down
2 changes: 1 addition & 1 deletion firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ git clone [email protected]:ElectronicCats/Minino.git
2. Change to the firmware directory:

```bash
cd Minino/examples/minino
cd Minino/firmware
```

3. Set the IDF_PATH environment variable:
Expand Down
1 change: 1 addition & 0 deletions firmware/components/minino_config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
idf_component_register(SRCS INCLUDE_DIRS)
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ menu "OLED Screen Configuration"

endmenu

menu "KEYBOARD Configuration"
menu "Keyboard Configuration"

config GPIO_RANGE_MAX
int
Expand Down
2 changes: 1 addition & 1 deletion firmware/components/wifi_captive/captive_portal.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ esp_err_t http_404_error_handler(httpd_req_t* req, httpd_err_code_t err) {
static httpd_handle_t start_webserver(void) {
httpd_handle_t server = NULL;
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.max_open_sockets = 10;
config.max_open_sockets = 7;
config.lru_purge_enable = true;

// Start the httpd server
Expand Down
50 changes: 37 additions & 13 deletions firmware/get_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,49 @@

PROJECT_NAME="minino"
CONFIG_FILE="sdkconfig"
OTA_BUILD_DIR="build-ota"
NO_OTA_BUILD_DIR="build-noota"
TEMPORARY_BUILD_DIR="build_files"

project_version=$(grep '^CONFIG_PROJECT_VERSION=' "$CONFIG_FILE" | cut -d'=' -f2 | tr -d '"')
# Build the firmware
make compile
PROJECT_VERSION=$(grep '^CONFIG_PROJECT_VERSION=' "$CONFIG_FILE" | cut -d'=' -f2 | tr -d '"')
OTA_BUILD_FINAL_DIR="minino-ota-firmware-$PROJECT_VERSION"
NO_OTA_BUILD_FINAL_DIR="minino-noota-firmware-$PROJECT_VERSION"

mkdir -p build_files/
mkdir -p build_files/partition_table/
mkdir -p build_files/bootloader/
# Build the firmware
echo "Building ota firmware..."
make setup
idf.py @profiles/ota build
mkdir -p $TEMPORARY_BUILD_DIR

# Copy the firmware files to the build directory
echo "Copying firmware files to build directory..."
cp build/$PROJECT_NAME.bin build_files/
cp build/partition_table/partition-table.bin build_files/partition_table/
cp build/bootloader/bootloader.bin build_files/bootloader/
cp build/ota_data_initial.bin build_files/
cp $OTA_BUILD_DIR/$PROJECT_NAME.bin $TEMPORARY_BUILD_DIR
cp $OTA_BUILD_DIR/partition_table/partition-table.bin $TEMPORARY_BUILD_DIR
cp $OTA_BUILD_DIR/bootloader/bootloader.bin $TEMPORARY_BUILD_DIR
cp $OTA_BUILD_DIR/ota_data_initial.bin $TEMPORARY_BUILD_DIR
mv $TEMPORARY_BUILD_DIR $OTA_BUILD_FINAL_DIR

echo "Building no ota firmware..."
idf.py @profiles/noota build
rm -rf $TEMPORARY_BUILD_DIR
mkdir -p $TEMPORARY_BUILD_DIR

echo "Copying firmware files to build directory..."
cp $NO_OTA_BUILD_DIR/$PROJECT_NAME.bin $TEMPORARY_BUILD_DIR
cp $NO_OTA_BUILD_DIR/partition_table/partition-table.bin $TEMPORARY_BUILD_DIR
cp $NO_OTA_BUILD_DIR/bootloader/bootloader.bin $TEMPORARY_BUILD_DIR
mv $TEMPORARY_BUILD_DIR $NO_OTA_BUILD_FINAL_DIR

# Compress build_files and delete directory
echo "Compressing build_files..."
zip -r build_files_$project_version.zip build_files
rm -rf build_files/
echo "Compressing ota build files..."
# zip -r build_files_$PROJECT_VERSION.zip build_files
zip -r $OTA_BUILD_FINAL_DIR.zip $OTA_BUILD_FINAL_DIR
echo "Compressing no ota build files..."
zip -r $NO_OTA_BUILD_FINAL_DIR.zip $NO_OTA_BUILD_FINAL_DIR

echo "Cleaning build files..."
rm -rf $TEMPORARY_BUILD_DIR
rm -rf $OTA_BUILD_FINAL_DIR
rm -rf $NO_OTA_BUILD_FINAL_DIR

echo "Done!"
35 changes: 0 additions & 35 deletions firmware/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,3 @@ idf_component_register(
modules/web_file_browser/http_server/style.css
INCLUDE_DIRS
"${headers_dirs}")

# # Append all directories to INCLUDE_DIRS

# file(GLOB_RECURSE ALL_INCLUDE_PATHS "./*")
# set(INCLUDE_DIRS "")

# foreach(path ${ALL_INCLUDE_PATHS})
# get_filename_component(parentDir ${path} DIRECTORY)

# if(IS_DIRECTORY ${parentDir})
# list(APPEND INCLUDE_DIRS ${parentDir})
# endif()
# endforeach()

# list(REMOVE_DUPLICATES INCLUDE_DIRS)

# # Append all source files to SRCS

# file(GLOB_RECURSE ALL_SOURCE_FILES "./*")
# set(SRCS "")

# foreach(file ${ALL_SOURCE_FILES})
# get_filename_component(extension ${file} EXT)
# if(NOT extension STREQUAL "")
# list(APPEND SRCS ${file})
# endif()
# endforeach()

# # Register the component

# idf_component_register(
# SRCS
# ${SRCS}
# INCLUDE_DIRS
# ${INCLUDE_DIRS})
13 changes: 10 additions & 3 deletions firmware/main/apps/ble/spam/spam_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ static void ble_screens_display_scanning_animation() {

void ble_screens_start_scanning_animation() {
oled_screen_clear();
oled_screen_display_text_center("BLE SPAM", 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center("< Back", 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center("BLE SPAM", 1, OLED_DISPLAY_NORMAL);
#ifdef CONFIG_RESOLUTION_128X64
animations_task_run(ble_screens_display_scanning_animation, 100, NULL);
#endif
}

void ble_screens_display_scanning_text(char* name) {
oled_screen_clear_line(0, 7, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(name, 7, OLED_DISPLAY_INVERT);
int page = 7;
#ifdef CONFIG_RESOLUTION_128X32
page = 2;
#endif
oled_screen_clear_line(0, page, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(name, page, OLED_DISPLAY_INVERT);
}
2 changes: 1 addition & 1 deletion firmware/main/apps/ble/trackers/trackers_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void module_update_tracker_name(char* tracker_name, uint16_t index) {

void module_display_scanning() {
led_control_run_effect(led_control_pulse_leds);
genera_screen_display_notify_information("Searching", "Looking for devices");
genera_screen_display_notify_information("Searching", "Devices");
}

void module_display_tracker_information(char* title, char* body) {
Expand Down
45 changes: 35 additions & 10 deletions firmware/main/apps/wifi/deauth/deauth_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
#include "animations_task.h"
#include "esp_wifi.h"
#include "general/bitmaps_general.h"
#include "general/general_screens.h"
#include "oled_screen.h"

#define ITEMOFFSET 2
#ifdef CONFIG_RESOLUTION_128X64
#define ITEMOFFSET 2
#define ITEMSPERSCREEN 4
#else // CONFIG_RESOLUTION_128X32
#define ITEMOFFSET 1
#define ITEMSPERSCREEN 2
#endif

static int ap_count = 0;

Expand Down Expand Up @@ -63,8 +70,10 @@ void deauth_display_menu(uint16_t current_item,
oled_screen_display_text("< Exit", 0, 0, OLED_DISPLAY_NORMAL);

int position = 1;
uint16_t start_item = (current_item / ITEMSPERSCREEN) * ITEMSPERSCREEN;

for (uint16_t i = 0; i < MENUCOUNT; i++) {
for (uint16_t i = start_item;
i < start_item + ITEMSPERSCREEN && i < MENUCOUNT; i++) {
if (deauth_menu[i] == NULL) {
break;
}
Expand Down Expand Up @@ -93,7 +102,7 @@ void deauth_display_menu(uint16_t current_item,
} else {
oled_screen_display_text(item, 0, position, OLED_DISPLAY_NORMAL);
}
position = position + 2;
position = position + ITEMOFFSET;
}
oled_screen_display_show();
}
Expand All @@ -111,16 +120,19 @@ void deauth_display_scanned_ap(wifi_ap_record_t* ap_records,
if (i >= scanned_records) {
break;
}
char ssid[MAX_LINE_CHAR];
general_screen_truncate_text((char*) ap_records[i].ssid, ssid);
if (i == current_option) {
char* prefix = "> ";
char item_text[strlen(prefix) + strlen((char*) ap_records[i].ssid) + 1];

char item_text[strlen(prefix) + strlen((char*) ssid) + 1];
strcpy(item_text, prefix);
strcat(item_text, (char*) ap_records[i].ssid);
strcat(item_text, (char*) ssid);
oled_screen_display_text(item_text, 0, (i + 1) - current_option,
OLED_DISPLAY_INVERT);
} else {
oled_screen_display_text((char*) ap_records[i].ssid, 0,
(i + 1) - current_option, OLED_DISPLAY_NORMAL);
oled_screen_display_text((char*) ssid, 0, (i + 1) - current_option,
OLED_DISPLAY_NORMAL);
}
}
oled_screen_display_show();
Expand All @@ -131,7 +143,11 @@ void deauth_display_attacks(uint16_t current_item,
oled_screen_clear_buffer();
oled_screen_display_text("< Back", 0, 0, OLED_DISPLAY_NORMAL);

for (uint16_t i = 0; i < ATTACKSCOUNT; i++) {
int position = 1;
uint16_t start_item = (current_item / ITEMSPERSCREEN) * ITEMSPERSCREEN;

for (uint16_t i = start_item;
i < start_item + ITEMSPERSCREEN && i < MENUCOUNT; i++) {
if (deauth_attacks[i] == NULL) {
break;
}
Expand All @@ -142,10 +158,11 @@ void deauth_display_attacks(uint16_t current_item,
snprintf(item, 18, "%s", deauth_attacks[i]);
}
if (i == current_item) {
deauth_display_selected_item(item, i + ITEMOFFSET);
deauth_display_selected_item(item, position);
} else {
oled_screen_display_text(item, 0, i + ITEMOFFSET, OLED_DISPLAY_NORMAL);
oled_screen_display_text(item, 0, position, OLED_DISPLAY_NORMAL);
}
position = position + ITEMOFFSET;
}
oled_screen_display_show();
}
Expand Down Expand Up @@ -182,6 +199,7 @@ void deauth_display_captive_waiting() {

void deauth_display_captive_portal_creds(char* ssid, char* user, char* pass) {
oled_screen_clear();
#ifdef CONFIG_RESOLUTION_128X64
oled_screen_display_text_center("Captive Portal", 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center("SSID", 1, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(ssid, 2, OLED_DISPLAY_NORMAL);
Expand All @@ -191,4 +209,11 @@ void deauth_display_captive_portal_creds(char* ssid, char* user, char* pass) {
oled_screen_display_text_center("PASS", 5, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(pass, 6, OLED_DISPLAY_INVERT);
}
#else // CONFIG_RESOLUTION_128X32
oled_screen_display_text_center(ssid, 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text_center(user, 1, OLED_DISPLAY_INVERT);
if (strcmp(pass, "") != 0) {
oled_screen_display_text_center(pass, 2, OLED_DISPLAY_INVERT);
}
#endif
}
3 changes: 2 additions & 1 deletion firmware/main/drivers/oled_driver/oled_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ void oled_driver_clear_line(oled_driver_t* dev, int x, int page, bool invert) {
// char space[16];
// memset(space, 0x00, sizeof(space));
// oled_driver_display_text(dev, page, space, sizeof(space), invert);
char* space = " ";
// char* space = " ";
char* space = " ";
oled_driver_display_text(dev, page, space, x, invert);
}

Expand Down
12 changes: 6 additions & 6 deletions firmware/main/drivers/oled_driver/oled_driver_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#include "oled_driver.h"

#define tag "oled_driver_i2c"

#if CONFIG_I2C_PORT_0
#define I2C_NUM I2C_NUM_0
#elif CONFIG_I2C_PORT_1
Expand All @@ -21,6 +19,8 @@
#define I2C_MASTER_FREQ_HZ \
400000 /*!< I2C clock of SH1106 can run at 400 kHz max. */

static const char* TAG = "oled_driver_i2c";

void i2c_master_init(oled_driver_t* dev,
int16_t sda,
int16_t scl,
Expand Down Expand Up @@ -105,9 +105,9 @@ void i2c_init(oled_driver_t* dev, int width, int height) {

esp_err_t espRc = i2c_master_cmd_begin(I2C_NUM, cmd, 10 / portTICK_PERIOD_MS);
if (espRc == ESP_OK) {
ESP_LOGI(tag, "OLED configured successfully");
ESP_LOGI(TAG, "OLED configured successfully");
} else {
ESP_LOGE(tag, "OLED configuration failed. code: 0x%.2X", espRc);
ESP_LOGE(TAG, "OLED configuration failed. code: 0x%.2X", espRc);
}
i2c_cmd_link_delete(cmd);
}
Expand Down Expand Up @@ -260,9 +260,9 @@ void i2c_hardware_scroll(oled_driver_t* dev, oled_driver_scroll_type_t scroll) {
i2c_master_stop(cmd);
espRc = i2c_master_cmd_begin(I2C_NUM, cmd, 10 / portTICK_PERIOD_MS);
if (espRc == ESP_OK) {
ESP_LOGD(tag, "Scroll command succeeded");
ESP_LOGD(TAG, "Scroll command succeeded");
} else {
ESP_LOGE(tag, "Scroll command failed. code: 0x%.2X", espRc);
ESP_LOGE(TAG, "Scroll command failed. code: 0x%.2X", espRc);
}

i2c_cmd_link_delete(cmd);
Expand Down
Loading

0 comments on commit 8bd7c11

Please sign in to comment.