Skip to content

Instantly share code, notes, and snippets.

@lukespragg
Created August 12, 2014 20:19
Show Gist options
  • Save lukespragg/89ae4af0c713d2e58d59 to your computer and use it in GitHub Desktop.
Save lukespragg/89ae4af0c713d2e58d59 to your computer and use it in GitHub Desktop.
Bob's botnet
<style type="text/css">
#console {
width: 800px;
height: 500px;
background-color: #000;
color: #00FF00;
font-family: 'lucida console', arial;
font-size: 12px;
font-weight: bold;
padding: 5px;
overflow: hidden;
margin: auto;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
#vmove {
position: relative;
}
</style>
<script type="text/javascript">
currentline = "";
canEnter = true;
function setLine() {
tesc = currentline.substr(0, keyposition) + "_" + currentline.substr(keyposition);
esc = tesc.split("&").join("&amp;").split("<").join("&lt;"). split(">").join("&gt;");
document.getElementById('typingarea').innerHTML = esc;
}
document.addEventListener("keypress", function(e) {
if (canEnter) {
key = e.charCode || e.keyCode;
currentline = currentline.substr(0, keyposition) + String.fromCharCode(key) + currentline.substr(keyposition);
keyposition++;
setLine();
}
});
document.onkeydown = function(e) {
key = e.charCode || e.keyCode;
if (canEnter) {
if (key == 8) {
if (keyposition > 0) {
currentline = currentline.substr(0, keyposition - 1) + currentline.substr(keyposition);
keyposition--;
}
} else if (key == 46) {
if (keyposition < currentline.length) {
currentline = currentline.substr(0, keyposition) + currentline.substr(keyposition + 1);
}
} else if (key == 13) {
document.getElementById('entryline').style.display = 'none';
processCommand(currentline);
currentline = "";
} else if (key == 38 && recall.length > 0) {
if (recallIndex == 0) {
currenttemp = currentline;
}
recallIndex++;
if (recallIndex > recall.length) {
recallIndex = recall.length;
}
currentline = recall[recall.length - recallIndex];
} else if (key == 40) {
recallIndex--;
if (recallIndex < 0) {
recallIndex = 0;
}
if (recallIndex == 0) {
if (currenttemp != null) {
currentline = currenttemp;
}
} else {
currentline = recall[recall.length - recallIndex];
}
} else if (key == 37) {
// left
keyposition--;
if (keyposition < 0) {
keyposition = 0;
}
} else if (key == 39) {
// right
keyposition++;
if (keyposition > currentline.length) {
keyposition = currentline.length;
}
} else {
return true;
}
} else {
return true;
}
setLine();
return false;
}
function isUrl(s) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(s);
}
commands = new Object;
currenttemp = null;
recall = [];
recallIndex = 0;
keyposition = 0;
function processCommand(cmd) {
cmd = cmd.trim();
canEnter = false;
document.getElementById('output').innerHTML += "Botnet> " + cmd + "<br />";
if (cmd.length > 0) {
args = cmd.split(" ");
cmdName = args.shift();
try {
commands[cmdName.toUpperCase()][0](args);
recall.push(cmd);
} catch (e) { commandDone("'" + cmdName + "' is not recognized as an internal or external command, operable program or batch file."); }
} else {
commandDone();
}
}
function commandDone(response) {
response = response == null ? "" : response;
tmp = document.getElementById('temp').innerHTML;
tmp += tmp.length > 0 ? "\n" : "";
response = tmp + response;
response = response.replace(/\n/gi, "<br />");
if (response.length > 0) {
response += "<br /><br />";
}
document.getElementById('output').innerHTML += response;
h = document.getElementById('vmove').offsetHeight;
if (h > 500) {
h -= 490;
document.getElementById('vmove').style.top = '-' + h + 'px';
}
document.getElementById('temp').innerHTML = "";
document.getElementById('entryline').style.display = '';
currenttemp = null;
keyposition = 0;
canEnter = true;
}
commands['HELP'] = new Array(function(args) {
out = "For more information on a specific command, type HELP command-name";
for (x in commands) {
out += "\n" + x + "&nbsp;&nbsp;-&nbsp;&nbsp;" + commands[x][1];
}
commandDone(out);
}, "Provides Help information for Botnet commands.");
commands['PING'] = new Array(function(args) {
commandDone("pong");
}, "Pings the botnet");
commands['CAT'] = new Array(function(args) {
commandDone("<(????)>");
}, "Return a cat");
commands['ATTACK'] = new Array(function(args) {
if (args.length == 1) {
if (isUrl(args[0])) {
i = 0;
document.getElementById('temp').innerHTML = i;
atki = setInterval(function() {
i++;
out = "Distributing data to network...<br />" + i + "%&nbsp;&nbsp;[";
for (j=0;j<=i/2;j++) {
out += "=";
}
for (;j<=50;j++) {
out += "&nbsp;";
}
document.getElementById('temp').innerHTML = out + "]";
if (i > 99) {
clearInterval(atki);
commandDone("Distribution complete :3");
}
}, 50);
} else {
commandDone("Invalid attack URL provided.");
}
} else {
commandDone("The syntax of the command is incorrect.\nShould be attack [url]");
}
}, "Causes all bots to ping a url");
</script>
<div id="console">
<div id="vmove">
Bob's Botnet [Version 1.21.64924]<br />
(c) Bob. All rights reserved.<br /><br />
<span id="output"></span>
<span id="temp"></span>
<span id="entryline">Botnet> <span id="typingarea">_</span></span>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment