1

hello i am making a script but keep having an error pop up:

File "creditcardsniff.py", line 70, in findCreditCard
    print(f"{GREEN}{BRIGHT}[+] Found American Express Card: " + str(americaRE[0]) +""+ str(CCVRE[0]) +""+ str(MMYY[0]))
IndexError: list index out of range

ive had 2 people try and help me solve it by rewriting the regex thats the only solution we could think of. we seen that scapy just finds the mmyy empty but detects everything else (card and ccv) here is the Regular expression formats that im using if that helps:

 MMYY = re.findall("(0[1-9]|10|11|12)\/[0-9]{2}", raw)

if you need more info let me know im also using python 3.8

  • 1
    This is more of a debugging type of problem. The error is clear enough that you are accessing the list with index > length of list. Start by printing `americaRE`, `CCVRE` and `MMYY`. – mad_ May 24 '20 at 19:02
  • Not sure what the issue is, but here are possible solutions related to this kind of regex: 1) `re.findall(r"(?:0[1-9]|1[0-2])/[0-9]{2}", raw)`, 2) ``re.findall(r"\b(?:0[1-9]|1[0-2])/[0-9]{2}\b", raw)``, 3) ``re.findall(r"(?<!\d)(?:0[1-9]|1[0-2])/\d{2}(?!\d)", raw)``, 4) ``re.findall(r"(?<!\d)(?<!\d\.)(?:0[1-9]|1[0-2])/\d{2}(?!\.?\d)", raw)`` – Wiktor Stribiżew May 24 '20 at 19:37

1 Answers1

0

Found out that mmyy and ccv did not like the [0] so removing that solved my issue