<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Cracker</title>
<!-- <link rel="stylesheet" href="style.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Montserrat&family=Source+Code+Pro&display=swap');
</style>
-->
</head>
<body>
<div class="mainContainer">
<div class="header">
<h1 class="title">Password cracker!</h1>
</div>
<div class="formContainer">
<form id="form" onsubmit="passOutput(), iCountOutput(), timeOutput(); return false;">
<label for="pass">Enter a password:</label><br>
<input type="text" id="pass" name="pass"><br>
</form>
</div>
<div id="resultContainer">
<div class="outputs" id="passOutput">Log:</div>
<div class="outputs" id="icount">Iterations:</div>
<div class="outputs" id="time">Time:</div>
</div>
</div>
<div>Current Time:</div>
<div id="startTime"></div>
<div>End Time:</div>
<div id="endTime"></div>
<script>
var d1 = new Date();
document.getElementById("startTime").innerHTML = d1.getTime();
let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
alphabet.unshift('')
function passGen(wordToFind) {
let c1 = 0;
let c2 = 0;
let c3 = 0;
let c4 = 0;
let c5 = 0;
let c6 = 0;
let c7 = 0;
let c8 = 0;
let c9 = 0;
let c10 = 0;
let c11 = 0;
let c12 = 0;
let globalCount = 0;
let t = new Date();
if (wordToFind === '' || wordToFind === undefined || wordToFind === NaN) {return 'Password please'}
for (c1 = 0; c1 < alphabet.length; c1++, globalCount++) {
for (c2 = 0; c2 < alphabet.length; c2++, globalCount++) {
for (c3 = 0; c3 < alphabet.length; c3++, globalCount++) {
for (c4 = 0; c4 < alphabet.length; c4++, globalCount++) {
for (c5 = 0; c5 < alphabet.length; c5++, globalCount++) {
for (c6 = 0; c6 < alphabet.length; c6++, globalCount++) {
for (c7 = 0; c7 < alphabet.length; c7++, globalCount++) {
for (c8 = 0; c8 < alphabet.length; c8++, globalCount++) {
for (c9 = 0; c9 < alphabet.length; c9++, globalCount++) {
for (c10 = 0; c10 < alphabet.length; c10++, globalCount++) {
for (c11 = 0; c11 < alphabet.length; c11++, globalCount++) {
for (c12 = 0; c12 < alphabet.length; c12++, globalCount++) {
if ((alphabet[c1] + alphabet[c2] + alphabet[c3] + alphabet[c4] + alphabet[c5] + alphabet[c6] + alphabet[c7] + alphabet[c8] + alphabet[c9] + alphabet[c10] + alphabet[c11] + alphabet[c12]) == wordToFind) {
return [(alphabet[c1] + alphabet[c2] + alphabet[c3] + alphabet[c4] + alphabet[c5] + alphabet[c6] + alphabet[c7] + alphabet[c8] + alphabet[c9] + alphabet[c10] + alphabet[c11] + alphabet[c12]),
(globalCount), (new Date() - t)];
}
}
}
}
}
}
}
}
}
}
}
}
}
}
function passOutput() {
const createDiv = document.createElement('div');
const outputContainer = document.querySelector('#passOutput');
const inputPass = document.getElementById("pass").value;
createDiv.textContent = passGen(inputPass)[0];
return outputContainer.appendChild(createDiv);
}
function iCountOutput() {
const createDiv = document.createElement('div');
const iCountContainer = document.querySelector('#icount');
const inputPass = document.getElementById("pass").value;
createDiv.textContent = new Intl.NumberFormat().format(passGen(inputPass)[1]);
return iCountContainer.appendChild(createDiv);
}
function timeOutput() {
const createDiv = document.createElement('div');
const timeContainer = document.querySelector('#time');
const inputPass = document.getElementById("pass").value;
createDiv.textContent = new Intl.NumberFormat().format(passGen(inputPass)[2]);
return timeContainer.appendChild(createDiv);
}
var d2 = new Date();
document.getElementById("endTime").innerHTML = d2.getTime();
</script>
</body>
</html>