17 jun. 2012

CreditCard Checker

Aqui les dejo esta tool codeada por mi en C++ para verificar si una tarjeta de credito es valida o no, hasta ahorita solo reconoce tarjetas de 15 y 16 digitos de las mas usadas que son Visa, Mastercard, American Express y Discover

#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <mmsystem.h>

using namespace std;

class check
{
    private:
            char card[16];
            int par1, par2, par3, par4, par5, par6, par7, par8;
            int impar1, impar2, impar3, impar4, impar5, impar6, impar7, impar8;
            int multimpar1, multimpar2, multimpar3, multimpar4, multimpar5, multimpar6, multimpar7, multimpar8;
            int uni, dec;
            int resultado;

    public:
            void validacion();
            void tipo();
            void american_express();
            void visa();
            void mastercard();
            void discover();
};

void check::validacion()
{
    int lon;
    do
    {
        system("cls");
        cout<<"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="<<endl;
        cout<<" ____ ___ ____ ____ _  _ ___  ____ ____ _  _"<<endl;
        cout<<" ====  |  [__] |--< |\\/| |__> |--| |--< |-:_"<<endl;
        cout<<"     CreditCard Checker by Stormd4rk"<<endl;
        cout<<"============================================="<<endl;
        cout<<"Digita el numero de la tarjeta"<<endl;
        cin>>card;
        lon=strlen(card);
        if(lon != 16 && lon != 15)
        {
            cout<<"Numero invalido"<<endl;
            getch();
        }
    }while(lon != 16 && lon != 15);
    par1=card[1]-'0';
    par2=card[3]-'0';
    par3=card[5]-'0';
    par4=card[7]-'0';
    par5=card[9]-'0';
    par6=card[11]-'0';
    par7=card[13]-'0';
    par8=card[15]-'0';

    impar1=card[0]-'0';
    impar2=card[2]-'0';
    impar3=card[4]-'0';
    impar4=card[6]-'0';
    impar5=card[8]-'0';
    impar6=card[10]-'0';
    impar7=card[12]-'0';
    impar8=card[14]-'0';

    multimpar1=impar1*2;
    multimpar2=impar2*2;
    multimpar3=impar3*2;
    multimpar4=impar4*2;
    multimpar5=impar5*2;
    multimpar6=impar6*2;
    multimpar7=impar7*2;
    multimpar8=impar8*2;

    do
    {
        if(multimpar1 > 9)
        {
            uni = multimpar1 - multimpar1 / 10 * 10;
            dec = (multimpar1 - multimpar1 / 100 * 100) / 10;
            multimpar1=uni+dec;
        }
    }while(multimpar1 > 9);

    do
    {
        if(multimpar2 > 9)
        {
            uni = multimpar2 - multimpar2 / 10 * 10;
            dec = (multimpar2 - multimpar2 / 100 * 100) / 10;
            multimpar2=uni+dec;
        }
    }while(multimpar2 > 9);

    do
    {
        if(multimpar3 > 9)
        {
            uni = multimpar3 - multimpar3 / 10 * 10;
            dec = (multimpar3 - multimpar3 / 100 * 100) / 10;
            multimpar3=uni+dec;
        }
    }while(multimpar3 > 9);

    do
    {
        if(multimpar4 > 9)
        {
            uni = multimpar4 - multimpar4 / 10 * 10;
            dec = (multimpar4 - multimpar4 / 100 * 100) / 10;
            multimpar4=uni+dec;
        }
    }while(multimpar4 > 9);

    do
    {
        if(multimpar5 > 9)
        {
            uni = multimpar5 - multimpar5 / 10 * 10;
            dec = (multimpar5 - multimpar5 / 100 * 100) / 10;
            multimpar5=uni+dec;
        }
    }while(multimpar5 > 9);

    do
    {
        if(multimpar6 > 9)
        {
            uni = multimpar6 - multimpar6 / 10 * 10;
            dec = (multimpar6 - multimpar6 / 100 * 100) / 10;
            multimpar6=uni+dec;
        }
    }while(multimpar6 > 9);

    do
    {
        if(multimpar7 > 9)
        {
            uni = multimpar7 - multimpar7 / 10 * 10;
            dec = (multimpar7 - multimpar7 / 100 * 100) / 10;
            multimpar7=uni+dec;
        }
    }while(multimpar7 > 9);

    do
    {
        if(multimpar8 > 9)
        {
            uni = multimpar8 - multimpar8 / 10 * 10;
            dec = (multimpar8 - multimpar8 / 100 * 100) / 10;
            multimpar8=uni+dec;
        }
    }while(multimpar8 > 9);

    resultado = par1+par2+par3+par4+par5+par6+par7+par8+multimpar1+multimpar2+multimpar3+multimpar4+multimpar5+multimpar6+multimpar7+multimpar8;

    if(resultado%10==0)
    {
        cout<<"=================="<<endl;
        cout<<"Tarjeta Valida! =]"<<endl;
        cout<<"=================="<<endl;
        check::tipo();
    }else
    {
        cout<<"==================="<<endl;
        cout<<"Tarjeta Invalida =("<<endl;
        cout<<"==================="<<endl;
    }
}

void check::tipo()
{
    if(card[0] == '3')
    {
        cout<<"[+]Tipo: American Express"<<endl;
        check::american_express();
    }else
    {
        if(card[0] == '4')
        {
           cout<<"[+]Tipo: Visa"<<endl;
           check::visa();
        }else
        {
            if(card[0] == '5')
            {
                cout<<"[+]Tipo: Mastercard"<<endl;
                check::mastercard();
            }else
            {
                if(card[0] == '6')
                {
                    cout<<"[+]Tipo: Discover"<<endl;
                    check::discover();
                }
            }
        }
    }
}

void check::american_express()
{
    int cid1;
    int cid2;
    int cid3;
    int cid4;
    int x;
    cid1 = card[5]-'0';
    cid2 = card[7]-'0';
    cid3 = card[11]-'0';
    if (card[2]-'0' == 9)
    {
        x = 1;
        cid4 = x;
        cout<<"[+]CID: "<<cid1<<cid2<<cid3<<cid4<<endl;
    }else
    {
        x = card[2]-'0' + 1;
        cid4 = x;
        cout<<"[+]CID: "<<cid1<<cid2<<cid3<<cid4<<endl;
    }
}

void check::visa()
{
    int cvv21;
    int cvv22;
    int cvv23;
    int x;
    cvv21 = card[7]-'0';
    cvv22 = card[11]-'0';
    if (card[2]-'0' == 9)
    {
        x = 1;
        cvv23 = x;
        cout<<"[+]CVV2: "<<cvv21<<cvv22<<cvv23<<endl;
    }else
    {
        x = card[2]-'0' + 1;
        cvv23 = x;
        cout<<"[+]CVV2: "<<cvv21<<cvv22<<cvv23<<endl;
    }
}

void check::mastercard()
{
    int cvc21;
    int cvc22;
    int cvc23;
    int x;
    cvc21 = card[7]-'0';
    cvc22 = card[11]-'0';
    if (card[2]-'0' == 9)
    {
        x = 1;
        cvc23 = x;
        cout<<"[+]CVC2: "<<cvc21<<cvc22<<cvc23<<endl;
    }else
    {
        x = card[2]-'0' + 1;
        cvc23 = x;
        cout<<"[+]CVC2: "<<cvc21<<cvc22<<cvc23<<endl;
    }
}

void check::discover()
{
    int cvv21;
    int cvv22;
    int cvv23;
    int x;
    cvv21 = card[7]-'0';
    cvv22 = card[11]-'0';
    if (card[2]-'0' == 9)
    {
        x = 1;
        cvv23 = x;
        cout<<"[+]CVV2: "<<cvv21<<cvv22<<cvv23<<endl;
    }else
    {
        x = card[2]-'0' + 1;
        cvv23 = x;
        cout<<"[+]CVV2: "<<cvv21<<cvv22<<cvv23<<endl;
    }
}

int main()
{
    SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), 11);
    system ("title CreditCard Checker by StØrMd[4]rk v1.0 [+] cyber-oxyde.blogspot.mx");
    char op;
    do
    {
        system("cls");
        check obj;
        obj.validacion();
        cout<<"Repetir? y/n"<<endl;
        cin>>op;
        op = tolower(op);
    }while(op == 'y');
    MessageBox(NULL,TEXT("I hate lammers.\nstormdark-nxt@live.jp"),TEXT("[Info]"),MB_OK | MB_ICONASTERISK );
}

Saludos..
..By StØrMd[4]rk