Brute-Forces-Simulation.php
Quell Code
<style>
body {
background-color:#000;
color:#999;
font-family:Verdana, Geneva, Tahoma, sans-serif;
font-size:20pt;
line-height:40px;
text-align:center;
vertical-align:middle;
}
table {
border-spacing:10px;
}
#code{
display:flex;
}
input{
background-color:#111;
border:2px solid #60C;
border-radius:5px;
margin:0;
padding:0;
box-shadow:0px 0px 16px -8px #999 inset;
height:45px;
font-size:24px;
width:45%;
color:white;
text-align:center;
}
td{
background-color:#111;
border:2px solid #60C;
border-radius:5px;
box-shadow:0px 0px 16px -8px #999 inset;
height:40px;
width:40px;
}
#container {
margin:5px auto 0px auto;
text-align:center;
width:280px;
}
#goal, #time, #count {
background-color:#111;
border:2px solid #60C;
border-radius:5px;
box-shadow:0px 0px 16px -8px #999 inset;
height:40px;
margin:0px 10px 10px 10px;
}
</style>
<div id="container">
<div id="code">
<input type="text" id="cod" placeholder="ZB 34543" value="12345">
<input type="button" id="los" value="hacken">
</div>
<table id="display"></table>
<div id="goal"></div>
<div id="time">00:00</div>
<div id="count">0</div>
</div>
<script>
var chars = "12345",
combos = new Array(),
start = new Date(),
password,
guess,
timer,
millis1,
max = 5,
index = 0;
function color() {
"use strict";
var cell, i, j;
for (i = 0; i < 5; i++) {
for (j = 0; j < 5; j++) {
cell = document.getElementById(i + chars[j]);
cell.style.boxShadow = "0px 0px 16px -8px #999 inset";
cell.style.borderColor = "#60C";
cell.style.color = "#999";
}
}
}
function generate() {
"use strict";
var table = document.getElementById("display"),
tr, td, row, col, i, j, k, l, m,
index = 0;
for (row = 0; row < max; row++) {
tr = document.createElement("tr");
table.appendChild(tr);
for (col = 0; col < max; col++) {
td = document.createElement("td");
td.id = row + chars[col];
td.innerHTML = chars[col];
tr.appendChild(td);
}
}
index = 0;
for (i = 0; i < max; i++) {
for (j = 0; (j < max); j++) {
for (k = 0; (k < max); k++) {
for (l = 0; (l < max); l++) {
for (m = 0; (m < max); m++) {
combos[index] = "";
combos[index] += chars[i] + chars[j] + chars[k] + chars[l] + chars[m];
index++;
}
}
}
}
}
}
function validate() {
"use strict";
if (guess == password) {
return true;
}
}
function animate() {
"use strict";
var time = document.getElementById("time"),
goal = document.getElementById("goal"),
count = document.getElementById("count"),
current = new Date(),
millis2 = current.getTime() - millis1,
seconds = millis2 / 1000,
remainingSeconds = Math.floor(seconds % 60),
minutes = seconds / 60,
remainingMinutes = Math.floor(minutes % 60),
clock = document.getElementById("time"),
combo = "",
id = "",
cell, j;
if (remainingMinutes < 10) {
remainingMinutes = "0" + remainingMinutes;
}
if (remainingSeconds < 10) {
remainingSeconds = "0" + remainingSeconds;
}
clock.innerHTML = remainingMinutes + ":" + remainingSeconds;
if (validate()) {
goal.style.borderColor = "#9F3";
goal.style.color = "#eee";
goal.style.boxShadow = "0px 0px 32px -16px #eee inset";
time.style.borderColor = "#9F3";
time.style.color = "#eee";
time.style.boxShadow = "0px 0px 32px -16px #eee inset";
count.style.borderColor = "#9F3";
count.style.color = "#eee";
count.style.boxShadow = "0px 0px 32px -16px #eee inset";
timer = window.clearInterval(timer);
} else {
color();
combo = combos[index];
for (j = 0; j < max; j++) {
id = j + combo[j];
cell = document.getElementById(id);
cell.style.borderColor = "#9F3";
cell.style.boxShadow = "0px 0px 32px -16px #eee inset";
cell.style.color = "#eee";
}
guess = combo;
index++;
count.innerHTML++;
}
}
function initiate() {
"use strict";
var i;
password = "";
//for (i = 0; i < max; i++) {
//password += chars[Math.floor(Math.random() * max)];
//}
password=document.getElementById('cod').value;
document.getElementById("goal").innerHTML = password;
millis1 = start.getTime();
timer = window.setInterval(animate, 100);
}
window.onload = function () {
document.getElementById('los').addEventListener('click',function(){
generate();
initiate();
})
};
</script>