mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
BLE spam ext app (#1624)
* BLESpam ext app first release * Ios partly added * Fix missing! * Maybe fix Ios * Add comment * Fixes * Added samsung and windows * cleaning a bit * Partial size fix * Move continuity to blespam namespace. * Optimize code layout, so not using fw space * Ui changes
This commit is contained in:
parent
ea02d98a59
commit
1bf0d2b3e6
82
firmware/application/external/blespam/main.cpp
vendored
Normal file
82
firmware/application/external/blespam/main.cpp
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Bernd Herzog
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_blespam.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "external_app.hpp"
|
||||
|
||||
namespace ui::external_app::blespam {
|
||||
void initialize_app(ui::NavigationView& nav) {
|
||||
nav.push<BLESpamView>();
|
||||
}
|
||||
} // namespace ui::external_app::blespam
|
||||
|
||||
extern "C" {
|
||||
|
||||
__attribute__((section(".external_app.app_blespam.application_information"), used)) application_information_t _application_information_blespam = {
|
||||
/*.memory_location = */ (uint8_t*)0x00000000,
|
||||
/*.externalAppEntry = */ ui::external_app::blespam::initialize_app,
|
||||
/*.header_version = */ CURRENT_HEADER_VERSION,
|
||||
/*.app_version = */ VERSION_MD5,
|
||||
|
||||
/*.app_name = */ "BLESpam",
|
||||
/*.bitmap_data = */ {
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xF8,
|
||||
0x1F,
|
||||
0x04,
|
||||
0x20,
|
||||
0x02,
|
||||
0x40,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xAB,
|
||||
0xDF,
|
||||
0xAB,
|
||||
0xDF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
},
|
||||
/*.icon_color = */ ui::Color::yellow().v,
|
||||
/*.menu_location = */ app_location_t::TX,
|
||||
|
||||
/*.m4_app_tag = portapack::spi_flash::image_tag_afsk_rx */ {'P', 'B', 'T', 'T'},
|
||||
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
|
||||
};
|
||||
}
|
1292
firmware/application/external/blespam/ui_blespam.cpp
vendored
Normal file
1292
firmware/application/external/blespam/ui_blespam.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
250
firmware/application/external/blespam/ui_blespam.hpp
vendored
Normal file
250
firmware/application/external/blespam/ui_blespam.hpp
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2017 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// Code from https://github.com/Flipper-XFW/Xtreme-Apps/tree/04c3a60093e2c2378e79498b4505aa8072980a42/ble_spam/protocols
|
||||
// Thanks for the work of the original creators!
|
||||
// Saying thanks in the main view!
|
||||
|
||||
#ifndef __UI_BLESPAM_H__
|
||||
#define __UI_BLESPAM_H__
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_transmitter.hpp"
|
||||
#include "ui_freq_field.hpp"
|
||||
#include "ui_record_view.hpp"
|
||||
#include "app_settings.hpp"
|
||||
#include "radio_state.hpp"
|
||||
#include "log_file.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
using namespace ui;
|
||||
|
||||
namespace ui::external_app::blespam {
|
||||
|
||||
enum ATK_TYPE {
|
||||
ATK_ANDROID,
|
||||
ATK_IOS,
|
||||
ATK_IOS_CRASH,
|
||||
ATK_WINDOWS,
|
||||
ATK_SAMSUNG
|
||||
};
|
||||
enum PKT_TYPE {
|
||||
PKT_TYPE_INVALID_TYPE,
|
||||
PKT_TYPE_RAW,
|
||||
PKT_TYPE_DISCOVERY,
|
||||
PKT_TYPE_IBEACON,
|
||||
PKT_TYPE_ADV_IND,
|
||||
PKT_TYPE_ADV_DIRECT_IND,
|
||||
PKT_TYPE_ADV_NONCONN_IND,
|
||||
PKT_TYPE_ADV_SCAN_IND,
|
||||
PKT_TYPE_SCAN_REQ,
|
||||
PKT_TYPE_SCAN_RSP,
|
||||
PKT_TYPE_CONNECT_REQ,
|
||||
PKT_TYPE_LL_DATA,
|
||||
PKT_TYPE_LL_CONNECTION_UPDATE_REQ,
|
||||
PKT_TYPE_LL_CHANNEL_MAP_REQ,
|
||||
PKT_TYPE_LL_TERMINATE_IND,
|
||||
PKT_TYPE_LL_ENC_REQ,
|
||||
PKT_TYPE_LL_ENC_RSP,
|
||||
PKT_TYPE_LL_START_ENC_REQ,
|
||||
PKT_TYPE_LL_START_ENC_RSP,
|
||||
PKT_TYPE_LL_UNKNOWN_RSP,
|
||||
PKT_TYPE_LL_FEATURE_REQ,
|
||||
PKT_TYPE_LL_FEATURE_RSP,
|
||||
PKT_TYPE_LL_PAUSE_ENC_REQ,
|
||||
PKT_TYPE_LL_PAUSE_ENC_RSP,
|
||||
PKT_TYPE_LL_VERSION_IND,
|
||||
PKT_TYPE_LL_REJECT_IND,
|
||||
PKT_TYPE_NUM_PKT_TYPE
|
||||
};
|
||||
|
||||
class BLESpamView : public View {
|
||||
public:
|
||||
BLESpamView(NavigationView& nav);
|
||||
~BLESpamView();
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override {
|
||||
return "BLESpam";
|
||||
};
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
TxRadioState radio_state_{
|
||||
2'402'000'000 /* frequency */,
|
||||
4'000'000 /* bandwidth */,
|
||||
4'000'000 /* sampling rate */
|
||||
};
|
||||
TxFrequencyField field_frequency{
|
||||
{0 * 8, 0 * 16},
|
||||
nav_};
|
||||
TransmitterView2 tx_view{
|
||||
{11 * 8, 0 * 16},
|
||||
/*short_ui*/ true};
|
||||
app_settings::SettingsManager settings_{
|
||||
"tx_blespam", app_settings::Mode::TX};
|
||||
|
||||
Button button_startstop{
|
||||
{0, 3 * 16, 96, 24},
|
||||
"Start"};
|
||||
Checkbox chk_randdev{{100, 16}, 10, "Rnd device", true};
|
||||
|
||||
Console console{
|
||||
{0, 70, 240, 220}};
|
||||
|
||||
OptionsField options_atkmode{
|
||||
{0 * 8, 2 * 8},
|
||||
10,
|
||||
{{"Android", 0},
|
||||
{"iOs", 1},
|
||||
{"iOs crash", 2},
|
||||
{"Windows", 3},
|
||||
{"Samsung", 4}}};
|
||||
|
||||
bool is_running{false};
|
||||
|
||||
uint8_t counter = 0; // for packet change
|
||||
uint8_t displayCounter = 0; // for packet display
|
||||
|
||||
ATK_TYPE attackType = ATK_ANDROID;
|
||||
|
||||
bool randomMac{true};
|
||||
bool randomDev{true};
|
||||
|
||||
uint8_t channel_number = 37;
|
||||
char mac[13] = "010203040507";
|
||||
char advertisementData[63] = {"03032CFE06162CFED5A59E020AB4\0"};
|
||||
PKT_TYPE pduType = {PKT_TYPE_DISCOVERY};
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void reset();
|
||||
void createFastPairPacket();
|
||||
void createIosPacket(bool crash);
|
||||
void createSamsungPacket();
|
||||
void createWindowsPacket();
|
||||
void changePacket(bool forced);
|
||||
void on_timer();
|
||||
uint64_t get_freq_by_channel_number(uint8_t channel_number);
|
||||
void randomizeMac();
|
||||
void randomChn();
|
||||
|
||||
void furi_hal_random_fill_buf(uint8_t* buf, uint32_t len);
|
||||
|
||||
MessageHandlerRegistration message_handler_frame_sync{
|
||||
Message::ID::DisplayFrameSync,
|
||||
[this](const Message* const) {
|
||||
this->on_timer();
|
||||
}};
|
||||
|
||||
// continuity
|
||||
|
||||
typedef enum {
|
||||
PayloadModeRandom,
|
||||
PayloadModeValue,
|
||||
PayloadModeBruteforce,
|
||||
} PayloadMode;
|
||||
|
||||
typedef enum {
|
||||
ContinuityTypeAirDrop = 0x05,
|
||||
ContinuityTypeProximityPair = 0x07,
|
||||
ContinuityTypeAirplayTarget = 0x09,
|
||||
ContinuityTypeHandoff = 0x0C,
|
||||
ContinuityTypeTetheringSource = 0x0E,
|
||||
ContinuityTypeNearbyAction = 0x0F,
|
||||
ContinuityTypeNearbyInfo = 0x10,
|
||||
|
||||
ContinuityTypeCustomCrash,
|
||||
ContinuityTypeCOUNT
|
||||
} ContinuityType;
|
||||
|
||||
typedef enum {
|
||||
ContinuityPpBruteforceModel,
|
||||
ContinuityPpBruteforceColor,
|
||||
} ContinuityPpBruteforce;
|
||||
|
||||
typedef struct {
|
||||
uint8_t value;
|
||||
// const char* name;
|
||||
} ContinuityColor;
|
||||
|
||||
static const uint8_t pp_prefixes_count;
|
||||
|
||||
static const uint8_t na_actions_count;
|
||||
static const uint8_t pp_models_count;
|
||||
static const ContinuityColor colors_beats_studio_buds_[];
|
||||
static const ContinuityColor colors_beats_fit_pro[];
|
||||
static const ContinuityColor colors_beats_studio_pro[];
|
||||
static const ContinuityColor colors_beats_studio_3[];
|
||||
static const ContinuityColor colors_beats_x[];
|
||||
static const ContinuityColor colors_beats_studio_buds[];
|
||||
static const ContinuityColor colors_beats_solo_pro[];
|
||||
static const ContinuityColor colors_powerbeats_pro[];
|
||||
static const ContinuityColor colors_powerbeats_3[];
|
||||
static const ContinuityColor colors_beats_solo_3[];
|
||||
static const ContinuityColor colors_beats_flex[];
|
||||
static const ContinuityColor colors_airpods_max[];
|
||||
static const ContinuityColor colors_white[];
|
||||
typedef struct {
|
||||
uint16_t value;
|
||||
// const char* name;
|
||||
const ContinuityColor* colors;
|
||||
const uint8_t colors_count;
|
||||
} contiModels;
|
||||
static const contiModels pp_models[];
|
||||
typedef struct {
|
||||
uint8_t value;
|
||||
} contiU8;
|
||||
static const contiU8 pp_prefixes[];
|
||||
static const contiU8 na_actions[];
|
||||
|
||||
// fastpair:
|
||||
|
||||
static const uint16_t fastpairModels_count;
|
||||
typedef struct {
|
||||
uint32_t value;
|
||||
const char* name; // could be moved too
|
||||
} fpUi32;
|
||||
static const fpUi32 fastpairModels[];
|
||||
|
||||
// easysetup:
|
||||
static const uint8_t watch_models_count;
|
||||
typedef struct {
|
||||
uint8_t value;
|
||||
} easyU8;
|
||||
typedef struct {
|
||||
uint32_t value;
|
||||
} easyU32;
|
||||
typedef enum {
|
||||
EasysetupTypeBuds = 0x01, // Skip 0 as it means unset
|
||||
EasysetupTypeWatch,
|
||||
EasysetupTypeCOUNT,
|
||||
} EasysetupType;
|
||||
static const easyU8 watch_models[];
|
||||
static const uint8_t buds_models_count;
|
||||
static const easyU32 buds_models[];
|
||||
};
|
||||
}; // namespace ui::external_app::blespam
|
||||
|
||||
#endif /*__UI_BLESPAM_H__*/
|
6
firmware/application/external/external.cmake
vendored
6
firmware/application/external/external.cmake
vendored
@ -15,6 +15,11 @@ set(EXTCPPSRC
|
||||
#font_viewer
|
||||
external/font_viewer/main.cpp
|
||||
external/font_viewer/ui_font_viewer.cpp
|
||||
|
||||
#blespam
|
||||
external/blespam/main.cpp
|
||||
external/blespam/ui_blespam.cpp
|
||||
|
||||
)
|
||||
|
||||
set(EXTAPPLIST
|
||||
@ -22,4 +27,5 @@ set(EXTAPPLIST
|
||||
afsk_rx
|
||||
calculator
|
||||
font_viewer
|
||||
blespam
|
||||
)
|
||||
|
8
firmware/application/external/external.ld
vendored
8
firmware/application/external/external.ld
vendored
@ -21,6 +21,7 @@ MEMORY
|
||||
ram_external_app_afsk_rx (rwx) : org = 0xEEEA0000, len = 32k
|
||||
ram_external_app_calculator (rwx) : org = 0xEEEB0000, len = 32k
|
||||
ram_external_app_font_viewer(rwx) : org = 0xEEEC0000, len = 32k
|
||||
ram_external_app_blespam(rwx) : org = 0xEEED0000, len = 32k
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
@ -48,4 +49,11 @@ SECTIONS
|
||||
KEEP(*(.external_app.app_font_viewer.application_information));
|
||||
*(*ui*external_app*font_viewer*);
|
||||
} > ram_external_app_font_viewer
|
||||
|
||||
|
||||
.external_app_blespam : ALIGN(4) SUBALIGN(4)
|
||||
{
|
||||
KEEP(*(.external_app.app_blespam.application_information));
|
||||
*(*ui*external_app*blespam*);
|
||||
} > ram_external_app_blespam
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user