Skip to content

ScriptingAndAPDUExchange

Dr. Maxie Dion Schmidt edited this page Feb 27, 2026 · 5 revisions

Scripting and APDU command exchange in the application

Direct (raw) APDU command exchange

There are a couple of SEND and SEND_RAW commands to transfer APDU-style sequences of bytes to the device documented in the chameleon commands. The usage available in the app is summarized as follows:

This subtab enables users to grok, or otherwise lookup in realtime, particular APDU command combinations from a detailed, multi-device-spec dictionary compiled from within the app source.

Scripting

This feature is a work in progress (under construction). In principle, the idea is to run a short shell-like script with a list of in-order commands recognized by the Chameleon device terminal, or otherwise encode notation for directly transferring a sequence of bitwise APDU commands to the device. A complete spec of what should eventually work to script operations on/with a live Chameleon device is given in the points in this overview. The script parser / lever will be done with ANTLR4 (in Java) as an imported Android library. This is a very powerful and robust way to provide support for otherwise complicated grammars.

A sketch to the application intended functionality is seen below:

Update (early Spring of 2026):

I am back working actively on the CMLD project and on the work-in-progress scripting functionality. Demonstrations of the syntax that is supported by the built-in script parsers are found in this sample directory. For example, the following script shows supported functionality:

$cmdOutput = $$("CONFIG=MF_DESFIRE")
Printf("CMD-RESP(%03d) [%s] ... \n", $cmdOutput->respCode, $cmdOutput->respText)

$cmdOutput = $$("CONFIG?")
Printf("CmdName=%s (%d) [%s] -> %s %s / %s\n", 
       $cmdOutput->cmdName, $cmdOutput->respCode, $cmdOutput->respText,
       $cmdOutput->data, $cmdOutput->isError ? "XX" : "OK", 
       $cmdOutput->isTimeout ? "TMT" : "NO-TMT")

myBkptLabel:

$tagUID = $$("UID?")
$tagUID = Replace($tagUID, "..(?!$)", "$0" + ":")
Print("Tag UID = ", $tagUID)

Exit(0)

Clone this wiki locally