apduNFC

Mock Jutsu HOW-TO | EN

In the realm of Near Field Communication (NFC) and smart card development, the Application Protocol Data Unit (APDU) serves as the fundamental communication unit between a reader and a card. The mock-jutsu library provides a robust utility for generating realistic apdu command structures, enabling developers to simulate complex interactions without requiring physical hardware. By utilizing the apdu function, engineers can instantly produce structured test data that adheres to the ISO/IEC 7816 standard, which defines the communication protocols for integrated circuit cards. This capability is essential for building resilient systems that must process a variety of command types, ranging from simple identity verification to complex cryptographic operations.

Every generated apdu object from mock-jutsu follows the standard architectural pattern, providing key fields such as the Class byte (CLA), Instruction byte (INS), and Parameter bytes (P1 and P2). The library also outputs the full command in a hexadecimal string format, which is the industry standard for low-level protocol debugging. This detailed mock data allows developers to populate their databases or API responses with valid-looking command sequences, ensuring that the software layer can correctly parse and route instructions before they reach the hardware abstraction layer. Whether you are working via the Python API, the command-line interface, or integrating directly into performance tests with JMeter, the tool ensures consistency across your development lifecycle.

Testing scenarios for NFC applications often require high-volume data to ensure the system handles edge cases and potential protocol errors gracefully. With mock-jutsu, teams can perform negative testing by generating unexpected command sequences or fuzzing specific bytes within the apdu structure to observe how the application reacts to malformed input. This proactive approach to quality assurance reduces the risk of runtime failures in production environments like point-of-sale systems or secure access control readers. By automating the creation of this specialized test data, developers save significant time that would otherwise be spent manually crafting hex strings, allowing them to focus on high-level logic and security implementation.

The integration of the apdu function into existing CI/CD pipelines is seamless, offering a significant productivity boost for teams specializing in fintech, logistics, or IoT. By leveraging mock-jutsu to provide high-fidelity mock data, developers can simulate a wide array of smart card profiles and application identifiers (AIDs) without the logistical overhead of managing physical tokens. This versatility makes the library an indispensable asset for modern software engineering teams who demand precision and speed when simulating the intricate communication protocols of the NFC ecosystem.

CLI Usage
mockjutsu generate apdumockjutsu bulk apdu --count 10mockjutsu export apdu --count 10 --format jsonmockjutsu export apdu --count 10 --format csvmockjutsu export apdu --count 10 --format sql
Python API
from mockjutsu import jutsujutsu.generate('apdu')jutsu.bulk('apdu', count=10)jutsu.template(['apdu'], count=5)
JMeter
${__mockjutsu_iot(apdu)}# JMeter Function: __mockjutsu_iot# Parameter 1: apdu# Parameter 2: (not required for this function)
REST API
GET /generate/apdu# → {"type":"apdu","result":"...","status":"ok"}GET /bulk/apdu?count=10POST /template {"types":["apdu"],"count":1}

Other Languages