Git Product home page Git Product logo

apdu's Introduction

APDU shell

A quick smartcard APDU read-evaluate-print loop shell with readline support.

Screenshot

Built with Python and pyscard.

Select PC/SC reader

Run apdu -l to list all PC/SC readers.

Select a reader by partial name or index (starting at 0) with apdu -r Gemplus or apdu -r 0.

On a selected reader, card can be inserted / removed during the shell session.

Inside the shell

APDU input

Type APDU commands as hex strings like 00 A4 0400 08 A000000003000000 00. Spaces are ignored unless theya are separating single numbers. Hexstring input 00 ย  1 2 0304 is the same as 00 01 02 03 04.

Save data response to a file

Append > <file name> to save data output (response without sw1 and sw2 bytes) to a file.

Example: 00 A4 04 00 08 A0 00 00 00 18 43 4D 00 00 > fci.bin

Comments

Comments starts with a #.

# Select "first" aid
00 A4 04 00 00
00 A4 04 00  08 A0 00 00 00 03 00 00 00  00    # not found?

Passthru external commands

External commands are supported withRUN <command>.

This will execute APDUs printed on command's standard output as hex strings, line by line, passing full response hex string (including sw1 and sw2 bytes) to command's standard input. External commands are useful to make mini scripts that depend on input/output sequence.

For example, I am using this with a command to do MIFARE Ultralight C authentication with RUN ultralightc_auth. This program does 3DES with RndA and RndB like shown here, modified to just read APDUs from standard input and write them to standard output in a frame required by PC/SC driver for the SCM SCL011 reader that I am using. Running this inside the APDU shell will create an authenticated session with the card.

Replay history and scripts

Use SAVE <file name> to save command history with comments to the file. Pipe this file to the shell to replay. Script file format is very simple, it is just a series of commands in plain text, one command per line. Blank lines are ignored.

There is also a CLEAR command to clear current history.

Alternatives

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.