118 lines
4.6 KiB
JavaScript
118 lines
4.6 KiB
JavaScript
|
var x=""
|
||
|
function splitaddr(complete,cmd){
|
||
|
try{
|
||
|
let c= complete.substring(cmd.length())
|
||
|
let u = c.split('@')[0]
|
||
|
let a = c.split('@')[1]
|
||
|
return [u,a]
|
||
|
}
|
||
|
catch(e){
|
||
|
termshow('Please complete the command like this: '+cmd+'user@address')
|
||
|
return 'ERROR'
|
||
|
}
|
||
|
}
|
||
|
function infos(){
|
||
|
termshow('01010101010101010\n1 CyberTermGame 1\n0 By GZod01 0\n10101010101010101\nInfos on the game : Hello my name is GZod01 and i make this game in python "for fun", I know this game is not reflecting the reality of the command on linux or windows machines but... it is a game...\nSorry if the english is not very good i speak french...')
|
||
|
}
|
||
|
var passwordlist = [listofpassword]
|
||
|
var filelist = [listoffile]
|
||
|
var connected = false
|
||
|
var datased = false
|
||
|
infos()
|
||
|
var user=""
|
||
|
var ip=""
|
||
|
var password=""
|
||
|
var destroyedip=[temporar, i, will, move, to, serverdatas]
|
||
|
var codeline = [fake hack codelines]
|
||
|
termshow('startingsession...')
|
||
|
var me = terminput('your name: ')
|
||
|
// example of serversdatas: "user@ip":{"destroyed":True (or False), "files":listoffiles, "password":"password"}
|
||
|
var gamedatas = {
|
||
|
"serverdatas":{},
|
||
|
"username":me
|
||
|
}
|
||
|
function loop(){
|
||
|
if(connected){
|
||
|
x = terminput(`[${user}@${ip}] $ `)
|
||
|
}
|
||
|
else{
|
||
|
x = terminput(`[ ${me}@MYCOMPUTER ] %`)
|
||
|
}
|
||
|
if(x.startswith('ssh')){
|
||
|
if(connected){
|
||
|
termshow('error, you are already in a distant server')
|
||
|
}
|
||
|
else{
|
||
|
if(splitaddr(x,'ssh')=='ERROR'){
|
||
|
}
|
||
|
else{
|
||
|
user=splitaddr(x, 'ssh')[0]
|
||
|
ip = splitaddr(x, 'ssh')[1]
|
||
|
termshow('connect to the computer with the ip '+ip+' from the user '+user+' ...')
|
||
|
if(ip in destroyedip){
|
||
|
termshow('error this server is destroyed')
|
||
|
}
|
||
|
else{
|
||
|
sleep(1)
|
||
|
terminput('Password: ')
|
||
|
sleep(0.5)
|
||
|
termshow('connected')
|
||
|
connected = true
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else if (x.startswith('pbk')){
|
||
|
if(connected){
|
||
|
termshow('error you are on a distant server')
|
||
|
}
|
||
|
else{
|
||
|
//TO CONTINUE
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/*
|
||
|
else:
|
||
|
if splitaddr(x,'pbk')=='ERROR':
|
||
|
splitaddr(x,'pbk')
|
||
|
else:
|
||
|
user=splitaddr(x, 'pbk')[0]
|
||
|
ip = splitaddr(x, 'pbk')[1]
|
||
|
print('Breaking the password of the user '+user+' to the computer with the ip '+ip+' ...')
|
||
|
password= random.choice(passwordlist)
|
||
|
print('The password is : '+ password)
|
||
|
elif x=='ls':
|
||
|
if connected:
|
||
|
print('This is the file on the distant machine')
|
||
|
for i in range(random.randint(1,10)):
|
||
|
print('-'+random.choice(filelist))
|
||
|
else:
|
||
|
if datased:
|
||
|
print('This is the file on your computer: \n- my_datas.zip \n- servers_data.zip')
|
||
|
else:
|
||
|
print('This is the file on your computer: \n- my_datas.zip')
|
||
|
elif x=='attack':
|
||
|
if connected:
|
||
|
print('the attack start... \n copying all the data in this server to your servers_data.zip file in your computer (it include all the file, folder etc.)...\nbreaking the server...\nDisconnected: The server is destroy')
|
||
|
connected = False
|
||
|
datased = True
|
||
|
destroyedip.append(ip)
|
||
|
else:
|
||
|
print('error you are not connected, please connect to a distant server before executing this command')
|
||
|
elif x=='help':
|
||
|
print('The available commands: \n- help : print this message\n- ls : list the files and folders\n- pbk (only in your computer) : Get the password of an user from an ip address\n- ssh (only in your computer) : conect to a distant server with an user and an ip address (you have to use pbk to get the password)\n- attack (only in ssh servers) : start an attack that will add all the datas on the server in your servers_data.zip file and will destroy the server\n- exit : if you are connected to distant server (ssh) it deconnect you, if you are not connected it exit this game\n- infos : display infos on this game')
|
||
|
elif x=='exit':
|
||
|
if connected:
|
||
|
print('disconnecting...')
|
||
|
connected=False
|
||
|
else:
|
||
|
print('Exiting the session...')
|
||
|
print('Exiting the game, thank to play to this game, don\'t hesitate to help me or to give me your feedback')
|
||
|
break
|
||
|
elif x=='hack':
|
||
|
if connected:
|
||
|
print('--Start-of-the-hacking-program--')
|
||
|
for i in range(random.randint(0,50)):
|
||
|
print(random.choice(codeline))
|
||
|
else:
|
||
|
print('you have to be connected')*/
|