feat: added rounds

This commit is contained in:
ysandler 2017-09-09 14:49:10 -05:00 committed by Joshua Shoemaker
parent 4cabc3db1f
commit 0b7f7fa01f
3 changed files with 81 additions and 13 deletions

33
app.js
View File

@ -1,6 +1,6 @@
//----------Constant Values and Objects--------- //----------Constant Values and Objects---------
let targetIpAddress = ''; let targetIpAddress = '';
const lockoutMax = 4; const lockoutMax = 9;
let lockoutHits = 0; let lockoutHits = 0;
let ipAttempts = []; let ipAttempts = [];
let time = 460000; let time = 460000;
@ -8,6 +8,8 @@ let lose = false;
let win = false; let win = false;
let timerElement = document.getElementById('timer'); let timerElement = document.getElementById('timer');
let timeInterval = {}; let timeInterval = {};
let score = 0;
let winScore = 7;
const systemTypes = ["HIDDEN", "KALILINUX", "WINDOWSXP", "WINDOWS2000", const systemTypes = ["HIDDEN", "KALILINUX", "WINDOWSXP", "WINDOWS2000",
"WINDOWS10", "REDHAT", "ANDROID4.4", "NETHUNTER"]; "WINDOWS10", "REDHAT", "ANDROID4.4", "NETHUNTER"];
@ -68,7 +70,7 @@ function createEntryHTML(entry){
<td>"+ hostName +"</td>\ <td>"+ hostName +"</td>\
<td>"+ machineType +"</td>\ <td>"+ machineType +"</td>\
<td>"+ lastResponse +"MS</td>\ <td>"+ lastResponse +"MS</td>\
<td>"+ systemLocation.long + "-" + systemLocation.lat +"</td>\ <td>"+ systemLocation.long + "_" + systemLocation.lat +"</td>\
</tr>\ </tr>\
</tbody>" </tbody>"
@ -150,7 +152,8 @@ function compareIpAddress(value){
//----------Business Logic-------- //----------Business Logic--------
function init(){ function beginRound(){
document.getElementById('entry_table').innerHTML = "";
let entryArray = createEntryArray(); let entryArray = createEntryArray();
let htmlArray = createEntryHTMLArray(entryArray); let htmlArray = createEntryHTMLArray(entryArray);
let entryHTMLString = concatEntryHTMLArray(htmlArray); let entryHTMLString = concatEntryHTMLArray(htmlArray);
@ -159,12 +162,20 @@ function init(){
targetIpAddress = selectTargetIpAddress(entryArray); targetIpAddress = selectTargetIpAddress(entryArray);
renderEntries(entryHTMLString); renderEntries(entryHTMLString);
assignClickEvent(entryElements); assignClickEvent(entryElements);
timeInterval = setInterval(countDown, 10); renderSuccessPrecentage(score * 100/winScore);
console.log(targetIpAddress); console.log(targetIpAddress);
} }
function beginClicked(){
let instructions = document.getElementById('messege');
instructions.innerHTML = ""
instructions.className = "hidden";
timeInterval = setInterval(countDown, 10);
beginRound();
}
function assignClickEvent(elements){ function assignClickEvent(elements){
@ -184,7 +195,6 @@ function clickedEntry(entry){
if(ipDifference === 10){ if(ipDifference === 10){
targetIpAddressFound(entry); targetIpAddressFound(entry);
renderSuccessPrecentage(100)
} }
else{ else{
wrongEntrySelected(entry, ipDifference); wrongEntrySelected(entry, ipDifference);
@ -197,8 +207,14 @@ function clickedEntry(entry){
function targetIpAddressFound(entry){ function targetIpAddressFound(entry){
score += 1;
if(score > winScore - 1){
gameWin(); gameWin();
} }
else{
beginRound();
}
}
function wrongEntrySelected(entry, similarity){ function wrongEntrySelected(entry, similarity){
@ -215,8 +231,7 @@ function wrongEntrySelected(entry, similarity){
function renderSuccessPrecentage(percentage){ function renderSuccessPrecentage(percentage){
let successPercentage = document.getElementById('precentage'); let successPercentage = document.getElementById('precentage');
successPercentage.innerHTML = percentage + "%"; successPercentage.innerHTML = Math.floor(percentage) + "%";
} }
@ -274,6 +289,8 @@ function gameWin(){
targetElement.className = "win"; targetElement.className = "win";
clearInterval(timeInterval); clearInterval(timeInterval);
timerElement.innerHTML = 0; timerElement.innerHTML = 0;
console.log("Game Win");
} }
function countDown(){ function countDown(){
@ -285,5 +302,3 @@ function countDown(){
gameLose(); gameLose();
} }
} }
init();

View File

@ -15,7 +15,7 @@
<div class="left"> <div class="left">
<h3>TRACKING SUCCESS: <span class="green" id="precentage"></span></h3> <h3>TRACKING SUCCESS: <span class="green" id="precentage"></span></h3>
<h3>QUERY: <span class="green" id="query-name"></span></h3> <h3>QUERY: <span class="green" id="query-name">KATLYEN HICKS</span></h3>
</div> </div>
<div class="right"> <div class="right">
@ -28,6 +28,26 @@
<section id="play-wrapper"> <section id="play-wrapper">
<div id="messege">
<p>Several months ago, your loved one Katlyen Hicks went missing. You have connections
do several deep and dark web users. They have informed you that they ave seen websites known for human
trafficing that have posted advertisements with her picture. These websites are only accessible by using
the T.O.R network. A network designed to mask origins of internet conections to keep communications hidden.
Like any system, it has its weak points. These dark web user friends of yours have taught you secrets of
the trade of computer hacking and tracking. You have now build a tool to help you narrorw down the source
of these website owners. The T.O.R. network masks its users by bouncing their signals all accross the globe
so much so that they are almost impossible to track. You however are able to track the different network nodes
and find the roots of the signals. Your tool will allow you select IP addresses and determine if it is an actual
node being used. This tool will let you know how accurate your choice is so you can accuratly make a new selection.
You only have so long before you are lockout out of the system's vulnerabilities. Use this toime appropriately, you
will need to lock onto several signals to find rthe capture of your loved one.
</p>
<button onclick="beginClicked()">BEGIN</button>
</div>
<table> <table>
<thead> <thead>
<tr class="green"> <tr class="green">

View File

@ -1,6 +1,10 @@
.hidden{
display: none;
}
.screen{ .screen{
width: 900px; width: 900px;
height: 800px; min-height: 800px;
margin: 30px auto; margin: 30px auto;
border-color: #00FF00; border-color: #00FF00;
border-width: 1px; border-width: 1px;
@ -12,6 +16,31 @@
overflow: hidden; overflow: hidden;
} }
#messege{
height: 560px;
text-transform: uppercase;
font-size: 16px;
}
button{
padding: 10px 25px;
color: black;
background-color: #00FF00;
border-width: 1px;
border-style: none;
border-bottom-style: solid;
border-radius: 0px;
border-color: #00FF00;
font-family: monospace;
display: block;
margin: 30px auto;
}
button:hover{
color: white;
background-color: black;
}
#title{ #title{
text-align: center; text-align: center;
} }
@ -55,6 +84,10 @@
margin: 0px; margin: 0px;
} }
.response-wrapper{
padding-bottom: 8px;
}
hr{ hr{
border-color: #00ff00; border-color: #00ff00;
margin: 6px 0px; margin: 6px 0px;