Jammer improvements (#2674)

* Add new jammer modes
Overview:
This PR enhances the PortaPack Jammer app by introducing eight new signal types, ported from my Flipper Zero RF Jammer app (https://github.com/RocketGod-git/flipper-zero-rf-jammer). These modes expand the app's capability to disrupt a wide range of RF communication protocols, from analog radios to modern digital systems. The implementation preserves the original app structure, resolves namespace conflicts, and ensures compatibility with the Mayhem firmware.

New Modes

The following modes have been added to the options_type in ui_jammer.hpp, with corresponding signal generation in proc_jammer.cpp:

Noise: Generates broadband white noise to interfere with analog and digital signals (e.g., Wi-Fi, Bluetooth, key fobs). Highly effective for overwhelming receivers across a frequency range.

Sine: Produces a continuous, unmodulated sine wave to jam narrowband receivers, ideal for analog FM/AM radios or telemetry systems.

Square: Emits a harmonic-rich square wave, disrupting digital protocols (e.g., OOK, ASK) and systems sensitive to sharp transitions, such as remote keyless entry.

Sawtooth (Experimental): Generates a sawtooth wave with a unique harmonic profile, useful for testing interference against PWM-based or niche analog systems.

Triangle (Experimental): Creates a triangle wave with minimal harmonics, suitable for exploratory jamming of narrowband systems or receiver linearity testing.

Chirp: Outputs a rapid frequency-sweeping chirp signal, effective against frequency-hopping and spread-spectrum systems (e.g., some Wi-Fi, Bluetooth, or military radios).

Gauss: Generates Gaussian noise to mimic natural interference, targeting digital systems like GPS or data links by degrading signal-to-noise ratios.

Brute (Experimental): Transmits a constant maximum-amplitude signal to saturate simple receiver front-ends, useful for brute-force jamming of basic analog devices.

* Fixed and made brutal.

This PR introduces user-focused improvements to the Jammer App in the HackRF PortaPack Mayhem Firmware, enhancing usability and flexibility. The changes address specific user requirements for a more intuitive default configuration, continuous waveform support, and dynamic setting adjustments during transmission.
This commit is contained in:
RocketGod 2025-05-31 13:16:57 -07:00 committed by GitHub
parent f90bd44617
commit fd158e873a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 158 additions and 73 deletions

View file

@ -41,27 +41,12 @@ class RangeView : public View {
RangeView(NavigationView& nav);
void focus() override;
void paint(Painter&) override;
void paint(Painter& painter) override;
jammer_range_t frequency_range{false, 0, 0};
private:
void update_start(rf::Frequency f);
void update_stop(rf::Frequency f);
void update_center(rf::Frequency f);
void update_width(uint32_t w);
uint32_t width{};
rf::Frequency center{};
const Style& style_info = *Theme::getInstance()->fg_medium;
Labels labels{
{{2 * 8, 8 * 8 + 4}, LanguageHelper::currentMessages[LANG_START], Theme::getInstance()->fg_light->foreground},
{{23 * 8, 8 * 8 + 4}, LanguageHelper::currentMessages[LANG_STOP], Theme::getInstance()->fg_light->foreground},
{{12 * 8, 5 * 8 - 4}, "Center", Theme::getInstance()->fg_light->foreground},
{{12 * 8 + 4, 13 * 8}, "Width", Theme::getInstance()->fg_light->foreground}};
Checkbox check_enabled{
{1 * 8, 4},
12,
@ -74,15 +59,32 @@ class RangeView : public View {
Button button_start{
{0 * 8, 11 * 8, 11 * 8, 28},
""};
Button button_stop{
{19 * 8, 11 * 8, 11 * 8, 28},
""};
Button button_center{
{76, 4 * 15 - 4, 11 * 8, 28},
""};
Button button_width{
{76, 8 * 15, 11 * 8, 28},
""};
void update_start(rf::Frequency f);
void update_stop(rf::Frequency f);
void update_center(rf::Frequency f);
void update_width(uint32_t w);
private:
const Style& style_info = *Theme::getInstance()->fg_medium;
Labels labels{
{{2 * 8, 8 * 8 + 4}, LanguageHelper::currentMessages[LANG_START], Theme::getInstance()->fg_light->foreground},
{{23 * 8, 8 * 8 + 4}, LanguageHelper::currentMessages[LANG_STOP], Theme::getInstance()->fg_light->foreground},
{{12 * 8, 5 * 8 - 4}, "Center", Theme::getInstance()->fg_light->foreground},
{{12 * 8 + 4, 13 * 8}, "Width", Theme::getInstance()->fg_light->foreground}};
};
class JammerView : public View {
@ -110,15 +112,16 @@ class JammerView : public View {
void start_tx();
void on_timer();
void stop_tx();
bool update_config();
void set_jammer_channel(uint32_t i, uint32_t width, uint64_t center, uint32_t duration);
void on_retune(const rf::Frequency freq, const uint32_t range);
JammerChannel* jammer_channels = (JammerChannel*)shared_memory.bb_data.data;
bool jamming{false};
bool cooling{false}; // euquiq: Indicates jammer in cooldown
uint16_t seconds = 0; // euquiq: seconds counter for toggling tx / cooldown
int16_t mscounter = 0; // euquiq: Internal ms counter for do_timer()
lfsr_word_t lfsr_v = 1; // euquiq: Used to generate "random" Jitter
bool cooling{false};
uint16_t seconds{0};
int16_t mscounter{0};
lfsr_word_t lfsr_v{1};
const Style& style_val = *Theme::getInstance()->fg_green;
const Style& style_cancel = *Theme::getInstance()->fg_red;
@ -140,8 +143,8 @@ class JammerView : public View {
{{1 * 8, 25 * 8}, "Speed:", Theme::getInstance()->fg_light->foreground},
{{3 * 8, 27 * 8}, "Hop:", Theme::getInstance()->fg_light->foreground},
{{4 * 8, 29 * 8}, "TX:", Theme::getInstance()->fg_light->foreground},
{{1 * 8, 31 * 8}, "Sle3p:", Theme::getInstance()->fg_light->foreground}, // euquiq: Token of appreciation to TheSle3p, which made this ehnancement a reality with his bounty.
{{0 * 8, 33 * 8}, "Jitter:", Theme::getInstance()->fg_light->foreground}, // Maybe the repository curator can keep the "mystype" for some versions.
{{1 * 8, 31 * 8}, "Sleep:", Theme::getInstance()->fg_light->foreground},
{{0 * 8, 33 * 8}, "Jitter:", Theme::getInstance()->fg_light->foreground},
{{11 * 8, 29 * 8}, "Secs.", Theme::getInstance()->fg_light->foreground},
{{11 * 8, 31 * 8}, "Secs.", Theme::getInstance()->fg_light->foreground},
{{11 * 8, 33 * 8}, "/60", Theme::getInstance()->fg_light->foreground},
@ -182,7 +185,8 @@ class JammerView : public View {
OptionsField options_hop{
{7 * 8, 27 * 8},
5,
{{"10ms ", 1},
{{"Off ", 0},
{"10ms ", 1},
{"50ms ", 5},
{"100ms", 10},
{"1s ", 100},
@ -201,7 +205,7 @@ class JammerView : public View {
NumberField field_timepause{
{8 * 8, 31 * 8},
2,
{1, 60},
{0, 60},
1,
' ',
};
@ -209,7 +213,7 @@ class JammerView : public View {
NumberField field_jitter{
{8 * 8, 33 * 8},
2,
{1, 60},
{0, 60},
1,
' ',
};