PHP beginner |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brute Force</title>
<script language="javascript">
var arrCodes = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
var timeOut = 2000;
function startBruteForce()
{
var newCode = "";
var curCode = document.getElementById('curCode').innerHTML;
var codeLength = curCode.length;
for(var i = 0; i < codeLength; i++)
{
var tmpCode = curCode.substr(i, 1);
var tmpIndex = -1;
for(var x = 0; x < arrCodes.length; x++)
{
if(tmpCode == arrCodes[x])
{
tmpIndex = x;
break;
}
}
newIndex = ++tmpIndex;
if(newIndex < arrCodes.length)
{
newCode += arrCodes[newIndex];
}
else
{
newCode += arrCodes[0];
}
}
document.getElementById('curCode').innerHTML = newCode;
setTimeout("startBruteForce()", timeOut);
}
</script>
</head>
<body>
<span id="curCode">1c8a2</span>
</body>
</html>
<script language="javascript">
setTimeout("startBruteForce()", timeOut);
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Brute Force</title> <script language="javascript"> var arrCodes = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'); var timeOut = 2000; function startBruteForce() { var newCode = ""; var curCode = document.getElementById('curCode').innerHTML; var codeLength = curCode.length; for(var i = 0; i < codeLength; i++) { var tmpCode = curCode .substr(i , 1); var tmpIndex = -1; for(var x = 0; x < arrCodes.length; x++) { if(tmpCode == arrCodes[x]) { tmpIndex = x; break; } } newIndex = ++tmpIndex; if(newIndex < arrCodes.length) { newCode += arrCodes[newIndex]; } else { newCode += arrCodes[0]; } } document.getElementById('curCode').innerHTML = newCode; setTimeout("startBruteForce()", timeOut); } </script> </head> <body> <span id="curCode">1c8a2</span> </body> </html> <script language="javascript"> setTimeout("startBruteForce()", timeOut); </script>
Ik heb geen commentaar bij de code toegevoegd omdat je nu zelf kunt uitzoeken hoe het werkt |