daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest May 23rd, 2012 21,047 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //  Put the following files in the same folder:
  2. //      Crypto.cpp, Crypto.h, Decoder-ECM.cpp, Decoder.h, Global.h
  3. //      Keys.cpp, Keys.h, Keyset.cpp, Keyset.h
  4. //  You should modify "Size" in Decoder-ECM.cpp l42 to "Size-3"
  5.  
  6. #include <string.h>
  7. #include <PCSC/winscard.h>
  8. #define htons htons_
  9. #define ntohs ntohs_
  10.  
  11. #include "Global.h"
  12. #include "Keys.h"
  13. #include "Decoder.h"
  14.  
  15. #define CHAR    char
  16.  
  17. extern"C"{
  18.  
  19. void __attribute__ ((constructor)) SCardVCasInit(void) {
  20.     BCAS::Keys::RegisterAll();
  21. }
  22.  
  23. LONG SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
  24. {
  25.         *phContext=(SCARDCONTEXT)0x35313239;
  26.         return SCARD_S_SUCCESS;
  27. }
  28.  
  29. LONG SCardListReaders(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
  30. {
  31.     CHAR r[]="@OishiiSlurper\0";
  32.     if(mszReaders)memcpy(mszReaders,r,sizeof r);
  33.     *pcchReaders=sizeof r/sizeof r[0];
  34.     return SCARD_S_SUCCESS;
  35. }
  36.  
  37.  
  38. LONG SCardConnect(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
  39. {
  40.     *phCard=(SCARDHANDLE)0x35313239;
  41.     *pdwActiveProtocol=SCARD_PROTOCOL_T1;
  42.     return SCARD_S_SUCCESS;
  43. }
  44.  
  45.  
  46. LONG SCardTransmit(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
  47. {
  48.     switch(pbSendBuffer[1])
  49.     {
  50.     case 0x30:{
  51.         BYTE r[]={
  52.             0x00,0x39,0x00,0x00,0x21,0x00,0x00,0x05, 0xc0,0xff,0xee,0xc0,0xff,0xee,0x01,0x50,
  53.             0x36,0x31,0x04,0x66,0x4b,0x17,0xea,0x5c, 0x32,0xdf,0x9c,0xf5,0xc4,0xc3,0x6c,0x1b,
  54.             0xec,0x99,0x39,0x21,0x68,0x9d,0x4b,0xb7, 0xb7,0x4e,0x40,0x84,0x0d,0x2e,0x7d,0x98,
  55.             0xfe,0x27,0x19,0x99,0x19,0x69,0x09,0x11, 0x01,0x02,0x01,0x90,0x00};
  56.         memcpy(pbRecvBuffer,r,sizeof r);
  57.         *pcbRecvLength=sizeof r;
  58.         break;}
  59.     case 0x32:{
  60.         BYTE r[]={
  61.             0x00,0x0f,0x00,0x00,0x21,0x00,0x01,0x54, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  62.             0x00,0x90,0x00};
  63.         memcpy(pbRecvBuffer,r,sizeof r);
  64.         *pcbRecvLength=sizeof r;
  65.         break;}
  66.     case 0x34:{
  67.         BYTE r[]={
  68.             0x00,0x15,0x00,0x00,0x08,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  69.             0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x90, 0x00};
  70.         BCAS::Decoder::DecodeECM(pbSendBuffer+5,pbSendBuffer[4],r+6,NULL);
  71.         memcpy(pbRecvBuffer,r,sizeof r);
  72.         *pcbRecvLength=sizeof r;
  73.         break;}
  74.     case 0x80:{
  75.         BYTE r[]={
  76.                 0x00,0x10,0x00,0x00,0xA1,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00};
  77.         memcpy(pbRecvBuffer,r,sizeof r);
  78.         *pcbRecvLength=sizeof r;
  79.         break;}
  80.     default:{
  81.         BYTE r[]={
  82.             0x00,0x04,0x00,0x00,0xa1,0xfe,0x90,0x00};
  83.         memcpy(pbRecvBuffer,r,sizeof r);
  84.         *pcbRecvLength=sizeof r;
  85.         break;}
  86.     }
  87.     return SCARD_S_SUCCESS;
  88. }
  89.  
  90. LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition){return SCARD_S_SUCCESS;}
  91.  
  92. LONG SCardFreeMemory(SCARDCONTEXT,LPCVOID){return SCARD_S_SUCCESS;}
  93.  
  94. LONG SCardReleaseContext(SCARDCONTEXT){return SCARD_S_SUCCESS;}
  95.  
  96. LONG SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout,LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders){return SCARD_S_SUCCESS; }
  97.  
  98. SCARD_IO_REQUEST g_rgSCardT1Pci_;
  99. SCARD_IO_REQUEST g_rgSCardT1Pci;
  100.  
  101. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top