Skip to content

Instantly share code, notes, and snippets.

@CombustibleToast
Last active March 28, 2019 13:37
Show Gist options
  • Save CombustibleToast/6174a146d208b08ecfc47a473d67e55b to your computer and use it in GitHub Desktop.
Save CombustibleToast/6174a146d208b08ecfc47a473d67e55b to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<body style="background-color:black">
<font id='font' color='limegreen' face='Courier' size='7'>
<div id='title'>HACKING IN PROGRESS...</div>
<div id='user'></div>
<div id='pass'></div>
<div id='time'></div>
</font>
</body>
<script id='script'>
//Hello, World!
main();
async function main(){
var a = new Array();
var b = toArray(generatePassword(Math.floor((Math.random()*10)+10)));//lc, num, uc, sym
var c = new Array();
var d = toArray("1517073\\fcpsedu");
var passI = 0, userI = 0;
var start = Date.now();
while((passI != -1 || userI != -1)){
passI = brute(a,b,passI,"Password","pass");
userI = brute(c,d,userI,"Username","user");
await sleep(1);
console.log(passI + " __ " + userI);
}
var time = parseFloat(Date.now() - start) / 1000;
printa("Done.", "time");
printa(time + " seconds elapsed.", "time");
}
function brute(arg, target, i, name, div){
if(i == -1 || toString(arg) == toString(target))
return -1;
if(arg[i] != target[i]){
arg[i] = String.fromCharCode(Math.floor(Math.random() * 200 ));
clearPage(div);
printa(name+ ": " + toString(arg), div);
return i;
}
else
return i+1;
}
function printa(a, divId){
var div = document.getElementById(divId);
var p = document.createElement("p");
p.appendChild(document.createTextNode(a));
p.setAttribute("id","output");
div.appendChild(p);
}
function clearPage(id){
var parent = document.getElementById(id);
while(parent.firstChild)
parent.removeChild(parent.firstChild);
}
function toString(a){
var re = new String();
for(var i = 0; i < a.length; i++)
re += a[i];
return re;
}
function toArray(arg){
var re = new Array();
for(var i = 0; i < arg.length; i++)
re.push(arg.substring(i,i+1));
return re;
}
function fill(){
var chars = [];
for(var i = 0; i < 10; i++)
chars.push(i);
for(var i = 65; i <= 90; i++)
chars.push(String.fromCharCode(i));
for(var i = 97; i <= 122; i++)
chars.push(String.fromCharCode(i));
chars = chars.concat(['<','>','!','\\','\"','#','$','%','&','/','(',')','*','+','-','.',':',';','=','@','[',']','^','_','`','|','~','?']);
return chars;
}
function generatePassword(length){
var chars = fill();
var pass = "";
for(var i = 0; i < length; i++)
pass += chars[Math.floor(Math.random()*(chars.length))];
return pass;
}
/*
function fill(nu,uc,lc,sy){
var chars = [];
if(nu)
for(var i = 0; i < 10; i++)
chars.push(i);
if(uc)
for(var i = 65; i <= 90; i++)
chars.push(String.fromCharCode(i));
if(lc)
for(var i = 97; i <= 122; i++)
chars.push(String.fromCharCode(i));
if(sy)
chars = chars.concat(['<','>','!','\\','\"','#','$','%','&','/','(',')','*','+','-','.',':',';','=','@','[',']','^','_','`','|','~','?']);
return chars;
}
function generatePassword(length,nu,uc,lc,sy){
var chars = fill(uc,lc,nu,sy);
var pass = "";
for(var i = 0; i < length; i++)
pass += chars[Math.floor(Math.random()*(chars.length))];
return pass;
}
*/
function sleep(ms){
return new Promise(resolve => setTimeout(resolve, ms));
}
</script>
<!DOCTYPE HTML>
<body style="background-color:powderblue">
<font id='font' color='white' size='7'>
Bruteforcing "Hello, World!"
<div id='div1'></div>
</font>
</body>
<div id='div2'></div>
<script id='script'>
//Hello, World!
main();
function test(){
var b = ['H','e','l','l','o',',',' ','W','o','r','l','d','!'];
document.write(toString(b));
}
async function main(){
var a = new Array();
var b = ['H','e','l','l','o',',',' ','W','o','r','l','d','!'];
var start = Date.now();
for(var i = 0; i < 13; i++){
while(a[i] != b[i]){
a[i] = String.fromCharCode(Math.floor(Math.random() * 200));
clearPage();
printa(toString(a), "output", randomColor());
await sleep(20);
}
}
var time = parseFloat(Date.now() - start) / 1000;
printa("Done!", "done");
printa(time + " seconds elapsed!", "time");
var output = document.getElementById("output");
getCode();
while(true){
await sleep(500);
output.setAttribute("style","color:" + randomColor());
}
}
function printa(a, id){
var div = document.getElementById("div1");
var p = document.createElement("p");
p.appendChild(document.createTextNode(a));
p.setAttribute("id",id);
div.appendChild(p);
}
function printa(a, id, color){
var div = document.getElementById("div1");
var p = document.createElement("p");
p.appendChild(document.createTextNode(a));
p.setAttribute("id",id);
p.setAttribute("style","color:" + color);
div.appendChild(p);
}
function clearPage(){
var parent = document.getElementById("div1");
while(parent.firstChild)
parent.removeChild(parent.firstChild);
}
function toString(a){
var re = new String();
for(var i = 0; i < a.length; i++)
re += a[i];
return re;
}
function sleep(ms){
return new Promise(resolve => setTimeout(resolve, ms));
}
function randomColor(){
var re = "#";
for(var i = 0; i < 6; i++){
var col = parseInt(Math.random()*16);
switch(col){
default: re += col; break;
case 10: re += "A"; break;
case 11: re += "B"; break;
case 12: re += "C"; break;
case 13: re += "D"; break;
case 14: re += "E"; break;
case 15: re += "F"; break;
}
}
return re;
}
function getCode(){
var div = document.getElementById("div2");
var script = document.createElement("script");
script.setAttribute("src","https://gist.github.com/CombustibleToast/6174a146d208b08ecfc47a473d67e55b.js");
div.appendChild(script);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment