add QR code generation in the pm3 client. It's a text based version using unicode to print the generated qr code. Might not work on all things but its a MIT license and a simple to use project

This commit is contained in:
iceman1001
2025-11-09 16:54:21 +01:00
parent 8df7a49a0e
commit fd06c38a89
5 changed files with 1036 additions and 0 deletions
+4
View File
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added basic QR code generation support. Thanks @mistial-dev for the idea! (@iceman1001)
- Added identification of NDEF/Open print tag record (@iceman1001)
- Added support for Bruce dump files [.rfid] (@iceman1001)
- Added script `read_t-union.py` (@klks)
@@ -20,6 +21,9 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Added `Verkada 40-bit` format (@aaronmaxlevy)
## [Phrack.4.20728][2025-09-11]
- Added `unofficial desfire bible` document (@mistial-dev)
- Fixed desfire value file operations (@mistial-dev)
- Added script `pm3_online_tests.sh` (@mistial-dev)
- Changed `lf t55xx restore` - now skips writing block0 if its all zeros (@iceman1001)
- Added `HID Simplex Grinnell 36-bit` - Improved Simplex decoder (@datafx, @henrygab)
- Changed `lf search` - also test for chipset even if there was just signal noice (@iceman1001)
+1
View File
@@ -323,6 +323,7 @@ set (TARGET_SOURCES
${PM3_ROOT}/client/src/uart/uart_win32.c
${PM3_ROOT}/client/src/ui/overlays.ui
${PM3_ROOT}/client/src/ui/image.ui
${PM3_ROOT}/client/src/qrcode/qrcode.c
${PM3_ROOT}/client/src/aidsearch.c
${PM3_ROOT}/client/src/atrs.c
${PM3_ROOT}/client/src/cmdanalyse.c
+1
View File
@@ -780,6 +780,7 @@ SRCS = mifare/aiddesfire.c \
scripting.c \
ui.c \
util.c \
qrcode/qrcode.c \
version_pm3.c \
wiegand_formats.c \
wiegand_formatutils.c
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
/**
* The MIT License (MIT)
*
* This library is written and maintained by Richard Moore.
* Major parts were derived from Project Nayuki's library.
*
* Copyright (c) 2017 Richard Moore (https://github.com/ricmoo/QRCode)
* Copyright (c) 2017 Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Special thanks to Nayuki (https://www.nayuki.io/) from which this library was
* heavily inspired and compared against.
*
* See: https://github.com/nayuki/QR-Code-generator/tree/master/cpp
*/
#ifndef __QRCODE_H_
#define __QRCODE_H_
#include <stdint.h>
#include <stdbool.h>
// QR Code Format Encoding
#define MODE_NUMERIC 0
#define MODE_ALPHANUMERIC 1
#define MODE_BYTE 2
// Error Correction Code Levels
#define ECC_LOW 0
#define ECC_MEDIUM 1
#define ECC_QUARTILE 2
#define ECC_HIGH 3
// If set to non-zero, this library can ONLY produce QR codes at that version
// This saves a lot of dynamic memory, as the codeword tables are skipped
#ifndef LOCK_VERSION
#define LOCK_VERSION 0
#endif
typedef struct QRCode {
uint8_t version;
uint8_t size;
uint8_t ecc;
uint8_t mode;
uint8_t mask;
uint8_t *modules;
} QRCode;
#ifdef __cplusplus
extern "C"{
#endif /* __cplusplus */
uint16_t qrcode_getBufferSize(uint8_t version);
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data);
int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length);
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y);
void qrcode_print_matrix_utf8(QRCode *q);
void qrcode_print_matrix_utf8_2x2(QRCode *q);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __QRCODE_H_ */