diff --git a/script.js b/script.js index b9b1cdb..8e58110 100644 --- a/script.js +++ b/script.js @@ -6,6 +6,32 @@ const stopCheckBtn = document.getElementById("stop-check-btn"); let updateNumbers; +// Function to perform Luhn check (standard and Amex) +function isValidCreditCard(number) { + // Remove non-digit characters + number = number.replace(/\D/g, ''); + + // Check if it's potentially a valid credit card number + if (!/^(?:3[47][0-9]{13}|4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/.test(number)) { + return false; + } + + let sum = 0; + let alternate = false; + for (let i = number.length - 1; i >= 0; i--) { + let n = parseInt(number.substring(i, i + 1)); + if (alternate) { + n *= 2; + if (n > 9) { + n = (n % 10) + 1; + } + } + sum += n; + alternate = !alternate; + } + return (sum % 10) === 0; +} + checkBtn.addEventListener("click", function () { const numbers = document.getElementById("numbers").value; const numberArray = numbers.split("\n").filter((number) => { @@ -26,30 +52,27 @@ checkBtn.addEventListener("click", function () { let muradList = []; for (let i = 0; i < numberArray.length; i++) { - const number = numberArray[i].trim(); - const firstDigit = number.charAt(0); - const secondDigit = number.charAt(1); - const thirdDigit = number.charAt(2); - - const validPattern = /^\d{16}\|\s*\d{2}\|\s*\d{4}\|\s*\d{3}$|^\d{15}\|\s*\d{2}\|\s*\d{4}\|\s*\d{4}$|^\d{14}\|\s*\d{2}\|\s*\d{4}\|\s*\d{4}$/; - if (!validPattern.test(number)) { - continue; + const line = numberArray[i].trim(); + const cardNumber = line.split("|")[0].trim(); + + // CORRECTED LOGIC: + // 1. Perform Luhn check FIRST + if (!isValidCreditCard(cardNumber)) { + muradList.push(`Invalid (Luhn Check) | ${line} /OshekherO`); + // If invalid, continue to the next card + continue; } + // 2. If valid, THEN categorize based on the random number const randomNumber = Math.random(); - const randomFour = Math.floor(Math.random() * 4); - const randomTen = Math.floor(Math.random() * 10); - const randomZero1 = Math.floor(Math.random() * 0); - const randomZero2 = Math.floor(Math.random() * 0); - if (randomNumber < 0.2) { - aliList.push("Live | " + number + " -> [Charge $" + randomFour + "," + randomTen + "] [GATE:01]. /OshekherO"); + aliList.push(`Live | ${line} -> [Charge $4,99] [GATE:01]. /OshekherO`); } else if (randomNumber < 0.9) { - muhammadList.push("Dead | " + number + " -> [Charge $" + randomZero1 + "," + randomZero2 + "] [GATE:01]. /OshekherO"); + muhammadList.push(`Dead | ${line} -> [Charge $0,00] [GATE:01]. /OshekherO`); } else { - muradList.push("Unknown | " + number + " -> [Charge N/A] [GATE:01]. /OshekherO"); + muradList.push(`Unknown | ${line} -> [Charge N/A] [GATE:01]. /OshekherO`); } - } + } let aliCount = 0; let muhammadCount = 0; @@ -87,7 +110,7 @@ checkBtn.addEventListener("click", function () { stopCheckBtn.disabled = true; document.getElementById("numbers").value = ""; } - }, Math.floor(Math.random() * (maxDelay - minDelay + 1) + minDelay)); + }, Math.floor(Math.random() * (maxDelay - minDelay + 1) + minDelay)); }); // copy buttons