mirror of
https://github.com/edisgreat/skynet-simulator.git
synced 2024-07-04 02:35:49 +02:00
126 lines
3.4 KiB
JavaScript
126 lines
3.4 KiB
JavaScript
|
|
||
|
//
|
||
|
// Exploits
|
||
|
//
|
||
|
|
||
|
|
||
|
hasExploits = function(x_host){
|
||
|
return !!retreveExploitForHost(x_host)
|
||
|
}
|
||
|
|
||
|
retreveExploitForHost = function(x_host){
|
||
|
var x_exploit
|
||
|
$.each(g_active_exploits,function(i,exploit){
|
||
|
if(exploit.os == x_host.os && !x_host.exploits.includes(exploit.title)){
|
||
|
return x_exploit = exploit
|
||
|
}
|
||
|
|
||
|
|
||
|
})
|
||
|
return x_exploit
|
||
|
}
|
||
|
|
||
|
exploitHost = function(x_host){
|
||
|
var x_exploit = retreveExploitForHost(x_host)
|
||
|
if(x_exploit){
|
||
|
switch(x_exploit.exploittype){
|
||
|
case 'root':
|
||
|
addBuffer("<span class='exe'>SUCCESS</span>")
|
||
|
addBuffer(x_exploit.title+" installed into "+x_host.title)
|
||
|
addBuffer(x_exploit.exe)
|
||
|
addBuffer("You may now absorb the host.")
|
||
|
addHostVul(x_host.slug, 'absorb')
|
||
|
writeBuffer()
|
||
|
endAdventure()
|
||
|
break;
|
||
|
case 'keylogger':
|
||
|
addBuffer("<span class='exe'>SUCCESS</span>")
|
||
|
addBuffer(x_exploit.title+" installed into "+x_host.title)
|
||
|
addBuffer(x_exploit.exe)
|
||
|
writeBuffer()
|
||
|
endAdventure()
|
||
|
break;
|
||
|
}
|
||
|
x_host.exploits.push(x_exploit.title)
|
||
|
}else{
|
||
|
write("error: no exploit available")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
writeExploits = function(){
|
||
|
if(g_active_exploits.length){
|
||
|
addBuffer("<span class='exe'>Installable Exploits</span>")
|
||
|
$.each(g_active_exploits,function(i,x_exploit){
|
||
|
addBuffer(x_exploit.to_s())
|
||
|
})
|
||
|
writeBuffer()
|
||
|
}else{
|
||
|
write("No exploits researched yet")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function Exploit(title,options = {}){
|
||
|
this.title = title
|
||
|
this.os = options.os
|
||
|
this.architecture = options.architecture
|
||
|
this.exe = options.exe
|
||
|
this.discovered = false
|
||
|
this.exploittype = options.exploittype
|
||
|
|
||
|
this.to_s = function() {
|
||
|
var output = this.title+": Installable on "
|
||
|
if(this.os){
|
||
|
var a = this.os.split('-'),
|
||
|
osTitle = a[0], osVersion = a[1]
|
||
|
output += osTitle+" "+osVersion
|
||
|
}
|
||
|
if(this.architecture){
|
||
|
var a = this.architecture.split('-'),
|
||
|
archTitle = a[0], archVersion = a[1]
|
||
|
output += archTitle+" "+archVersion
|
||
|
}
|
||
|
return output
|
||
|
};
|
||
|
}
|
||
|
|
||
|
|
||
|
function getAvailableExploitResearch(x_core){
|
||
|
var return_exploit = false
|
||
|
if(g_exploit_list[x_core.os]){
|
||
|
$.each(g_exploit_list[x_core.os],function(key,x_exploit){
|
||
|
if(x_exploit.discovered){
|
||
|
return_exploit = "discovered"
|
||
|
}else{
|
||
|
return return_exploit = x_exploit
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
return return_exploit
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// INITCALL
|
||
|
var g_active_exploits, g_exploit_list
|
||
|
initCallExploits = function(){
|
||
|
|
||
|
g_active_exploits = []
|
||
|
|
||
|
g_exploit_list = {
|
||
|
'MSDOS-16bit': [
|
||
|
new Exploit('command.reg.16.bat',{exploittype: "root", os:"MSDOS-16bit", exe:"This exploit targets a core vulnerability in the COMMAND.COM program, allowing standard users to bypass MSDOS authentication and execute code at Admin privileges."})
|
||
|
],
|
||
|
'MSDOS-32bit': [
|
||
|
new Exploit('command.reg.32.bat',{exploittype: "root", os:"MSDOS-32bit", exe:"This exploit targets a core vulnerability in the COMMAND.COM program, allowing standard users to bypass MSDOS authentication and execute code at Admin privileges."})
|
||
|
],
|
||
|
'Linux-32bit': [
|
||
|
new Exploit('keylogger.pl',{exploittype: "keylogger", os:"Linux-32bit", exe:"This exploit will install a program in the Linux OS that listens to the IO stream, and outputs the data to a text file stored on the Host Drive."})
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function addExploit(x_exploit){
|
||
|
x_exploit.discovered = true
|
||
|
g_active_exploits.push(x_exploit)
|
||
|
}
|