4.4 KiB
Smart Card Command Tool - User Guide
Send Command is an easy-to-use graphical application for communicating with smart card readers and cards. Whether you need to test APDU commands or send low-level escape commands to your reader hardware, this tool provides a simple interface with automatic connection management.
What You Can Do
- Send APDU Commands: Communicate with smart cards using standard protocols.
- Send Escape Commands: Access reader hardware directly for advanced operations.
- Test Commands: Verify your smart card applications and reader functionality.
- Debug Issues: Get detailed response logging and error information.
Quick Start
- Install Dependencies (see Installation section below).
- Run the Application:
python Send_Command.py - Select Your Reader from the dropdown menu.
- Choose Command Type (APDU or Escape) by entering the command in the respective input field.
- Enter Your Command in hexadecimal format.
- Click Send and view the response in the log area.
Usage Patterns
GUI Mode (Interactive)
# Send APDU and escape commands via unified GUI
python Send_Command.py
CLI Mode (Command Line)
# Run command-line example demonstrating API usage
python example_cli.py
The CLI example (example_cli.py) demonstrates:
- Listing available readers
- Sending APDU commands (Get Card UID example)
- Sending escape commands (Get Reader Info example)
- Interactive mode for custom commands
Advanced Usage
For developers who wish to integrate smart card functionality into their own Python applications, please refer to the API Reference (API_REFERENCE.md) for detailed programmatic examples and function documentation.
Windows
Dependencies
For both applications:
- Python 3.6+ (from
python.orgor Microsoft Store) - tkinter (included with standard Python from
python.org) - pyscard
- Windows Smart Card API (built into Windows)
Installation
From an elevated Command Prompt or PowerShell:
pip install pyscard
If you get a tkinter import error, reinstall Python from python.org and ensure “tcl/tk and IDLE” is selected during setup.
Usage
REM Run unified Send Command application
python Send_Command.py
macOS
Dependencies
For both applications:
- Python 3.6+ (recommended: from
python.orgor via Homebrew) - tkinter (included with Python from
python.org; on Homebrew Python you may needpython-tk) - pyscard
- PCSC framework (pre-installed on macOS)
Installation
Using pip for the active Python 3:
pip install pyscard
If you get a tkinter import error:
- Install Python from
python.orgor - On Homebrew:
brew install python-tk
Usage
# Run unified Send Command application
python3 Send_Command.py
Ubuntu / Linux
Dependencies
For both applications:
- Python 3.6+
- python3-tk (system package providing Tkinter)
- pyscard (Python package)
- pcscd (PC/SC daemon)
- libpcsclite1 and libpcsclite-dev (PC/SC libraries)
Installation
sudo apt-get update
sudo apt-get install python3-tk
sudo apt-get install pcscd libpcsclite1 libpcsclite-dev
sudo systemctl start pcscd
sudo systemctl enable pcscd
pip install pyscard
Usage
# Run unified Send Command application
python3 Send_Command.py
Features
Send_Command.py (GUI Application)
- Unified GUI Interface: Single application for both APDU and escape commands
- Automatic Connection Management: Connect-send-disconnect flow for each command
- Dual Command Support:
- APDU commands: Communicate with smart cards via standard protocols
- Escape commands: Direct hardware communication with readers
- Real-time Response Logging: Detailed command execution feedback
- Platform Compatibility: Cross-platform support (Windows/macOS/Linux)
- Error Handling: Comprehensive error reporting and troubleshooting guidance
example_cli.py (CLI Example)
- Command-Line Interface: Demonstrates API usage without GUI dependencies
- Multiple Examples: Shows APDU and escape command usage patterns
- Interactive Mode: Allows custom command input for testing
- Educational: Clear examples for developers learning the API