Skip to content

Commit 1650a85

Browse files
committed
new
1 parent 848c0c1 commit 1650a85

File tree

1 file changed

+53
-14
lines changed

1 file changed

+53
-14
lines changed

Gama2.py

+53-14
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ def Decryptor(self):
380380
print("Goodbye")
381381

382382

383-
def LAN(host, rhost):
383+
def LAN(ls):
384+
host = ls[0]
385+
rhost = ls[1]
384386
ln = rhost.LAN
385387
print("Welcome to LAN tool")
386388
while True:
@@ -389,8 +391,9 @@ def LAN(host, rhost):
389391
if ent == "e":
390392
return
391393
elif ent == "s":
394+
print("Computers connected to LAN:")
392395
for x in ln:
393-
print("{} - {}".format(x.name, x.type))
396+
print("{} - Lan state: {}".format(x.name, x.type))
394397
elif ent == "c":
395398
name = input("Enter name of computer on lan: ")
396399
lan_adp = search(ln, "name", name)
@@ -404,6 +407,7 @@ def LAN(host, rhost):
404407
if user == lan_adp.user and password == lan_adp.password:
405408
Instance.i = comp
406409
print("Connected.")
410+
return
407411

408412

409413
def hashdump(lhost, rhost):
@@ -487,7 +491,7 @@ class Instance:
487491

488492
class PC:
489493
all_pc = []
490-
story = 1 # shows to which part of the story we are
494+
491495

492496
def __init__(self, name, ip, me, space=1000, hard=[], mails=[]):
493497
self.ip = ip
@@ -512,7 +516,7 @@ def __init__(self, name, ip, me, space=1000, hard=[], mails=[]):
512516
self.mails = mails
513517
self.me = me
514518
self.space = space
515-
519+
self.story = 1 # shows to which part of the story we are
516520
self.ports = []
517521
self.all_pc.append(self)
518522

@@ -551,14 +555,22 @@ def reply(self, contact, mess):
551555
"find the mainframe.")])
552556
contact.attachments = [File.fls["LAN"]]
553557
print("New message.")
558+
elif part == 6 and mess == "p6":
559+
self.story += 1
560+
add_email(contact, "Well done", [box("All right. Now just decrypt the file and follow the trail : )")])
561+
print("New message.")
554562

555563
def execute(self, command):
556564
command = command.split(" ")
557565
cmd = command[0]
558566
if cmd == "help":
559-
print("'help' - to show this screen\n'ls' - to list files in current directory\n'connect' - to connect to"
567+
print("'help' - to show this screen\n'ls' - to list files in current directory"
568+
"\n'mkdir [folder_name]' - to make a new folder\n'cd [path]' - to change current directory\n"
569+
"'mv [filename] [folder_path]' - to move a file to another folder\n'connect' - to connect to"
560570
" another computer.\n'email' - to access emails\n'dis' - to disconnect from a computer\n"
561-
"'download' - to download files\n'space' - to see current memory\n'run' - to open a file")
571+
"'download' - to download files\n'space' - to see current memory\n'run' - to open a file\n"
572+
"'hrun' - to run files from your computer when connected to another"
573+
"\n'web [url]' - to go to a website")
562574

563575
elif cmd == "admin":
564576
print("Welcome Shadow")
@@ -575,9 +587,9 @@ def execute(self, command):
575587
self.story = part
576588

577589
elif cmd == "creds":
578-
ls = [obj1]
590+
ls = [obj1, obj3]
579591
for x in ls:
580-
print("{} - ports: {}".format(x.ip, list(map(lambda y: y.number, x.ports))))
592+
print("{} {} - ports: {}".format(x.name, x.ip, list(map(lambda y: y.number, x.ports))))
581593

582594
elif cmd == "ls":
583595
for x in self.dir.folder:
@@ -656,6 +668,8 @@ def execute(self, command):
656668
print("Server ip found: {}".format(obj2.ip))
657669
if self.story == 4:
658670
self.reply(self.mails[0], "p4")
671+
elif page == "www.metasploit.com":
672+
pass # download msf.exe
659673
else:
660674
print("Unresolved web address. :/")
661675

@@ -667,6 +681,18 @@ def execute(self, command):
667681
else:
668682
file.run(self)
669683

684+
elif cmd == "hrun":
685+
host = Instance.host
686+
print("Files on host:")
687+
for x in host.dir.folder:
688+
print(x.name)
689+
file = input("Enter filename: ")
690+
file = search(host.dir.folder, "name", file)
691+
if file == False:
692+
print("No such file found.")
693+
else:
694+
file.run([host, self])
695+
670696
elif cmd == "space":
671697
print("Memory: {}/{}".format(self.used, self.space))
672698

@@ -696,6 +722,14 @@ def execute(self, command):
696722
self.bash = path + "#> "
697723
self.path = path
698724
self.dir = search(self.harddrive, "path", path)
725+
elif cmd == "mv":
726+
file = command[1]
727+
folder = command[2]
728+
file = search(self.dir.folder, "name", file)
729+
folder = search(self.harddrive, "path", folder)
730+
folder.folder.append(copy.deepcopy(file))
731+
self.dir.folder.remove(file)
732+
print("File moved to " + folder.path)
699733

700734
elif cmd == "connect":
701735
ip = input("Enter ip to connect: ")
@@ -727,11 +761,14 @@ def execute(self, command):
727761
if file == "c":
728762
break
729763
elif file == "d":
730-
my_pc = search(PC.all_pc, "me", True)
764+
my_pc = Instance.host
731765
self.download(fls, my_pc)
732766
if my_pc.story == 3:
733767
contact = my_pc.mails[0]
734768
my_pc.reply(contact, "p3")
769+
if my_pc.story == 6:
770+
contact = my_pc.mails[0]
771+
my_pc.reply(contact, "p6")
735772
break
736773
else:
737774
file = search(self.dir.folder, "name", file, True)
@@ -778,6 +815,7 @@ def download(self, fls, obj):
778815
File.fls["LAN"] = File("LAN_connect", 30, "exe", LAN)
779816
File.fls["ObjtxtFile1"] = File("data", 20, "txt", t2a("Some data"), True)
780817
File.fls["Dictionary"] = File("dict", 30, "txt", "pass1, pass2, pass3")
818+
File.fls["Link_to_msf"] = File("link", 30, "txt", t2a("The file is at: www.metasploit.com"), True)
781819
Port.ports.append(Port(25, 1))
782820
Port.ports.append(Port(80, 2))
783821
# Initializing other computers
@@ -788,14 +826,14 @@ def download(self, fls, obj):
788826
obj3 = PC("User", ipgen(), False, 600) # first LAN
789827
obj3.ports.append(Port(25, 1))
790828
obj3.lan_conn = LAN_con(obj3)
791-
obj4 = PC("Retr0", ipgen(), False, 2000) # has hashdump
829+
obj4 = PC("Retr0", ipgen(), False, 2000) # middle
792830
obj4.lan_conn = LAN_con(obj4)
793-
obj5 = PC("Mainframe", ipgen(), False, 2000) # has msfconsole
831+
obj5 = PC("Mainframe", ipgen(), False, 2000, [File.fls["Link_to_msf"]]) # has msfconsole 'end'
794832
obj5.ports.append(Port(40, 3, "closed"))
795-
obj5.lan_conn = LAN_con(obj5, "locked", credits(4, 1)[0], credits(1, 4)[1])
833+
obj5.lan_conn = LAN_con(obj5)
796834
obj3.LAN = [obj4.lan_conn]
797-
obj4.LAN = [obj5.lan_conn]
798-
obj5.LAN = [obj3.lan_conn, obj4.lan_conn]
835+
obj4.LAN = [obj3.lan_conn, obj5.lan_conn]
836+
obj5.LAN = [obj4.lan_conn]
799837
File.fls["ObjtxtFile1"].content = t2a("So the files are on: {}".format(obj3.ip))
800838
# head()
801839
name = input("Enter name: ")
@@ -805,6 +843,7 @@ def download(self, fls, obj):
805843
Instance.i = player
806844
Instance.host = search(PC.all_pc, "me", True)
807845
print("New emails check mailbox with 'email'")
846+
print("Use 'help' to see available commands")
808847
while True:
809848
inst = Instance.i
810849
inst.execute(input(inst.bash))

0 commit comments

Comments
 (0)