From edf2b5ff5e95fac66e70ba41773ecb3868e86bbf Mon Sep 17 00:00:00 2001 From: Saksham Shekher <95137948+OshekharO@users.noreply.github.com> Date: Sat, 13 Jul 2024 13:36:47 +0530 Subject: [PATCH] Update script.js --- script.js | 59 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/script.js b/script.js index b9b1cdb..569528c 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,28 +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 line = numberArray[i].trim(); + const cardNumber = line.split("|")[0].trim(); // Extract card number - 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)) { + if (!isValidCreditCard(cardNumber)) { + muradList.push(`Invalid (Luhn Check) | ${line} /OshekherO`); continue; } 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); + const randomZero1 = Math.floor(Math.random() * 0); // This will always be 0 + const randomZero2 = Math.floor(Math.random() * 0); // This will also always be 0 + // Output includes the full line (including expiration and CVV) if (randomNumber < 0.2) { - aliList.push("Live | " + number + " -> [Charge $" + randomFour + "," + randomTen + "] [GATE:01]. /OshekherO"); + aliList.push("Live | " + line + " -> [Charge $" + randomFour + "," + randomTen + "] [GATE:01]. /OshekherO"); } else if (randomNumber < 0.9) { - muhammadList.push("Dead | " + number + " -> [Charge $" + randomZero1 + "," + randomZero2 + "] [GATE:01]. /OshekherO"); + muhammadList.push("Dead | " + line + " -> [Charge $" + randomZero1 + "," + randomZero2 + "] [GATE:01]. /OshekherO"); } else { - muradList.push("Unknown | " + number + " -> [Charge N/A] [GATE:01]. /OshekherO"); + muradList.push("Unknown | " + line + " -> [Charge N/A] [GATE:01]. /OshekherO"); } } @@ -67,15 +92,21 @@ checkBtn.addEventListener("click", function () { if (i < muhammadList.length) { muhammadCount++; muhammadNumbersDiv.innerHTML += muhammadList[i] + "
"; - document.getElementById("muhammad-count").innerHTML = "Checked: " + muhammadCount; + document.getElementById("muhammad-count").innerHTML = + "Checked: " + muhammadCount; } if (i < muradList.length) { muradCount++; muradNumbersDiv.innerHTML += muradList[i] + "
"; - document.getElementById("murad-count").innerHTML = "Checked: " + muradCount; + document.getElementById("murad-count").innerHTML = + "Checked: " + muradCount; } i++; - if (i >= aliList.length && i >= muhammadList.length && i >= muradList.length) { + if ( + i >= aliList.length && + i >= muhammadList.length && + i >= muradList.length + ) { clearInterval(updateNumbers); Swal.fire({ title: "Checking completed!",