mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 03:18:35 -07:00
Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "../lfrfid_i.h"
|
#include "../lfrfid_i.h"
|
||||||
|
#include <bit_lib.h>
|
||||||
#include "tools/t5577.h"
|
#include "tools/t5577.h"
|
||||||
#define TAG "Clear T5577"
|
#define TAG "Clear T5577"
|
||||||
|
|
||||||
@@ -21,8 +22,7 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Clear custom password
|
// Clear custom password
|
||||||
uint32_t custom_pass = (app->password[0] << 24) | (app->password[1] << 16) |
|
uint32_t custom_pass = bit_lib_bytes_to_num_be(app->password, 4);
|
||||||
(app->password[2] << 8) | (app->password[3]);
|
|
||||||
snprintf(curr_buf, sizeof(curr_buf), "Custom password");
|
snprintf(curr_buf, sizeof(curr_buf), "Custom password");
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "../lfrfid_i.h"
|
#include "../lfrfid_i.h"
|
||||||
|
#include "bit_lib.h"
|
||||||
#include "gui/scene_manager.h"
|
#include "gui/scene_manager.h"
|
||||||
|
|
||||||
int next_scene;
|
int next_scene;
|
||||||
@@ -16,7 +17,7 @@ void lfrfid_scene_enter_password_on_enter(void* context) {
|
|||||||
const uint32_t* password_list = lfrfid_get_t5577_default_passwords(&password_list_size);
|
const uint32_t* password_list = lfrfid_get_t5577_default_passwords(&password_list_size);
|
||||||
uint32_t pass = password_list[furi_get_tick() % password_list_size];
|
uint32_t pass = password_list[furi_get_tick() % password_list_size];
|
||||||
|
|
||||||
for(uint8_t i = 0; i < 4; i++) app->password[4 - (i + 1)] = (pass >> (8 * i)) & 0xFF;
|
bit_lib_num_to_bytes_be(pass, 4, app->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter the password in hex");
|
byte_input_set_header_text(byte_input, "Enter the password in hex");
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "Aime"
|
#define TAG "Aime"
|
||||||
|
|
||||||
static const uint64_t aime_key = 0x574343467632;
|
static const uint64_t aime_key = 0x574343467632;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <nfc/protocols/mf_ultralight/mf_ultralight.h>
|
#include <nfc/protocols/mf_ultralight/mf_ultralight.h>
|
||||||
|
|
||||||
#define TAG "AllInOne"
|
#define TAG "AllInOne"
|
||||||
|
|||||||
@@ -19,10 +19,11 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
|
#include <bit_lib.h>
|
||||||
#include <applications/services/locale/locale.h>
|
#include <applications/services/locale/locale.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|||||||
@@ -16,17 +16,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "core/string.h"
|
|
||||||
#include "furi_hal_rtc.h"
|
|
||||||
#include "helpers/nfc_emv_parser.h"
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/emv/emv.h"
|
#include "protocols/emv/emv.h"
|
||||||
#include "protocols/nfc_protocol.h"
|
#include "helpers/nfc_emv_parser.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <nfc/helpers/nfc_util.h>
|
|
||||||
|
|
||||||
#define TAG "EMV"
|
#define TAG "EMV"
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "../../api/gallagher/gallagher_util.h"
|
#include "../../api/gallagher/gallagher_util.h"
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <bit_lib.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
|
|
||||||
static bool gallagher_parse(const NfcDevice* device, FuriString* parsed_data) {
|
static bool gallagher_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
furi_assert(device);
|
furi_assert(device);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application.h>
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "HI!"
|
#define TAG "HI!"
|
||||||
#define KEY_LENGTH 6
|
#define KEY_LENGTH 6
|
||||||
#define HI_KEY_TO_GEN 5
|
#define HI_KEY_TO_GEN 5
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "HID"
|
#define TAG "HID"
|
||||||
|
|
||||||
static const uint64_t hid_key = 0x484944204953;
|
static const uint64_t hid_key = 0x484944204953;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* itso.c - Parser for ITSO cards (United Kingdom). */
|
/* itso.c - Parser for ITSO cards (United Kingdom). */
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
||||||
|
|
||||||
#include <applications/services/locale/locale.h>
|
#include <applications/services/locale/locale.h>
|
||||||
|
|||||||
@@ -17,14 +17,11 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
|
|
||||||
#define TAG "Kazan"
|
#define TAG "Kazan"
|
||||||
|
|||||||
@@ -17,14 +17,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "Metromoney"
|
#define TAG "Metromoney"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application.h>
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "Microel"
|
#define TAG "Microel"
|
||||||
#define KEY_LENGTH 6
|
#define KEY_LENGTH 6
|
||||||
#define UID_LENGTH 4
|
#define UID_LENGTH 4
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application.h>
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "MiZIP"
|
#define TAG "MiZIP"
|
||||||
#define KEY_LENGTH 6
|
#define KEY_LENGTH 6
|
||||||
#define MIZIP_KEY_TO_GEN 5
|
#define MIZIP_KEY_TO_GEN 5
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <machine/endian.h>
|
#include <machine/endian.h>
|
||||||
#include <nfc/protocols/st25tb/st25tb.h>
|
#include <nfc/protocols/st25tb/st25tb.h>
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
* Reference: https://github.com/metrodroid/metrodroid/wiki/Myki
|
* Reference: https://github.com/metrodroid/metrodroid/wiki/Myki
|
||||||
*/
|
*/
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
||||||
|
|
||||||
static const MfDesfireApplicationId myki_app_id = {.data = {0x00, 0x11, 0xf2}};
|
static const MfDesfireApplicationId myki_app_id = {.data = {0x00, 0x11, 0xf2}};
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
// Made by @Willy-JL
|
// Made by @Willy-JL
|
||||||
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <nfc/protocols/mf_ultralight/mf_ultralight.h>
|
#include <nfc/protocols/mf_ultralight/mf_ultralight.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "NDEF"
|
#define TAG "NDEF"
|
||||||
|
|
||||||
static bool is_text(const uint8_t* buf, size_t len) {
|
static bool is_text(const uint8_t* buf, size_t len) {
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
#include <applications/services/locale/locale.h>
|
|
||||||
#include <furi_hal_rtc.h>
|
|
||||||
|
|
||||||
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
#include <lib/nfc/protocols/mf_desfire/mf_desfire.h>
|
||||||
|
|
||||||
|
#include <applications/services/locale/locale.h>
|
||||||
|
#include <furi_hal_rtc.h>
|
||||||
|
|
||||||
static const MfDesfireApplicationId opal_app_id = {.data = {0x31, 0x45, 0x53}};
|
static const MfDesfireApplicationId opal_app_id = {.data = {0x31, 0x45, 0x53}};
|
||||||
|
|
||||||
static const MfDesfireFileId opal_file_id = 0x07;
|
static const MfDesfireFileId opal_file_id = 0x07;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "Plantain"
|
#define TAG "Plantain"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
// FZ plugin by @noproto
|
// FZ plugin by @noproto
|
||||||
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application.h>
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "Saflok"
|
#define TAG "Saflok"
|
||||||
#define MAGIC_TABLE_SIZE 192
|
#define MAGIC_TABLE_SIZE 192
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <core/check.h>
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <core/string.h>
|
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <core/check.h>
|
|
||||||
|
|
||||||
#define TAG "Social_Moscow"
|
#define TAG "Social_Moscow"
|
||||||
|
|
||||||
@@ -63,39 +59,6 @@ static const MfClassicKeyPair social_moscow_4k_keys[] = {
|
|||||||
{.a = 0xa229e68ad9e5, .b = 0x49c2b5296ef4}, {.a = 0xa229e68ad9e5, .b = 0x49c2b5296ef4},
|
{.a = 0xa229e68ad9e5, .b = 0x49c2b5296ef4}, {.a = 0xa229e68ad9e5, .b = 0x49c2b5296ef4},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_MINUTE 60
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_HOUR (FURI_HAL_RTC_SECONDS_PER_MINUTE * 60)
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_DAY (FURI_HAL_RTC_SECONDS_PER_HOUR * 24)
|
|
||||||
#define FURI_HAL_RTC_EPOCH_START_YEAR 1970
|
|
||||||
#define FURI_HAL_RTC_IS_LEAP_YEAR(year) \
|
|
||||||
((((year) % 4 == 0) && ((year) % 100 != 0)) || ((year) % 400 == 0))
|
|
||||||
|
|
||||||
void timestamp_to_datetime(uint32_t timestamp, FuriHalRtcDateTime* datetime) {
|
|
||||||
uint32_t days = timestamp / FURI_HAL_RTC_SECONDS_PER_DAY;
|
|
||||||
uint32_t seconds_in_day = timestamp % FURI_HAL_RTC_SECONDS_PER_DAY;
|
|
||||||
|
|
||||||
datetime->year = FURI_HAL_RTC_EPOCH_START_YEAR;
|
|
||||||
|
|
||||||
while(days >= furi_hal_rtc_get_days_per_year(datetime->year)) {
|
|
||||||
days -= furi_hal_rtc_get_days_per_year(datetime->year);
|
|
||||||
(datetime->year)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime->month = 1;
|
|
||||||
while(days >= furi_hal_rtc_get_days_per_month(
|
|
||||||
FURI_HAL_RTC_IS_LEAP_YEAR(datetime->year), datetime->month)) {
|
|
||||||
days -= furi_hal_rtc_get_days_per_month(
|
|
||||||
FURI_HAL_RTC_IS_LEAP_YEAR(datetime->year), datetime->month);
|
|
||||||
(datetime->month)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime->day = days + 1;
|
|
||||||
datetime->hour = seconds_in_day / FURI_HAL_RTC_SECONDS_PER_HOUR;
|
|
||||||
datetime->minute =
|
|
||||||
(seconds_in_day % FURI_HAL_RTC_SECONDS_PER_HOUR) / FURI_HAL_RTC_SECONDS_PER_MINUTE;
|
|
||||||
datetime->second = seconds_in_day % FURI_HAL_RTC_SECONDS_PER_MINUTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
||||||
uint32_t timestamp = days * 24 * 60 * 60;
|
uint32_t timestamp = days * 24 * 60 * 60;
|
||||||
FuriHalRtcDateTime start_datetime = {0};
|
FuriHalRtcDateTime start_datetime = {0};
|
||||||
@@ -103,7 +66,7 @@ void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t
|
|||||||
start_datetime.month = 12;
|
start_datetime.month = 12;
|
||||||
start_datetime.day = 31;
|
start_datetime.day = 31;
|
||||||
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
||||||
timestamp_to_datetime(timestamp, datetime);
|
furi_hal_rtc_timestamp_to_datetime(timestamp, datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
||||||
@@ -113,7 +76,7 @@ void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, ui
|
|||||||
start_datetime.month = 12;
|
start_datetime.month = 12;
|
||||||
start_datetime.day = 31;
|
start_datetime.day = 31;
|
||||||
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
||||||
timestamp_to_datetime(timestamp, datetime);
|
furi_hal_rtc_timestamp_to_datetime(timestamp, datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
|
bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
#include <core/check.h>
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <core/string.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <core/check.h>
|
|
||||||
|
|
||||||
#define TAG "Troika"
|
#define TAG "Troika"
|
||||||
|
|
||||||
@@ -64,39 +60,6 @@ static const MfClassicKeyPair troika_4k_keys[] = {
|
|||||||
{.a = 0x518dc6eea089, .b = 0x97c64ac98ca4}, {.a = 0xbb52f8cce07f, .b = 0x6b6119752c70},
|
{.a = 0x518dc6eea089, .b = 0x97c64ac98ca4}, {.a = 0xbb52f8cce07f, .b = 0x6b6119752c70},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_MINUTE 60
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_HOUR (FURI_HAL_RTC_SECONDS_PER_MINUTE * 60)
|
|
||||||
#define FURI_HAL_RTC_SECONDS_PER_DAY (FURI_HAL_RTC_SECONDS_PER_HOUR * 24)
|
|
||||||
#define FURI_HAL_RTC_EPOCH_START_YEAR 1970
|
|
||||||
#define FURI_HAL_RTC_IS_LEAP_YEAR(year) \
|
|
||||||
((((year) % 4 == 0) && ((year) % 100 != 0)) || ((year) % 400 == 0))
|
|
||||||
|
|
||||||
void timestamp_to_datetime(uint32_t timestamp, FuriHalRtcDateTime* datetime) {
|
|
||||||
uint32_t days = timestamp / FURI_HAL_RTC_SECONDS_PER_DAY;
|
|
||||||
uint32_t seconds_in_day = timestamp % FURI_HAL_RTC_SECONDS_PER_DAY;
|
|
||||||
|
|
||||||
datetime->year = FURI_HAL_RTC_EPOCH_START_YEAR;
|
|
||||||
|
|
||||||
while(days >= furi_hal_rtc_get_days_per_year(datetime->year)) {
|
|
||||||
days -= furi_hal_rtc_get_days_per_year(datetime->year);
|
|
||||||
(datetime->year)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime->month = 1;
|
|
||||||
while(days >= furi_hal_rtc_get_days_per_month(
|
|
||||||
FURI_HAL_RTC_IS_LEAP_YEAR(datetime->year), datetime->month)) {
|
|
||||||
days -= furi_hal_rtc_get_days_per_month(
|
|
||||||
FURI_HAL_RTC_IS_LEAP_YEAR(datetime->year), datetime->month);
|
|
||||||
(datetime->month)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
datetime->day = days + 1;
|
|
||||||
datetime->hour = seconds_in_day / FURI_HAL_RTC_SECONDS_PER_HOUR;
|
|
||||||
datetime->minute =
|
|
||||||
(seconds_in_day % FURI_HAL_RTC_SECONDS_PER_HOUR) / FURI_HAL_RTC_SECONDS_PER_MINUTE;
|
|
||||||
datetime->second = seconds_in_day % FURI_HAL_RTC_SECONDS_PER_MINUTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
||||||
uint32_t timestamp = days * 24 * 60 * 60;
|
uint32_t timestamp = days * 24 * 60 * 60;
|
||||||
FuriHalRtcDateTime start_datetime = {0};
|
FuriHalRtcDateTime start_datetime = {0};
|
||||||
@@ -104,7 +67,7 @@ void from_days_to_datetime(uint16_t days, FuriHalRtcDateTime* datetime, uint16_t
|
|||||||
start_datetime.month = 12;
|
start_datetime.month = 12;
|
||||||
start_datetime.day = 31;
|
start_datetime.day = 31;
|
||||||
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
||||||
timestamp_to_datetime(timestamp, datetime);
|
furi_hal_rtc_timestamp_to_datetime(timestamp, datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, uint16_t start_year) {
|
||||||
@@ -114,7 +77,7 @@ void from_minutes_to_datetime(uint32_t minutes, FuriHalRtcDateTime* datetime, ui
|
|||||||
start_datetime.month = 12;
|
start_datetime.month = 12;
|
||||||
start_datetime.day = 31;
|
start_datetime.day = 31;
|
||||||
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
timestamp += furi_hal_rtc_datetime_to_timestamp(&start_datetime);
|
||||||
timestamp_to_datetime(timestamp, datetime);
|
furi_hal_rtc_timestamp_to_datetime(timestamp, datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
|
bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application/flipper_application.h>
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
#include <nfc/nfc_device.h>
|
||||||
#include <bit_lib/bit_lib.h>
|
#include <bit_lib.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
#define TAG "TwoCities"
|
#define TAG "TwoCities"
|
||||||
|
|||||||
@@ -23,16 +23,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "core/core_defines.h"
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
#include "protocols/mf_classic/mf_classic.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
|
|
||||||
#define TAG "Umarsh"
|
#define TAG "Umarsh"
|
||||||
|
|||||||
@@ -19,14 +19,12 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
|
||||||
#include <bit_lib/bit_lib.h>
|
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
||||||
|
|
||||||
|
#include <bit_lib.h>
|
||||||
|
|
||||||
#define TAG "WashCity"
|
#define TAG "WashCity"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -18,15 +18,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "furi_hal_rtc.h"
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
#include "protocols/mf_classic/mf_classic.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
#include <bit_lib.h>
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
|
||||||
|
|
||||||
#define TAG "Zolotaya Korona"
|
#define TAG "Zolotaya Korona"
|
||||||
|
|
||||||
@@ -40,26 +38,6 @@ static const uint8_t info_sector_signature[] = {0xE2, 0x87, 0x80, 0x8E, 0x20, 0x
|
|||||||
0xAE, 0xE0, 0xAE, 0xAD, 0xA0, 0x00, 0x00,
|
0xAE, 0xE0, 0xAE, 0xAD, 0xA0, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00};
|
0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
uint64_t bytes2num_bcd(const uint8_t* src, uint8_t len_bytes, bool* is_bcd) {
|
|
||||||
furi_assert(src);
|
|
||||||
furi_assert(len_bytes <= 9);
|
|
||||||
|
|
||||||
uint64_t result = 0;
|
|
||||||
*is_bcd = true;
|
|
||||||
|
|
||||||
for(uint8_t i = 0; i < len_bytes; i++) {
|
|
||||||
if(((src[i] / 16) > 9) || ((src[i] % 16) > 9)) *is_bcd = false;
|
|
||||||
|
|
||||||
result *= 10;
|
|
||||||
result += src[i] / 16;
|
|
||||||
|
|
||||||
result *= 10;
|
|
||||||
result += src[i] % 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool zolotaya_korona_parse(const NfcDevice* device, FuriString* parsed_data) {
|
static bool zolotaya_korona_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||||
furi_assert(device);
|
furi_assert(device);
|
||||||
|
|
||||||
@@ -90,12 +68,14 @@ static bool zolotaya_korona_parse(const NfcDevice* device, FuriString* parsed_da
|
|||||||
|
|
||||||
// INFO SECTOR
|
// INFO SECTOR
|
||||||
// block 1
|
// block 1
|
||||||
const uint8_t region_number = bytes2num_bcd(block_start_ptr + 10, 1, &verified);
|
const uint8_t region_number = bit_lib_bytes_to_num_bcd(block_start_ptr + 10, 1, &verified);
|
||||||
|
|
||||||
// block 2
|
// block 2
|
||||||
block_start_ptr = &data->block[start_info_block_number + 2].data[4];
|
block_start_ptr = &data->block[start_info_block_number + 2].data[4];
|
||||||
const uint16_t card_number_prefix = bytes2num_bcd(block_start_ptr, 2, &verified);
|
const uint16_t card_number_prefix =
|
||||||
const uint64_t card_number_postfix = bytes2num_bcd(block_start_ptr + 2, 8, &verified) / 10;
|
bit_lib_bytes_to_num_bcd(block_start_ptr, 2, &verified);
|
||||||
|
const uint64_t card_number_postfix =
|
||||||
|
bit_lib_bytes_to_num_bcd(block_start_ptr + 2, 8, &verified) / 10;
|
||||||
|
|
||||||
// TRIP SECTOR
|
// TRIP SECTOR
|
||||||
const uint8_t start_trip_block_number =
|
const uint8_t start_trip_block_number =
|
||||||
@@ -123,7 +103,7 @@ static bool zolotaya_korona_parse(const NfcDevice* device, FuriString* parsed_da
|
|||||||
// block 2: trip block
|
// block 2: trip block
|
||||||
block_start_ptr = &data->block[start_trip_block_number + 2].data[0];
|
block_start_ptr = &data->block[start_trip_block_number + 2].data[0];
|
||||||
const char validator_first_letter = bit_lib_bytes_to_num_le(block_start_ptr + 1, 1);
|
const char validator_first_letter = bit_lib_bytes_to_num_le(block_start_ptr + 1, 1);
|
||||||
const uint32_t validator_id = bytes2num_bcd(block_start_ptr + 2, 3, &verified);
|
const uint32_t validator_id = bit_lib_bytes_to_num_bcd(block_start_ptr + 2, 3, &verified);
|
||||||
const uint32_t last_trip_timestamp = bit_lib_bytes_to_num_le(block_start_ptr + 6, 4);
|
const uint32_t last_trip_timestamp = bit_lib_bytes_to_num_le(block_start_ptr + 6, 4);
|
||||||
const uint8_t track_number = bit_lib_bytes_to_num_le(block_start_ptr + 10, 1);
|
const uint8_t track_number = bit_lib_bytes_to_num_le(block_start_ptr + 10, 1);
|
||||||
const uint32_t prev_balance = bit_lib_bytes_to_num_le(block_start_ptr + 11, 4);
|
const uint32_t prev_balance = bit_lib_bytes_to_num_le(block_start_ptr + 11, 4);
|
||||||
|
|||||||
@@ -17,41 +17,19 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "furi_hal_rtc.h"
|
|
||||||
#include "nfc_supported_card_plugin.h"
|
#include "nfc_supported_card_plugin.h"
|
||||||
|
#include <flipper_application.h>
|
||||||
|
|
||||||
#include "protocols/mf_classic/mf_classic.h"
|
#include "protocols/mf_classic/mf_classic.h"
|
||||||
#include <flipper_application/flipper_application.h>
|
|
||||||
|
|
||||||
#include <nfc/nfc_device.h>
|
#include <bit_lib.h>
|
||||||
#include <lib/bit_lib/bit_lib.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <nfc/protocols/mf_classic/mf_classic_poller_sync.h>
|
|
||||||
|
|
||||||
#define TAG "Zolotaya Korona Online"
|
#define TAG "Zolotaya Korona Online"
|
||||||
|
|
||||||
#define TRIP_SECTOR_NUM (4)
|
#define TRIP_SECTOR_NUM (4)
|
||||||
#define INFO_SECTOR_NUM (15)
|
#define INFO_SECTOR_NUM (15)
|
||||||
|
|
||||||
uint64_t bytes2num_bcd(const uint8_t* src, uint8_t len_bytes, bool* is_bcd) {
|
|
||||||
furi_assert(src);
|
|
||||||
furi_assert(len_bytes <= 9);
|
|
||||||
|
|
||||||
uint64_t result = 0;
|
|
||||||
*is_bcd = true;
|
|
||||||
|
|
||||||
for(uint8_t i = 0; i < len_bytes; i++) {
|
|
||||||
if(((src[i] / 16) > 9) || ((src[i] % 16) > 9)) *is_bcd = false;
|
|
||||||
|
|
||||||
result *= 10;
|
|
||||||
result += src[i] / 16;
|
|
||||||
|
|
||||||
result *= 10;
|
|
||||||
result += src[i] % 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool parse_online_card_tariff(uint16_t tariff_num, FuriString* tariff_name) {
|
bool parse_online_card_tariff(uint16_t tariff_num, FuriString* tariff_name) {
|
||||||
bool tariff_parsed = false;
|
bool tariff_parsed = false;
|
||||||
|
|
||||||
@@ -111,10 +89,11 @@ static bool zolotaya_korona_online_parse(const NfcDevice* device, FuriString* pa
|
|||||||
|
|
||||||
// Validate card number
|
// Validate card number
|
||||||
bool is_bcd;
|
bool is_bcd;
|
||||||
const uint16_t card_number_prefix = bytes2num_bcd(block_start_ptr, 2, &is_bcd);
|
const uint16_t card_number_prefix = bit_lib_bytes_to_num_bcd(block_start_ptr, 2, &is_bcd);
|
||||||
if(!is_bcd) break;
|
if(!is_bcd) break;
|
||||||
if(card_number_prefix != 9643) break;
|
if(card_number_prefix != 9643) break;
|
||||||
const uint64_t card_number_postfix = bytes2num_bcd(block_start_ptr + 2, 8, &is_bcd) / 10;
|
const uint64_t card_number_postfix =
|
||||||
|
bit_lib_bytes_to_num_bcd(block_start_ptr + 2, 8, &is_bcd) / 10;
|
||||||
if(!is_bcd) break;
|
if(!is_bcd) break;
|
||||||
|
|
||||||
// Parse data
|
// Parse data
|
||||||
|
|||||||
@@ -605,8 +605,7 @@ static void lfrfid_worker_mode_write_and_set_pass_process(LFRFIDWorker* worker)
|
|||||||
FURI_LOG_D(TAG, "Data write with pass");
|
FURI_LOG_D(TAG, "Data write with pass");
|
||||||
|
|
||||||
LfRfid* app = worker->cb_ctx;
|
LfRfid* app = worker->cb_ctx;
|
||||||
uint32_t pass = (app->password[0] << 24) | (app->password[1] << 16) |
|
uint32_t pass = bit_lib_bytes_to_num_be(app->password, 4);
|
||||||
(app->password[2] << 8) | (app->password[3]);
|
|
||||||
|
|
||||||
request->t5577.mask = 0b10000001;
|
request->t5577.mask = 0b10000001;
|
||||||
for(uint8_t i = 0; i < request->t5577.blocks_to_write; i++)
|
for(uint8_t i = 0; i < request->t5577.blocks_to_write; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user