Skip to content

Instantly share code, notes, and snippets.

@harpiechoise
Created September 10, 2017 20:35
Show Gist options
  • Save harpiechoise/d2e808c358acf463e6c1b06c39194cc8 to your computer and use it in GitHub Desktop.
Save harpiechoise/d2e808c358acf463e6c1b06c39194cc8 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [],
"source": [
"def luhn(tg):\n",
" def espar(num):\n",
" if num % 2 == 0:\n",
" return True\n",
" def isnum(num):\n",
" try:\n",
" int(num)\n",
" except:\n",
" return False\n",
" return True\n",
" \n",
" \n",
" pares = [int(tg[i]) for i in range(len(tg)) if not espar(i) and isnum(tg[i])]\n",
" impares = [int(tg[i]) for i in range(len(tg)) if espar(i) and isnum(tg[i])]\n",
" \n",
" pares.reverse()\n",
" \n",
" for i in range(len(pares)):\n",
" pares[i] = pares[i] * 2\n",
"\n",
" for i in range(len(pares)):\n",
" if len(str(pares[i])) > 1:\n",
" num1 = str(pares[i])\n",
" impares[i] = impares[i] + int(num1[0]) + int(num1[1])\n",
" else:\n",
" impares[i] = impares[i] + pares[i]\n",
" \n",
" res = 0\n",
" for i in impares:\n",
" res = res + i\n",
" \n",
" if res % 10 == 0:\n",
" return True\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 149,
"metadata": {},
"outputs": [],
"source": [
"def entidad(tg):\n",
" if tg[0] == \"3\":\n",
" return \"Amex\"\n",
" if tg[0] == \"4\":\n",
" return \"Visa\"\n",
" if tg[0] == \"5\":\n",
" return \"Master Card\"\n",
" if tg[0] == \"6\":\n",
" return \"Discover Card\"\n",
" else:\n",
" return \"Bin\""
]
},
{
"cell_type": "code",
"execution_count": 150,
"metadata": {},
"outputs": [],
"source": [
"from random import randint as r\n",
"def generador(bi):\n",
" \n",
" ntg = 16 - len(bi)\n",
" num = \"9\"\n",
" mini = \"1\"\n",
" for i in range(ntg-1):\n",
" num = num + \"9\"\n",
" mini = mini + \"1\"\n",
" tgg = r(int(mini),int(num))\n",
" tgco = bi + str(tgg)\n",
" return tgco"
]
},
{
"cell_type": "code",
"execution_count": 164,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def cvvcalc(tg):\n",
" if(entidad(tg) == \"Amex\"):\n",
" if(tg[2] == \"9\"):\n",
" ud = \"0\"\n",
" else:\n",
" tgn = int(tg[2]) + 1\n",
" ud = str(tgn)\n",
" cvv = tg[5] + tg[7] + tg[11] + ud\n",
" else:\n",
" if(tg[2] == 9):\n",
" ud = \"1\"\n",
" else:\n",
" tgn = int(tg[2]) + 1\n",
" ud = str(tgn)\n",
" cvv = tg[7] + tg[11] + ud\n",
" return cvv"
]
},
{
"cell_type": "code",
"execution_count": 169,
"metadata": {},
"outputs": [],
"source": [
"def fecha():\n",
" mes = r(1,12)\n",
" añoa = 17\n",
" año = r(añoa, añoa + 10)\n",
" return str(mes) + \"/\" + str(año) "
]
},
{
"cell_type": "code",
"execution_count": 173,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Escriba los primeros 6 digitos de una tarjeta 445678\n",
"¿ Cuantas quiere generar ? 100\n",
"4456785745125307 | 9/19 | 726 | Visa\n",
"4456781253474701 | 10/27 | 276 | Visa\n",
"4456788531890658 | 1/18 | 596 | Visa\n",
"4456788721735109 | 2/21 | 736 | Visa\n",
"4456782494287450 | 11/24 | 486 | Visa\n",
"4456783340587257 | 9/22 | 386 | Visa\n",
"4456785408600967 | 9/27 | 406 | Visa\n",
"4456783778479324 | 4/23 | 776 | Visa\n",
"4456784150526887 | 6/22 | 126 | Visa\n",
"4456789766702525 | 3/26 | 706 | Visa\n",
"4456783900674194 | 10/26 | 976 | Visa\n",
"4456787808658019 | 12/18 | 856 | Visa\n",
"4456786053652811 | 4/23 | 056 | Visa\n",
"4456786665461954 | 8/22 | 666 | Visa\n",
"4456786222151471 | 1/26 | 256 | Visa\n",
"4456786138778075 | 5/20 | 176 | Visa\n",
"4456783969056020 | 9/22 | 956 | Visa\n",
"4456786342197962 | 6/27 | 396 | Visa\n",
"4456784387208940 | 7/25 | 306 | Visa\n",
"4456788336413428 | 7/22 | 316 | Visa\n",
"4456786931092366 | 7/24 | 996 | Visa\n",
"4456784053277094 | 11/19 | 076 | Visa\n",
"4456788937226518 | 1/27 | 926 | Visa\n",
"4456787623466314 | 6/20 | 666 | Visa\n",
"4456788012977826 | 8/26 | 076 | Visa\n",
"4456785427284657 | 12/17 | 486 | Visa\n",
"4456782605099181 | 9/21 | 696 | Visa\n",
"4456782077805165 | 6/17 | 006 | Visa\n",
"4456781541778749 | 6/26 | 576 | Visa\n",
"4456785806803199 | 8/18 | 806 | Visa\n",
"4456787035121349 | 7/21 | 026 | Visa\n",
"4456784898617337 | 2/17 | 816 | Visa\n",
"4456789447800360 | 6/27 | 406 | Visa\n",
"4456787256202638 | 10/27 | 206 | Visa\n",
"4456786557706687 | 10/25 | 506 | Visa\n",
"4456783041186884 | 10/21 | 086 | Visa\n",
"4456782361659629 | 3/17 | 356 | Visa\n",
"4456786361802526 | 2/17 | 306 | Visa\n",
"4456785223422434 | 12/18 | 226 | Visa\n",
"4456781787951003 | 1/24 | 756 | Visa\n",
"4456783121446976 | 8/24 | 146 | Visa\n",
"4456789979662326 | 4/21 | 966 | Visa\n",
"4456781862529887 | 8/25 | 826 | Visa\n",
"4456781248009166 | 8/26 | 206 | Visa\n",
"4456789078274770 | 7/26 | 076 | Visa\n",
"4456787072540012 | 8/26 | 046 | Visa\n",
"4456786286155631 | 12/27 | 256 | Visa\n",
"4456787237180207 | 11/17 | 286 | Visa\n",
"4456783749776334 | 1/21 | 776 | Visa\n",
"4456787608846980 | 2/21 | 646 | Visa\n",
"4456786207503469 | 6/24 | 206 | Visa\n",
"4456784631600037 | 8/20 | 606 | Visa\n",
"4456784658417808 | 1/18 | 616 | Visa\n",
"4456786166171195 | 6/19 | 176 | Visa\n",
"4456781972295735 | 10/27 | 996 | Visa\n",
"4456785433080824 | 12/27 | 486 | Visa\n",
"4456781744349155 | 12/20 | 746 | Visa\n",
"4456785263051247 | 5/26 | 256 | Visa\n",
"4456787266864637 | 12/23 | 266 | Visa\n",
"4456782600552742 | 2/20 | 656 | Visa\n",
"4456781418562146 | 12/25 | 466 | Visa\n",
"4456785868716885 | 2/19 | 816 | Visa\n",
"4456788430756025 | 1/17 | 456 | Visa\n",
"4456787000241080 | 2/18 | 046 | Visa\n",
"4456784967299614 | 2/23 | 996 | Visa\n",
"4456783429050346 | 7/18 | 456 | Visa\n",
"4456784033628229 | 3/26 | 026 | Visa\n",
"4456781158018265 | 10/20 | 116 | Visa\n",
"4456783493617390 | 11/21 | 416 | Visa\n",
"4456785330184420 | 9/21 | 386 | Visa\n",
"4456786378863814 | 12/19 | 366 | Visa\n",
"4456784888827128 | 9/25 | 826 | Visa\n",
"4456789772964875 | 11/20 | 766 | Visa\n",
"4456783523674938 | 7/27 | 576 | Visa\n",
"4456782961628924 | 8/24 | 926 | Visa\n",
"4456784135187227 | 10/21 | 186 | Visa\n",
"4456787557761112 | 8/21 | 566 | Visa\n",
"4456784682121562 | 8/23 | 626 | Visa\n",
"4456785099951100 | 6/18 | 056 | Visa\n",
"4456786641127684 | 2/25 | 626 | Visa\n",
"4456789428619351 | 6/27 | 416 | Visa\n",
"4456789300204724 | 9/24 | 306 | Visa\n",
"4456784376615370 | 7/17 | 316 | Visa\n",
"4456789410955092 | 3/26 | 456 | Visa\n",
"4456786692266799 | 7/23 | 666 | Visa\n",
"4456789902748029 | 11/26 | 946 | Visa\n",
"4456783797346107 | 12/19 | 746 | Visa\n",
"4456789405305868 | 6/21 | 406 | Visa\n",
"4456782603109267 | 2/23 | 606 | Visa\n",
"4456786506637819 | 5/20 | 536 | Visa\n",
"4456785267087987 | 5/26 | 286 | Visa\n",
"4456787649886572 | 11/24 | 686 | Visa\n",
"4456788472002796 | 9/19 | 406 | Visa\n",
"4456784907292012 | 1/17 | 996 | Visa\n",
"4456785813583063 | 12/25 | 886 | Visa\n",
"4456781760612276 | 1/19 | 716 | Visa\n",
"4456788925984748 | 5/20 | 986 | Visa\n",
"4456781147453362 | 7/26 | 156 | Visa\n",
"4456785036941169 | 8/24 | 046 | Visa\n",
"4456784921556414 | 11/20 | 956 | Visa\n"
]
}
],
"source": [
"#programa\n",
"binn = input(\"Escriba los primeros 6 digitos de una tarjeta \")\n",
"numero = int(input(\"¿ Cuantas quiere generar ? \"))\n",
"i = 0\n",
"while i < numero:\n",
" numgen = generador(binn)\n",
" ent = entidad(numgen)\n",
" cvv2 = cvvcalc(numgen)\n",
" f = fecha()\n",
" if luhn(numgen):\n",
" print(numgen + \" | \" + f + \" | \" + cvv2 + \" | \" + ent)\n",
" i = i + 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment