1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 20:49:49 +04:00

Merge branch 'ofw-dev' into dev

This commit is contained in:
MX
2023-08-02 19:09:48 +03:00
6 changed files with 28 additions and 33 deletions

View File

@@ -146,7 +146,7 @@ static void nfc_cli_apdu(Cli* cli, FuriString* args) {
resp_size = (tx_rx.rx_bits / 8) * 2; resp_size = (tx_rx.rx_bits / 8) * 2;
if(!resp_size) { if(!resp_size) {
printf("No response\r\n"); printf("No response\r\n");
break; continue;
} }
resp_buffer = malloc(resp_size); resp_buffer = malloc(resp_size);
uint8_to_hex_chars(tx_rx.rx_data, resp_buffer, resp_size); uint8_to_hex_chars(tx_rx.rx_data, resp_buffer, resp_size);

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif #endif
#define RECORD_LOADER "loader" #define RECORD_LOADER "loader"
#define LOADER_APPLICATIONS_NAME "Applications" #define LOADER_APPLICATIONS_NAME "Apps"
typedef struct Loader Loader; typedef struct Loader Loader;

View File

@@ -14,7 +14,7 @@ static void loader_cli_print_usage() {
} }
static void loader_cli_list() { static void loader_cli_list() {
printf("Applications:\r\n"); printf("Apps:\r\n");
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
printf("\t%s\r\n", FLIPPER_APPS[i].name); printf("\t%s\r\n", FLIPPER_APPS[i].name);
} }

View File

@@ -7,10 +7,10 @@
#define APPS_COUNT (FLIPPER_APPS_COUNT + FLIPPER_EXTERNAL_APPS_COUNT) #define APPS_COUNT (FLIPPER_APPS_COUNT + FLIPPER_EXTERNAL_APPS_COUNT)
#define EXTERNAL_BROWSER_NAME ("Applications") #define EXTERNAL_BROWSER_NAME ("Apps")
#define EXTERNAL_BROWSER_INDEX (APPS_COUNT + 1) #define EXTERNAL_BROWSER_INDEX (APPS_COUNT + 1)
#define EXTERNAL_APPLICATION_NAME ("[External Application]") #define EXTERNAL_APPLICATION_NAME ("[Select App]")
#define EXTERNAL_APPLICATION_INDEX (APPS_COUNT + 2) #define EXTERNAL_APPLICATION_INDEX (APPS_COUNT + 2)
#define NONE_APPLICATION_INDEX (APPS_COUNT + 3) #define NONE_APPLICATION_INDEX (APPS_COUNT + 3)

View File

@@ -1030,30 +1030,14 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
deactivated = true; deactivated = true;
} }
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) { if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
if(mf_classic_is_key_found(data, i, MfClassicKeyA)) {
uint64_t found_key;
if(nfc_worker_mf_get_b_key_from_sector_trailer(
&tx_rx, i, key, &found_key)) {
FURI_LOG_D(TAG, "Found B key via reading sector %d", i);
mf_classic_set_key_found(data, i, MfClassicKeyB, found_key);
if(nfc_worker->state == NfcWorkerStateMfClassicDictAttack) {
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
}
nfc_worker_mf_classic_key_attack(nfc_worker, found_key, &tx_rx, i + 1);
break;
}
}
if(mf_classic_authenticate_skip_activate( if(mf_classic_authenticate_skip_activate(
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { &tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { //-V547
FURI_LOG_D(TAG, "Key B found: %012llX", key); FURI_LOG_D(TAG, "Key B found: %012llX", key);
mf_classic_set_key_found(data, i, MfClassicKeyB, key); mf_classic_set_key_found(data, i, MfClassicKeyB, key);
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context); nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1); nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1);
} }
deactivated = true; deactivated = true; //-V1048
} else { } else {
// If the key B is marked as found and matches the searching key, invalidate it // If the key B is marked as found and matches the searching key, invalidate it
MfClassicSectorTrailer* sec_trailer = MfClassicSectorTrailer* sec_trailer =
@@ -1065,12 +1049,12 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
if(mf_classic_is_key_found(data, i, MfClassicKeyB) && if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
memcmp(sec_trailer->key_b, current_key, 6) == 0) { memcmp(sec_trailer->key_b, current_key, 6) == 0) {
if(!mf_classic_authenticate_skip_activate( if(!mf_classic_authenticate_skip_activate(
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { &tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { //-V547
mf_classic_set_key_not_found(data, i, MfClassicKeyB); mf_classic_set_key_not_found(data, i, MfClassicKeyB);
FURI_LOG_D(TAG, "Key %dB not found in attack", i); FURI_LOG_D(TAG, "Key %dB not found in attack", i);
} }
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
deactivated = true; deactivated = true; //-V1048
} }
} }
if(mf_classic_is_key_found(data, i, MfClassicKeyA) && if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&

View File

@@ -82,6 +82,9 @@ fbtenv_restore_env()
fbtenv_check_sourced() fbtenv_check_sourced()
{ {
if [ -n "${FBT_SKIP_CHECK_SOURCED:-""}" ]; then
return 0;
fi
case "${ZSH_EVAL_CONTEXT:-""}" in *:file:*) case "${ZSH_EVAL_CONTEXT:-""}" in *:file:*)
setopt +o nomatch; # disabling 'no match found' warning in zsh setopt +o nomatch; # disabling 'no match found' warning in zsh
return 0;; return 0;;
@@ -210,7 +213,7 @@ fbtenv_download_toolchain_tar()
return 0; return 0;
} }
fbtenv_remove_old_tooclhain() fbtenv_remove_old_toolchain()
{ {
printf "Removing old toolchain.."; printf "Removing old toolchain..";
rm -rf "${TOOLCHAIN_ARCH_DIR:?}"; rm -rf "${TOOLCHAIN_ARCH_DIR:?}";
@@ -241,12 +244,14 @@ fbtenv_unpack_toolchain()
fbtenv_cleanup() fbtenv_cleanup()
{ {
printf "Cleaning up..";
if [ -n "${FBT_TOOLCHAIN_PATH:-""}" ]; then if [ -n "${FBT_TOOLCHAIN_PATH:-""}" ]; then
rm -rf "${FBT_TOOLCHAIN_PATH:?}/toolchain/"*.tar.gz; printf "Cleaning up..";
rm -rf "${FBT_TOOLCHAIN_PATH:?}/toolchain/"*.part; rm -rf "${FBT_TOOLCHAIN_PATH:?}/toolchain/"*.part;
if [ -z "${FBT_PRESERVE_TAR:-""}" ]; then
rm -rf "${FBT_TOOLCHAIN_PATH:?}/toolchain/"*.tar.gz;
fi fi
echo "done"; echo "done";
fi
trap - 2; trap - 2;
return 0; return 0;
} }
@@ -299,16 +304,22 @@ fbtenv_download_toolchain()
fbtenv_curl_wget_check || return 1; fbtenv_curl_wget_check || return 1;
fbtenv_download_toolchain_tar || return 1; fbtenv_download_toolchain_tar || return 1;
fi fi
fbtenv_remove_old_tooclhain; fbtenv_remove_old_toolchain;
fbtenv_unpack_toolchain || return 1; fbtenv_unpack_toolchain || return 1;
fbtenv_cleanup; fbtenv_cleanup;
return 0; return 0;
} }
fbtenv_print_version() fbtenv_print_config()
{ {
if [ -n "$FBT_VERBOSE" ]; then if [ -n "${FBT_VERBOSE:-""}" ]; then
echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")"; echo "FBT: using toolchain version $(cat "$TOOLCHAIN_ARCH_DIR/VERSION")";
if [ -n "${FBT_SKIP_CHECK_SOURCED:-""}" ]; then
echo "FBT: fbtenv will not check if it is sourced or not";
fi
if [ -n "${FBT_PRESERVE_TAR:-""}" ]; then
echo "FBT: toolchain archives will be saved";
fi
fi fi
} }
@@ -326,7 +337,7 @@ fbtenv_main()
fbtenv_check_env_vars || return 1; fbtenv_check_env_vars || return 1;
fbtenv_check_download_toolchain || return 1; fbtenv_check_download_toolchain || return 1;
fbtenv_set_shell_prompt; fbtenv_set_shell_prompt;
fbtenv_print_version; fbtenv_print_config;
PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/python/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/bin:$PATH";
PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH"; PATH="$TOOLCHAIN_ARCH_DIR/protobuf/bin:$PATH";