• Stars
    star
    110
  • Rank 309,957 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

EMV Smartcard Protocol Tool and Library

EMV for Python

Tests

A Pythonic implementation of the EMV smartcard protocol, which is used worldwide for chip-and-PIN payments. This is intended to be readable, tested, and heavily cross-referenced with the appropriate sections of the EMV Specification.

This also includes an implementation of the EMV CAP (aka Pinsentry) standard which is known to work for Barclays cards.

Installation

You'll need the pcsc smartcard libraries on your system in order to build the smartcard bindings. On Ubuntu:

sudo apt-get install build-essential swig libpcsclite-dev python-pip python-devel

Then you can install emv from pip:

sudo pip install emv

To check if everything's working, plug in a smartcard reader, put a bank card in, and run:

emvtool info

If all goes well, you should see some data about your card.

Warning

Although this tool has been relatively well tested, it's technically possible to block or even damage your card, as well as get in trouble with your card issuer, using this tool. Please make sure you understand the risks.

Commands marked in the --help output with [!] will initiate a transaction on the card, resulting in a permanent change to the card's internal state which could potentially be detected by your card issuer, particularly if you initiate many transactions.

Command Line

This library ships with emvtool - a simple command-line tool for testing and CAP password generation. To fetch some card metadata, run:

emvtool info

If you have more than one smartcard reader (or smartcard-like devices, such as a YubiKey) connected, you may have to select a specific reader. List all the readers with:

emvtool readers

Then use the -r option to select the specific reader ID, e.g.:

emvtool -r 1 info

To generate an EMV CAP one-time passcode:

emvtool -p <PIN> cap

You can also conduct CAP signing and challenge-response:

emvtool -p <PIN> cap -c <challenge>
emvtool -p <PIN> cap -c <accountno> -a <amount>

Legal Stuff

EMV is a trademark of EMVCo and is used purely for descriptive purposes. This library is not affiliated with EMVCo.

More Repositories

1

Herd

A single-command bittorrent distribution system, based on Twitter's Murder
Python
412
star
2

barclayscrape

A small app to programmatically mainpulate Barclays online banking
JavaScript
56
star
3

postgres_dba_views

A couple of views I find useful when investigating Postgres issues.
41
star
4

polybot

A framework for making social media bots for multiple networks
Python
41
star
5

arduino-gauges

Code for driving physical monitoring gauges using an Arduino
Ruby
29
star
6

dscovr-epic

Tools for fetching, processing, and tweeting images from NASA's DSCOVR spacecraft
Python
23
star
7

covidtracker

Python
19
star
8

rfm69-python

A library to control HopeRF RFM69-series radio modules through SPI and GPIO
Python
17
star
9

bulb-energy-prometheus

Bulb energy metrics exporter for Prometheus
Python
15
star
10

iv

Terminal Image Viewer for iTerm2
Python
12
star
11

rust-invelion

Driver for a number of Chinese UHF RFID Gen2 modules
Rust
12
star
12

ukparliament

A UK Parliament API client for Python
Python
12
star
13

epcexplorer

A tool to explore UHF RFID tags
Rust
10
star
14

esp32-ethernet

An ESP32 board with ethernet support.
KiCad Layout
10
star
15

datasette-geo

A Datasette plugin to make Spatialite databases effortlessly explorable
Python
10
star
16

graphview

A simple app to rotate full-screen graphs on a systems monitoring display
JavaScript
9
star
17

nhs-covid19-app-data

NHS COVID-19 Data
Python
8
star
18

pydsn

Parse the XML which powers http://eyes.nasa.gov/dsn/dsn.html
Python
7
star
19

rust-gs1

Library for dealing with GS1 identifiers
Rust
6
star
20

sentry-irccat

A plugin for Sentry which sends errors to irccat (or any other service which supports irccat's simple socket-based protocol)
Python
6
star
21

coviddata

Yet another python package for accessing COVID-19 data
Python
5
star
22

mjpegproxy

Intelligently proxy an MJPEG stream to a number of clients
Python
5
star
23

erlang-fernet

An implementation of the Fernet crypto format in Erlang.
Erlang
3
star
24

callsign-scrape

JavaScript
3
star
25

git-amqp-tools

Python
3
star
26

raspberry-pi-rfm69

Interface between HopeRF RFM69 radio modules and a Raspberry Pi
KiCad Layout
3
star
27

local_authority_nhs_region

English Local Authority District to NHS Region Mapping
2
star
28

osm-uk-addresses

Python
2
star
29

dsemon

Graphs for generators.
Python
2
star
30

gridstats

Python
2
star
31

pydms

A minimal scanning system
Python
2
star
32

glastonbury-festival-maps

2
star
33

ukhasnet-node-python

A ukhas.net node in python
Python
2
star
34

murmur3-cassandra

A C++ implementation of the Apache Cassandra variant of the MurmurHash3 algorithm
C++
2
star
35

london-elections-2016

Python
1
star
36

ea_scrape

Tools for scraping the Environment Agency web site.
Python
1
star
37

datavis

Various data visualisations I've made
Jupyter Notebook
1
star
38

solartagger

Python
1
star
39

legislationparser

Parse UK legislation XML
Python
1
star
40

insight_imgs

Mastodon bot which posts images from NASA's InSight spacecraft
Python
1
star
41

spritezero-webpack-plugin

JavaScript
1
star
42

power-outage-history

Python
1
star
43

lora-vehicle-tracker

C
1
star
44

xero-tools

Tools for integrating Xero with various other systems
Python
1
star
45

sarfetcher

Fetches Sentinel-1 synthetic aperture radar imagery for a particular area.
Python
1
star
46

maplibregl-layer-switcher

Layer switcher for Mapbox GL JS based on layer prefixes
TypeScript
1
star