# Relay Module — vsmartcard 2021-04-28 documentation

# Relay Module

class `virtualsmartcard.cards.Relay.``RelayOS`(readernum, mitm=<virtualsmartcard.cards.RelayMiddleman.RelayMiddleman object>)

  Bases: `virtualsmartcard.VirtualSmartcard.SmartcardOS`

  This class implements relaying of a (physical) smartcard. The RelayOS forwards the command APDUs received from the vpcd to the real smartcard via an actual smart card reader and sends the responses back to the vpcd. This class can be used to implement relay or MitM attacks.

  `cleanup`()

    Close the connection to the physical card

  `execute`(msg)

    Returns response to the given APDU as string of characters

    Parameters

      msg – the APDU as string of characters

  `getATR`()

    Returns the ATR of the card as string of characters

  `powerDown`()

    Powers down the card

  `powerUp`()

    Powers up the card

  `reset`()

    Performs a warm reset of the card (no power down)