124 lines
5.6 KiB
Python
124 lines
5.6 KiB
Python
import time
|
|
import random
|
|
x = ""
|
|
def splitaddr(complete, cmd):
|
|
try:
|
|
c = complete[len(cmd):]
|
|
u = c.split('@')[0]
|
|
a = c.split('@')[1]
|
|
return [u, a]
|
|
except IndexError:
|
|
print('Please complete the command like this: '+cmd+' user@address')
|
|
return 'ERROR'
|
|
def infos():
|
|
print('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...')
|
|
passwordlist = ["my_password","helloworld","ultra_secure_password","my_birthday"]
|
|
filelist = ['picture.png','personnal_datas.csv', 'helloworld.py','i_hate_hackers.txt','speech_for_tomorrow.md', '.ha_ha_this_is_super_secret_file.txt','mydirectory/']
|
|
connected = False
|
|
datased = False
|
|
infos()
|
|
user = ""
|
|
ip = ""
|
|
password = ""
|
|
destroyedip = []
|
|
codeline = ["fn destroy(oiaf){executeshellcomand('destroy oiaf')}","hack-server()","destroy()","fn hack-server(files){for(var i = 0, i<len(files)){if (type_of_file(files[i])==='password_files_and_datas_files'){execcommand('copyfile_to_my_computer'); destroy(files)};", "print(01020003957058098409438409340&àà_09232983983983923999832983928398329389238938923892382938923899201809381093809é'802984029804802948049820840938éàç8309é_à'ç_éà'_09790872çà'àç_éè409724097240942èàçé'8è290479024798047298047904èé4908éè4) in serverdatas"]
|
|
print('starting session ...')
|
|
me = input('your name: ')
|
|
# example of serversdatas: "user@ip":{"destroyed":True (or False), "files":listoffiles, "password":"password"}
|
|
gamedatas = {
|
|
"serversdatas":{},
|
|
"username": me
|
|
}
|
|
while True:
|
|
if connected:
|
|
x = input(f'{user}@{ip} $ ')
|
|
else:
|
|
x = input(f'{me}@MYCOMPUTER # ')
|
|
if x.startswith('ssh'):
|
|
if connected:
|
|
print('error you already are in distant server')
|
|
else:
|
|
if splitaddr(x, 'ssh') == 'ERROR':
|
|
splitaddr(x, 'ssh')
|
|
else:
|
|
user = splitaddr(x, 'ssh')[0]
|
|
ip = splitaddr(x, 'ssh')[1]
|
|
print('connect to the computer with the ip '+ip+' from the user '+user+' ...')
|
|
if ip in destroyedip:
|
|
print('error this server is destroyed')
|
|
else:
|
|
time.sleep(1)
|
|
input('Password: ')
|
|
time.sleep(0.5)
|
|
print('connected')
|
|
connected=True
|
|
elif x.startswith('pbk'):
|
|
if connected:
|
|
print('error you are on a distant server')
|
|
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')
|
|
elif x=='infos':
|
|
infos()
|
|
elif x=='$$$':
|
|
pcode=''
|
|
ccode=''
|
|
tocancel=False
|
|
while True:
|
|
pcode = input()
|
|
if pcode=='$$$':
|
|
break
|
|
elif pcode=='$HELP$':
|
|
print('type $$$ to exit the python code')
|
|
elif pcode=='$CANCEL':
|
|
tocancel=True
|
|
else:
|
|
ccode = ccode+pcode+'\n'
|
|
if tocancel:
|
|
pass
|
|
else:
|
|
exec(ccode)
|
|
|
|
|
|
|