forked from flipperdevices/flipperzero-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'flipperdevices:dev' into dev
- Loading branch information
Showing
70 changed files
with
871 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
applications/debug/unit_tests/tests/furi/furi_errno_test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <furi.h> | ||
#include <errno.h> | ||
#include "../test.h" // IWYU pragma: keep | ||
|
||
#define TAG "ErrnoTest" | ||
#define THREAD_CNT 16 | ||
#define ITER_CNT 1000 | ||
|
||
static int32_t errno_fuzzer(void* context) { | ||
int start_value = (int)context; | ||
int32_t fails = 0; | ||
|
||
for(int i = start_value; i < start_value + ITER_CNT; i++) { | ||
errno = i; | ||
furi_thread_yield(); | ||
if(errno != i) fails++; | ||
} | ||
|
||
for(int i = 0; i < ITER_CNT; i++) { | ||
errno = 0; | ||
furi_thread_yield(); | ||
UNUSED(strtol("123456", NULL, 10)); // -V530 | ||
furi_thread_yield(); | ||
if(errno != 0) fails++; | ||
|
||
errno = 0; | ||
furi_thread_yield(); | ||
UNUSED(strtol("123456123456123456123456123456123456123456123456", NULL, 10)); // -V530 | ||
furi_thread_yield(); | ||
if(errno != ERANGE) fails++; | ||
} | ||
|
||
return fails; | ||
} | ||
|
||
void test_errno_saving(void) { | ||
FuriThread* threads[THREAD_CNT]; | ||
|
||
for(int i = 0; i < THREAD_CNT; i++) { | ||
int start_value = i * ITER_CNT; | ||
threads[i] = furi_thread_alloc_ex("ErrnoFuzzer", 1024, errno_fuzzer, (void*)start_value); | ||
furi_thread_set_priority(threads[i], FuriThreadPriorityNormal); | ||
furi_thread_start(threads[i]); | ||
} | ||
|
||
for(int i = 0; i < THREAD_CNT; i++) { | ||
furi_thread_join(threads[i]); | ||
mu_assert_int_eq(0, furi_thread_get_return_code(threads[i])); | ||
furi_thread_free(threads[i]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
applications/main/bad_usb/resources/badusb/Install_qFlipper_gnome.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ID 1234:abcd Generic:USB Keyboard | ||
REM Declare ourselves as a generic usb keyboard | ||
|
||
REM This will install qFlipper on Linux/Gnome, using the latest AppImage package | ||
|
||
REM Open a terminal | ||
ALT F2 | ||
DELAY 1000 | ||
STRINGLN gnome-terminal --maximize | ||
DELAY 1000 | ||
|
||
REM Ensure we have a folder to run executables from | ||
STRINGLN mkdir -p $HOME/.local/bin | ||
|
||
REM Download the latest AppImage | ||
STRINGLN curl -fsSL "https://update.flipperzero.one/qFlipper/release/linux-amd64/AppImage" -o "$HOME/.local/bin/qFlipper" | ||
DELAY 1000 | ||
|
||
REM Make it executable | ||
STRINGLN chmod +x $HOME/.local/bin/qFlipper | ||
|
||
REM Extract the appimage in /tmp to install icon and .desktop file | ||
STRINGLN cd /tmp | ||
STRINGLN $HOME/.local/bin/qFlipper --appimage-extract > /dev/null | ||
STRINGLN sed "s@Exec=qFlipper@Exec=$HOME/.local/bin/qFlipper@" squashfs-root/usr/share/applications/qFlipper.desktop > $HOME/.local/share/applications/qFlipper.desktop | ||
STRINGLN mkdir -p $HOME/.local/share/icons/hicolor/512x512/apps | ||
STRINGLN cp squashfs-root/usr/share/icons/hicolor/512x512/apps/qFlipper.png $HOME/.local/share/icons/hicolor/512x512/apps/qFlipper.png | ||
STRINGLN rm -rf squashfs-root | ||
STRINGLN cd | ||
|
||
REM Depending on the Linux distribution and display manager | ||
REM there might be several ways to update desktop entries | ||
REM try all | ||
STRINGLN xdg-desktop-menu forceupdate || true | ||
STRINGLN update-desktop-database ~/.local/share/applications || true | ||
|
||
STRINGLN echo " | ||
ENTER | ||
REPEAT 60 | ||
STRINGLN ========================================================================================== | ||
STRINGLN qFlipper has been installed to $HOME/.local/bin/ | ||
STRINGLN It should appear in your Applications menu. | ||
STRINGLN If it does not, you might want to log out and log in again. | ||
ENTER | ||
STRINGLN If you prefer to run qFlipper from your terminal, either use the absolute path | ||
STRINGLN or make sure $HOME/.local/bin/ is included in your PATH environment variable. | ||
ENTER | ||
STRINGLN Additional configurations might be required by your Linux distribution such as | ||
STRINGLN group membership, udev rules or else. | ||
STRINGLN ========================================================================================== | ||
STRINGLN " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
ID 1234:abcd Generic:USB Keyboard | ||
REM Declare ourselves as a generic usb keyboard | ||
REM You can override this to use something else | ||
REM Check the `lsusb` command to know your own devices IDs | ||
|
||
REM This is BadUSB demo script for Linux/Gnome | ||
|
||
REM Open terminal window | ||
DELAY 1000 | ||
ALT F2 | ||
DELAY 500 | ||
STRING gnome-terminal --maximize | ||
DELAY 500 | ||
ENTER | ||
DELAY 750 | ||
|
||
REM Clear the screen in case some banner was displayed | ||
STRING clear | ||
ENTER | ||
|
||
REM Bigger shell script example | ||
STRING cat > /dev/null << EOF | ||
ENTER | ||
|
||
STRING Hello World! | ||
ENTER | ||
|
||
DEFAULT_DELAY 50 | ||
|
||
STRING = | ||
REPEAT 59 | ||
ENTER | ||
ENTER | ||
|
||
STRING _.-------.._ -, | ||
ENTER | ||
HOME | ||
STRING .-"'''"--..,,_/ /'-, -, \ | ||
ENTER | ||
HOME | ||
STRING .:" /:/ /'\ \ ,_..., '. | | | ||
ENTER | ||
HOME | ||
STRING / ,----/:/ /'\ _\~'_-"' _; | ||
ENTER | ||
HOME | ||
STRING ' / /'"""'\ \ \.~'_-' ,-"'/ | ||
ENTER | ||
HOME | ||
STRING | | | 0 | | .-' ,/' / | ||
ENTER | ||
HOME | ||
STRING | ,..\ \ ,.-"' ,/' / | ||
ENTER | ||
HOME | ||
STRING ; : '/'""\' ,/--==,/-----, | ||
ENTER | ||
HOME | ||
STRING | '-...| -.___-Z:_______J...---; | ||
ENTER | ||
HOME | ||
STRING : ' _-' | ||
ENTER | ||
HOME | ||
STRING _L_ _ ___ ___ ___ ___ ____--"' | ||
ENTER | ||
HOME | ||
STRING | __|| | |_ _|| _ \| _ \| __|| _ \ | ||
ENTER | ||
HOME | ||
STRING | _| | |__ | | | _/| _/| _| | / | ||
ENTER | ||
HOME | ||
STRING |_| |____||___||_| |_| |___||_|_\ | ||
ENTER | ||
HOME | ||
ENTER | ||
|
||
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format | ||
ENTER | ||
STRING More information about script syntax can be found here: | ||
ENTER | ||
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md | ||
ENTER | ||
|
||
STRING EOF | ||
ENTER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.