-
Notifications
You must be signed in to change notification settings - Fork 8
/
core.gs
2898 lines (2880 loc) · 129 KB
/
core.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//////////////////////////////////////////////////////////////
///======================= CORE =========================////
////////////////////////////////////////////////////////////
///==================== { SeaShell }
SS.s = get_shell;
SS.c = SS.s.host_computer;
SS.f = SS.c.File("/");
SS.obj = null
SS.co = [] // push and pull from here for objects we take into surf mode
SEO = new SS.EO
SEO.map(SS.s)
CEO = new SS.EO
CEO.map(SS.c)
FEO = new SS.EO;
FEO.map(SS.f, SS.c.public_ip, SS.c.local_ip)
SS.apt = null
SS.capt = null // current apt
SS.crypto = null
SS.ccrypt=null
SS.mx = null
SS.cmx = null
SS.apt_updates = []
SS.shells = []
SS.computers = []
SS.files = []
SS.commands = []
SS.networks = []
SS.sessions = []
SS.mxlibs = []
SS.macros = []
SS.cfg = {} // cfg
SS.cfg.label = null
SS.cfg.i = null // item: cache/config folder
SS.cfg.lf = null //item: log folder
SS.cfg.ip = SS.c.public_ip
SS.cfg.lan = SS.c.local_ip
SS.cfg.start_time = time
SS.cfg.timestamp = current_date
SS.cfg.unsecure_pw = "f1shb0wl"
SS.cfg.burnmailacct = "Oppelli@barner.com"
SS.cfg.burnmailpw = "Bitch"
SS.cfg.mailobj = null
SS.cfg.mailacct = "mail@bolds.net"
SS.cfg.mailpw = "mail"
SS.cfg.hackip = "214.85.237.165"
SS.cfg.repoip = "115.83.129.59"
SS.cfg.repowf = "init.weak.so"
SS.cfg.dat = null // data file
SS.cfg.macros = null // macro folder
SS.cfg.wf = null // weak lib file
SS.cfg.wm = "0x73CBD7B0" // weak lib memory zone
SS.cfg.wa = "havedoutlinenumbe" // weak lib memory address
SS.cfg.wv = null//weak version
SS.cfg.api1=null//ip
SS.cfg.api2=null//memzone
SS.cfg.api3=null//memaddr
SS.cfg.api4=null//api port
SS.cfg.api5=null
SS.cfg.api6=null
SS.cfg.libf = null//lib folder
SS.cfg.libfw = null//weak folder
SS.cfg.libfs = null//strong folder
SS.cfg.wlibs = []//weak
SS.cfg.slibs = []//strong
SS.heart = SS.GFX.f([{"<".red.b.size(18): [36, 0.2,-90,0]}, {"3".red.b.size(18): [36,-0.1,-90,0]}, {" by ".lblue+"Tuna Terps".b.cyan:[36.75, 0,0,0]}])
SS.dfs = []
SS.dfsbin = ["cd","ls","ps","pwd","ifconfig","iwconfig","iwlist","cat","rm","mv","cp","ssh","ftp","mkdir","rmdir","chmod","reboot","whois","sudo","useradd","userdel","passwd","nslookup","build","touch","chown","chgrp","groupadd","groupdel","groups","kill","ping","apt-get" ,"man","whoami"]
///==================== SS.CMD() ========================////
SS.CMD = {}
SS.CMD.isValid = function(param)
if param == "" or param == " " then return null
for c in SS.commands
if (c["name"] == param) or (c["alias"] == param) then return c
if c["name"] == "entry" and (is_valid_ip(param) or is_valid_ip(nslookup(param))) then return c
end for
return null
end function
SS.CMD.fcmd = function(s)
s = s.replace("\|", " ")
s = s.split(" ")
return s
end function
SS.CMD.hasRequiredArgs = function(cmd, p)
passed = 0; if (p.len > 0) and ((p[0] == cmd.name) or (p[0] == cmd.alias)) then p.pull
if SS.debug then LOG("CMD: ".red+cmd["name"] +" "+"REQUIRED: ".yellow+cmd["params"].len+" "+"PASSED ARGS: ".orange+p);
if p.len > cmd["params"].len then return false// even if a command is misconfigured, this should catch issues
for cmdIndex in cmd["params"]
if cmdIndex == "*" then
if SS.debug then LOG("args: c1")
passed = passed+1
continue
end if
if SS.debug then LOG("POSSIBLE ARG: ".purple+cmdIndex)
if cmdIndex.indexOf("|") then
parse = SS.CMD.fcmd(cmdIndex)
if SS.debug then LOG("args: c2 "+parse)
for parsed in parse
if T(p.indexOf(parsed)) == "number" or (parsed == "*") then
passed = passed+1
break
end if
end for
else
if SS.debug then LOG("args: c3")
for argIndex in p
if argIndex == "" then continue
if (argIndex == cmdIndex) or (cmdIndex == "*") then
//if T(p.indexOf(argIndex)) == "number" or (cmdIndex == "*") then
passed = passed+1
end if
end for
end if
end for
if passed == cmd["params"].len then return true
return false
end function
SS.CMD.chain = function(a)
if SS.debug then LOG("chaining command(s): ".debug+a)
if a.indexOf(";") == null then return a;ret = [];
for c in a.split(";");ret.push(c.trim);end for;
if SS.debug then LOG("chaining commands:".debug+ret)
return ret
end function
SS.CMD.invoke = function(obj, p)
result = null
args = p.split(" ")
if SS.debug then LOG("SS.CMD:invoke recieved cmd:".debug+" <b>" + p.grey+" via: "+T(obj))
cmd = SS.CMD.isValid(args[0])
if cmd == null then return LOG("Invalid Command: ".warning+args[0]+NL+"Use command ".white+"<b>-h</b>".grey+" for list of valid commands".white)
if SS.CMD.hasRequiredArgs(cmd, args) == false then return LOG("Invalid Arguments: ".warning+NL+"Use command ".white+"-h <b>"+cmd.name+"</b>".grey+" for man usage".white)
run = cmd["run"]
if args.len == 0 then
if cmd["cb"] == null then run()
if cmd["cb"] == "general" then run(obj)
if cmd["cb"] == "result" then result = run(obj)
if cmd["cb"] == "custom" then
SS.cb = null
run(obj)
if SS.cb != null then result = SS.cb
end if
else if args.len == 1 then
if cmd["cb"] == null then run(args[0])
if cmd["cb"] == "general" then run(obj, args[0])
if cmd["cb"] == "result" then result = run(obj, args[0])
if cmd["cb"] == "custom" then
SS.cb = null
run(obj, args[0])
if SS.cb != null then result = SS.cb
end if
else if args.len == 2 then
if cmd["cb"] == null then run(args[0], args[1])
if cmd["cb"] == "general" then run(obj, args[0], args[1])
if cmd["cb"] == "result" then result = run(obj, args[0], args[1])
if cmd["cb"] == "custom" then
SS.cb = null
run(obj, args[0], args[1])
if SS.cb != null then result = SS.cb
end if
else if args.len == 3 then
if cmd["cb"] == null then run(args[0], args[1], args[2])
if cmd["cb"] == "general" then run(obj, args[0], args[1], args[2])
if cmd["cb"] == "result" then result = run(obj, args[0], args[1], args[2])
if cmd["cb"] == "custom" then
SS.cb = null
run(obj, args[0], args[1], args[2])
if SS.cb != null then result = SS.cb
end if
else if args.len == 4 then
if cmd["cb"] == null then run(args[0], args[1], args[2], args[3])
if cmd["cb"] == "general" then run(obj, args[0], args[1], args[2], args[3])
if cmd["cb"] == "result" then result = run(obj, args[0], args[1], args[2], args[3])
if cmd["cb"] == "custom" then
SS.cb = null
run(obj, args[0], args[1], args[2], args[3])
if SS.cb != null then result = SS.cb
end if
else if args.len == 5 then
if cmd["cb"] == null then run(args[0], args[1], args[2], args[3], args[4])
if cmd["cb"] == "general" then run(obj, args[0], args[1], args[2], args[3], args[4])
if cmd["cb"] == "result" then result = run(obj, args[0], args[1], args[2], args[3], args[4])
if cmd["cb"] == "custom" then
SS.cb = null
run(obj, args[0], args[1], args[2], args[3], arg[4])
if SS.cb != null then result = SS.cb
end if
end if
return result
end function
SS.CMD.prompt = function(eo)
if SS.debug then LOG("SS.CMD:prompt ".debug+T(eo))
o=null;host=null; sym = "$";tsym = "S".green;
obj = eo.o
if eo.type != "file" then
if eo.type == "computer" then
tsym = "C".blue; o = obj
else if eo.type == "shell" then
o = obj.host_computer
else
tsym = "FTP".yellow; o = obj.host_computer
end if
ip = o.public_ip
lan = o.local_ip
host = o.get_name.lblue
if SS.remote == true then host = o.get_name.purple
else
ip = eo.ip
lan = eo.lan
host = " "+obj.name.b.grey
tsym = "F".orange
end if
ip = ip.lblue
lan = lan.grey
if (SS.remote==false) and (eo.lan == SS.cfg.lan) then lan = lan.lblue
if (SS.remote==true) and (eo.lan != SS.cfg.lan) then lan = lan.purple
if SS.remote then ip = ip.purple
user = SS.Utils.user(obj);
if SS.debug then LOG("debugging user: ".debug+user+" "+T(user))
if user == "root" then sym = "#"
space = 3.9+(user.len+host.len)*0.6
s = NL+"<pos=04>—{"+user.isRoot(user, "FFFFFF")+"@".white+host+"}—[<b>"+tsym+"</b>]—{"+ ip.size(14).a +":".white+ lan.size(14).a +"}—["+SS.Utils.dash(SS.cwd, user).white.size(14)+"]<voffset=-0.5em><space=-"+space+"em><pos=00>|<voffset=-1em><space=-0.6em>|<voffset=-1.5em><pos=04>——:~"+sym.white+" "
return INPUT(s)
end function
SS.CMD.result = function(o)
//if INPUT("New object returned !".sys+NL+"Press 1 to pass to surf mode ".grey).to_int != 1 then return
if SS.debug then LOG("Result: ".debug+o)
f = null
if (o isa SS.EO) == false then
f=new SS.EO;
f.map(o)
f.cache
o = f
end if
SS.co.push(o)
h = o.home
if h != null then SS.cwd = h
if SS.cwd == null then SS.cwd = "/"
return SS.surf_mode(o)
end function
SS.CMD.setCommands = function
ha = null
cs = null
if T(SS.cfg.aliases) == "file" then
c = SS.cfg.aliases.get_content
cs = c.split(NL)
if not cs or cs.len<1 then LOG("No aliases found") else ha = true
else;LOG("Aliases not loaded on this host".grey.sys)
end if
if ha then; ha = function(n,p)
for i in p
check = i.split("=")
if not check or check.len < 2 then continue
if check[1] == n then return check[0]
end for
return null
end function; end if
for cmd in SS.CMD.list
alias = null
if @ha != null then alias = ha(cmd[0], cs)
SS.commands.push({"name":cmd[0], "desc":cmd[1], "params":cmd[2], "usage":cmd[3], "cb":cmd[4], "run":@cmd[5], "alias":alias})
end for
end function
SS.CMD.getOne = function(n)
for cmd in SS.commands
if cmd.name == n then return cmd
end for
return null
end function
SS.CMD.setAlias = function(n, a)
cmd = SS.CMD.getOne(n)
if cmd == null then return LOG("Command not found: ".warning+n)
if SS.CMD.getOne(a) != null then return LOG("Intended alias is a command: "+a)
if SS.cfg.aliases == null then
LOG("Aliases file not found, build with -cfg -a -b".warning)
else
pre = SS.cfg.aliases.get_content.split(NL)
co = 0
astr = null
for al in pre
if al.indexOf(a) != null then; astr = al; break; end if;
end for
end if
cmd.alias = n
end function
SS.CMD["cmd_list"] = function(usage = null)
p = null
if not usage then
tData = []
tData.push({"<u>".cyan: [0,0,0,0]})
tData.push({"<b>[ "+"NAME".white+" ]": [0,0,0,0]})
tData.push({"[ "+"ARGS".white+" ]": [11,0,0,0]})
tData.push({"[ "+"DESC".white+" ] </u>/\n": [32,0,0,0]})
for c in SS.commands
if c["name"] == "iget" then continue
nl = c["name"].white
if (SS.training_wheels == true) and ["crab", "cache", "surf", "mx", "crypto", "apt-get", "entry"].indexOf(c["name"]) != null then nl = c["name"].green
tData.push({nl: [1,0,0,0]})
tData.push({c["params"].join(" | ".b.lblue).cyan: [11,0,0,0]})
tData.push({c["desc"].lblue+"\n": [32,0,0,0]})
end for
LOG(SS.GFX.f(tData))
p = true
else
i = null
for item in SS.commands
if item["name"] == usage then
i = item
break
end if
end for
if not i or not i["usage"] then return LOG("*<i>Usage not found</i>*".grey+" cmd:<b> "+usage.white)//+"</b> \n-->"+color.grey+"* Chec")
LOG("|".lblue+"CMD: ".cyan+"<b>"+usage.white+"</b>\n"+"|".lblue+"ARGS: ".cyan+i["params"]+"\n"+"|".lblue+"INFO:".cyan.s+i["usage"])
end if
LOG("<b>-->".white+ " *</b><i>"+" Represents a dynamic, or optional parameter.".lblue)
if p then LOG("*"+"<i>DETAILS</i>".grey+"* Use cmd: "+"-h".lblue.b+" [".white+"cmd_name".lblue+"]".white+" for CMD usage")
end function
///==================== SeaShell() ========================////
SS.getUserConfig = function
SS.cfg.i = SS.Utils.hasFolder(SS.c, ".ss")
s = "Checking host . . .".sys
if SS.cfg.i then
s = "Cache found, checking user . . .".ok
p = SS.cfg.i.path
SS.cfg.dat = SS.Utils.fileFromPath(SS.s, p+"/ss.dat")
SS.cfg.aliases = SS.Utils.fileFromPath(SS.s, p+"/ss.aliases")
SS.cfg.macros = SS.Utils.fileFromPath(SS.s, p+"/ss.macros")
SS.cfg.lf = SS.Utils.fileFromPath(SS.s, p+"/ss.logs")
else
s = s+NL+"* Unable to locate cache folder".yellow
SS.cfg.dat = SS.Utils.hasFile(SS.c, "ss.dat")
SS.cfg.aliases = SS.Utils.hasFile(SS.c, "ss.aliases")
SS.cfg.macros = SS.Utils.hasFile(SS.c, "ss.macros")
SS.cfg.lf = SS.Utils.hasFolder(SS.c, "ss.logs")
end if
if T(SS.cfg.dat) == "file" then
SS.setDat(SS.cfg.dat.get_content)
s = s+NL+"User config, loaded!".green.sys
else
s = s+NL+"* Unable to load user config".grey
end if
if not SS.cfg.i then s = s+NL+"* missing cache : ".grey+SS.ccd.cyan.b
if not SS.cfg.dat then s = s+NL+"* missing resource: ".grey+"ss.dat"
if not SS.cfg.aliases then s = s+NL+"* missing resource: ".grey+"ss.aliases"
if not SS.cfg.macros then s = s+NL+"* missing resource: ".grey+"ss.macros"
if not SS.cfg.lf then s = s+NL+"* missing resource: ".grey+"ss.logs"
if T(SS.cfg.macros) == "file" then
SS.setMacros(SS.cfg.macros.get_content)
s = s+NL+"User macros, loaded!".green.sys
else
s = s+NL+"* Unable to load user macros".grey
end if
LOG(s)
end function
SS.buildEntireUserCache = function(flag = null, obj = null)// TODO: handle flag
if obj == null then obj = SS.c
h = SS.Utils.goHome(obj)
if not h then return LOG("No home directory, malformed fs".warning)
LOG("building user cache. . .".grey.sys)
capa = h+"/"+SS.ccd
f1 = SS.Utils.fileFromPath(SS.c, capa)
if not f1 then
if obj.create_folder(h, SS.ccd) == 1 then
LOG("User cache directory built at: "+h.grey+"/".grey+SS.ccd.lblue)
if obj.public_ip == SS.c.public_ip then SS.cfg.i = obj.File(capa)
else;LOG("Failed to create the cache folder".warning)
end if
if obj.create_folder(capa, "ss.logs") == 1 then
LOG("Event Log directory built at: "+capa.grey+"/".grey+"ss.logs".lblue)
if obj.public_ip == SS.c.public_ip then SS.cfg.lf = obj.File(capa+"/ss.logs")
else;LOG("Failed to create the log folder".warning)
end if
if obj.create_folder(capa, "ss.libs") == 1 then
if obj.public_ip == SS.c.public_ip then SS.cfg.libf = obj.File(capa+"/ss.libs")
wait(0.1)
if obj.create_folder(capa+"/ss.libs", "weak") == 1 then
if obj.public_ip == SS.c.public_ip then SS.cfg.libfw = obj.File(capa+"/ss.libs")
LOG("Weak folder repo: "+capa.grey+"/".grey+"libs".lblue)
else;LOG("Failed to create the log folder".warning)
end if
if obj.create_folder(capa+"/ss.libs", "strong") == 1 then
LOG("Strong folder repo: "+capa.grey+"/".grey+"libs".lblue)
if obj.public_ip == SS.c.public_ip then SS.cfg.libfs = obj.File(capa+"/ss.libs")
else;LOG("Failed to create the log folder".warning)
end if
else;LOG("Failed to create the lib folder".warning)
end if
end if
if not f1 then f1 = SS.Utils.fileFromPath(SS.c, capa)
if not f1 then return LOG("Unable to build the cache directory".warning)
capb = capa+"/ss.dat"
if not SS.Utils.fileFromPath(obj, capb) then;LOG("Setting config: ".sys+"user"); SS.setUserConfig("-u", "-b"); end if
capc = capa+"/ss.macros"
if not SS.Utils.fileFromPath(obj, capc) then;LOG("Setting config: ".sys+"maacros");SS.setUserConfig("-m", "-b");end if
capd = capa+"/dict"
if not SS.Utils.fileFromPath(obj, capd) then
LOG("Setting db: ".sys+"exploits".lblue); SS.setUserConfig("-e", "-b");
LOG("Setting db: ".sys+"hashes".lblue); SS.setUserConfig("-h", "-b");
LOG("Engaging paste protocol: ".sys+"hashes".lblue); SS.setUserConfig("-h", "-p");
end if
LOG("user cache build ran succesfully".sys)
SS.getDb(obj)
SS.setCache//sets certain env variables
end function
SS.getLibConfig = function(self)
SS.mx = SS.Utils.hasLib(SS.s, "metaxploit.so")
SS.crypto = SS.Utils.hasLib(SS.s, "crypto.so")
SS.cmx = null
if SS.mx != null then
SS.cmx = SS.mx
if SS.crypto == null then
ret = "MX".yellow
else
SS.ccrypt = SS.crypto
ret = "SS".cyan
end if
else if SS.crypto != null then
SS.ccrypt = SS.crypto
ret = "Crypto".orange
else
ret = "OS".red
end if
SS.cfg.label = ret
LOG("Configuration set: ".sys+SS.cfg.label)
return ret
end function
SS.getApt = function
if SS.debug then LOG("setAPT".debug)
SS.apt = SS.Utils.hasLib(SS.s, "aptclient.so")
if T(SS.apt) != "aptclientLib" then return
if SS.anon == null then SS.apt.update
if SS.anon == true then return LOG("Unable to update apt: Anonymous mode is enabled".warning)
if SS.apt.check_upgrade("/lib/aptclient.so") == true then LOG(("An update for "+"APT".cyan+" is available!").grey.sys)
f = SS.Utils.hasFile(SS.s, "metaxploit.so")
if f then; if SS.apt.check_upgrade(f.path) == true then; LOG(("An update for "+"Metaxploit".red+" is available").grey.sys);end if; end if;
end function
SS.checkApt = function
if SS.debug then LOG("checkApt".debug)
ret = []
if SS.apt == null then return
fi = SS.c.File("/lib/")
if fi == null or fi.is_folder == false then return
for f in fi.get_files
if SS.apt.check_upgrade(f.path) == true then ret.push(f.name)
end for
return ret
end function
SS.getDb = function(o=null)
if o == null then o = SS.c
if SS.debug then LOG("setDB".debug)
h = SS.Utils.hasFolder(o, "exploits")
if T(h) == "file" then
SS.dbe = h
else
LOG("Unable to locate exploit db".warning)
end if
p = SS.Utils.hasFolder(o, "rainbow")
if T(p) == "file" then
SS.dbh = p
SS.dbh = SS.dbh
else
LOG("Unable to locate password db".warning)
end if
if SS.cfg.user == "root" then p = "/root/"+SS.ccd+"/ss.libs/weak/init.so"
if SS.cfg.user != "root" then p = "/home/"+SS.cfg.user+"/"+SS.ccd+"/ss.libs/weak/init.so"
if SS.cfg.user != active_user then p = home_dir+"/"+SS.ccd+"/ss.libs/weak/init.so"
SS.dbl = SS.Utils.hasFolder(SS.s, "ss.logs")
if T(SS.dbl) != "file" then;LOG("Logger not loaded".grey.sys);else; LOG("Loaded logger: ".ok+SS.dbl.path); end if;
SS.cfg.libf = SS.Utils.hasFolder(SS.s, "ss.libs")
//SS.cfg.libf = SS.Utils.fileFromPath(o, parent_path(parent_path(p)))
if T(SS.cfg.libf) != "file" then;LOG("Library db not found".grey.sys);
else if T(parent_path(parent_path(parent_path(p)))+"/libs") == "file" then
if SS.og then LOG(("COMPATIBLITY CHECK -- RENAME ""libs"" TO: ""ss.libs""").warning)
if SS.c.File(parent_path(parent_path(parent_path(p)))+"/libs").rename("ss.libs").len < 1 then LOG("Library db renamed to ss.libs".ok) else LOG("An issue occured with renaming libs to ss.libs, check that out".warning)
end if
SS.cfg.libf = SS.Utils.fileFromPath(o, parent_path(parent_path(p)))
if T(SS.cfg.libf) != "file" then; LOG("Library cache: ".ok+SS.cfg.libf.path);
SS.cfg.libfs = SS.Utils.fileFromPath(o, SS.cfg.libf.path+"/strong")
if T(SS.cfg.libfs) != "file" then;LOG("Strong libs not loaded".grey.sys);else; LOG("Strong directory: ".ok+SS.cfg.libfs.path); end if;
SS.cfg.libfw = SS.Utils.fileFromPath(o, SS.cfg.libf.path+"/weak")
if T(SS.cfg.libfw) != "file" then;LOG("Weak libs not loaded".grey.sys);else; LOG("Weak directory : ".ok+SS.cfg.libfw.path); end if;
end if;
SS.cfg.wf = SS.Utils.fileFromPath(o, p)
if T(SS.cfg.wf) != "file" then;LOG("Weak lib not loaded".grey.sys);else; LOG("Loaded weak lib: ".ok+SS.cfg.wf.path);if SS.mx then;SS.cfg.wv=SS.mx.load(SS.cfg.wf.path).version;end if; end if;
if (SS.dbe == null and SS.dbh == null) then return LOG("Database was not configured".warning)
if SS.dbe != null then
for each in SS.dbe.get_folders
for f in each.get_files
SS.dbec = SS.dbec+f.get_content.split("\n").len
end for
end for
LOG("Exploit database configured successfully".ok)
end if
if SS.dbh != null then LOG("Hash database configured successfully".ok)
end function
SS.loadHashes = function(fo)
if not fo then return []
LOG("Pushing MD5 hashes into memory. . .".grey.sys)
_c = ["f1shb0wl:ff19407d8b4dbe5fa21d5d5248d26115"]
for fi in fo.get_files
if fi.is_binary then continue
for s in fi.get_content.split(NL)
if s.indexOf(":") == null then continue
_c.push(s)
end for
end for
SS.dbhl = _c
SS.dhc = _c.len
end function
SS.setCache = function(_)
SS.co.push(SEO)
SEO.cache
CEO.cache
FEO.cache
end function
SS.buildCo = function
// building custom object
//SS.CMD = @SS.CMD
//SS.CORE = @Core
//SS.UTILS = @Utils
SS.cfg.ip = SEO.ip
SS.cfg.lan = SEO.lan
end function
SS.welcome = function
LOG("".fill+NL+" . ".cyan+" __..._".red+NL+" ':' ".cyan+" ..-' o.".red+NL+" ___:____ |'\/'|".cyan+" .-' :".red+NL+" ,' `. \ / ".cyan+" _..' .'__..--<".red+NL+" | O \___/ | ".cyan+"...--"" '-.".red+NL+"~^~^~^~^~^~^~^~^~^~^~^~".cyan+"^~^~^~^~^~^~^~^~^~^~^~^~".red+NL+". /\".red+NL+" _____ ".cyan+"<color=#AA0000> _____ _ _ _ {.-}"+NL+" / ____| ".cyan+"<color=#AA0000>/ ____| | | | | ;_.-'\"+ NL +" | (___ ___ __ _".cyan+"<color=#AA0000>| (___ | |__ ___| | |{ _.}_"+ NL +" \___ \ / _ \/ _` |".cyan+"<color=#AA0000>\___ \| '_ \ / _ \ | | \.-' / `,"+ NL +" ____) | __/ (_| |".cyan+"<color=#AA0000>____) | | | | __/ | | \ | /"+ NL +" |_____/ \___|\__,_|".cyan+"<color=#AA0000>_____/|_| |_|\___|_|_| \ | ,/"+NL+". \|_/".red+NL+"<b>SeaShell</b>".cyan+" Version: ".lblue+SS.version.cyan.b+" made with ".lblue+SS.heart+NL+"".fill)
//LOG("".fill+NL+" . ".cyan+" __..._".red+NL+" ':' ".cyan+" ..-' o.".red+NL+" ___:____ |'\/'|".cyan+" .-' :".red+NL+" ,' `. \ / ".cyan+" _..' .'__..--<".red+NL+" | O \___/ | ".cyan+"...--"" '-.".red+NL+"~^~^~^~^~^~^~^~^~^~^~^~".cyan+"^~^~^~^~^~^~^~^~^~^~^~^~".red+NL+".<mark=#00BDFF>44444444444444444444444444444444444444444444<font=""LiberationSans SDF"">/\</font>".red+NL+" _____ ".cyan+"<color=#AA0000> _____ _ _ _ {.-}"+NL+" / ____| ".cyan+"<color=#AA0000>/ ____| | | | | ;_.-'\"+ NL +" | (___ ___ __ _".cyan+"<color=#AA0000>| (___ | |__ ___| | |{ _.}_"+ NL +" \___ \ / _ \/ _` |".cyan+"<color=#AA0000>\___ \| '_ \ / _ \ | | \.-' / `,"+ NL +" ____) | __/ (_| |".cyan+"<color=#AA0000>____) | | | | __/ | | \ | /"+ NL +" |_____/ \___|\__,_|".cyan+"<color=#AA0000>_____/|_| |_|\___|_|_| \ | ,/"+NL+". \|_/".red+NL+"<b>SeaShell</b>".cyan+" Version: ".lblue+SS.version.cyan.b+" made with ".lblue+SS.heart+NL+"".fill)
end function
SS.sail = function
if SEO == null then return LOG("error".error)
if params.len == 0 then return SS.surf_mode(SEO)
pIndex = params.indexOf(",")
if pIndex == null then return SS.surf_mode(SEO, SS.CMD.chain(params.join(" ")))
if SS.debug then LOG("surf:sail ".debug+params.join(" ").replace(",", ";"))
return SS.surf_mode(SEO, SS.CMD.chain(params.join(" ").replace(",", ";")))
end function
SS.surf_mode = function(o, args = null)
if get_shell.host_computer.public_ip != SS.cfg.ip then
SS.remote = true
l = "REMOTE".purple
else
SS.remote = false
l = "LOCAL".lblue
end if
LOG("".sys+"<b>~~~^~~^~".blue+"SURF"+"~".blue+"MODE".cyan+"~".blue+"[ ".cyan+"ENABLED".green+" ]".cyan+"~^~~^~~~".blue+"</i>".cap(l).blue)
SS.obj = o
res = null;
if args then
cmds = SS.CMD.chain(args)
if T(cmds) == "string" then
res = SS.CMD.invoke(o.o, args)
if res == "exit" then return
if res != null then SS.CMD.result(res)
else
for cmd in cmds
res = SS.CMD.invoke(o.o, cmd)
if res == "exit" then break
if res != null then SS.CMD.result(res)
end for
end if
end if
if res == "exit" then return
while 1
res = null;
input = SS.CMD.prompt(SS.obj)
if SS.debug then LOG("Input received: ".debug+input+" issa "+T(input))
if input == " " then continue
cmds = SS.CMD.chain(input)
if T(cmds) == "string" then
if SS.debug then LOG("sm_input: c1".debug)
res = SS.CMD.invoke(SS.obj.o, cmds)
if res == "exit" then break; if res != null then SS.CMD.result(res)
else if T(cmds) == "list" then
if SS.debug then LOG("SS:sm_input: c2".debug)
shouldbreak = null
for cmd in cmds
res = SS.CMD.invoke(SS.obj.o, cmd)
if res == "exit" then shouldbreak = true
if (res != null) and (res != "exit") then SS.CMD.result(res)
end for
if shouldbreak then break// this will prolly break stuff
else
LOG("sm_input: c3".debug)
end if
if SS.debug and res then LOG("response found")
end while
return LOG("".sys+"<b>~~~^~~^~".blue+"SURF"+"~".blue+"MODE".cyan+"~".blue+"[ ".cyan+"DISABLED".red+" ]".cyan+"~^~~^~~~".blue+"</i>".cap(l).blue)
end function; SS.env = function(_,__,___,____,_____,______,_______);SS.cfg.user = __;SS.cfg.burnmailacct = null;SS.cfg.burnmailpw = null;SS.cfg.mailacct = __+"@fishmail.net";SS.cfg.mailpw = md5("f1shbowl");if SS.cfg.mailacct == "" then SS.cfg.mailobj = mail_login(user_mail_address, ____) else SS.cfg.mailobj = mail_login(___, ____);SS.rsip = _____;SS.cfg.unsecure_pw = ______;SS.cfg.timestamp=_______;end function
SS.init = function(az,by,cx,dw,ev,fu,gt="TIWhateverYouLike2008NoScrubsTLC");
if az.len > 0 then; if (INPUT(("["+"Auth Required".red+"]").b+" ", true) != az) then EXIT("><> ><> ><>".red);end if; SS.env(az,by,cx,dw,ev,fu);
SS.getUserConfig// check user settings
SS.getLibConfig// load system libs
SS.getApt// check for apt
SS.getDb// check internal database
SS.setCache//sets certain env variables
SS.CMD.setCommands// set system commands
SS.buildCo// custom object mapping
SS.welcome//verbose
SS.sail// set sail
end function;
SS.quit = function(_)
if SS.debug then LOG("ss:quit ".debug+_)
SS.remote = false
if get_shell.host_computer.public_ip != SS.cfg.ip then SS.remote = true
c = null
if SS.co.len == 0 then return
if SS.co.len > 1 then SS.co.pop // remove the old index
c = SS.co[SS.co.len-1]
SS.obj = c
SS.cwd = c.home
return "exit"
end function
SS.cache = function(l, addr = null, lan = null)
if T(l) != "list" then return null
for i in l
if T(i) == "string" or T(i) == "number" then continue
if i isa SS.EO then
eo = i
else
eo = new SS.EO
if T(i) != "file" then
eo.map(i, addr,lan)
else
eo.map(i)
end if
end if
if T(eo.o) == "file" then
//eo.map(i, addr, lan)
SS.files.push(eo)
else if T(eo.o) == "computer" then
//eo.map(i)
if not eo.isCached then SS.computers.push(eo)
else
//eo.map(i)
if not eo.isCached then SS.shells.push(eo)
end if
end for
end function
SS.getMemCache = function(_, m, a = null)
if m == "-o" then return Core.objects(_, a)
if m == "-ns" then return Core.ns_handle(a)
if m == "-net" then return Core.net_handle(a)
return LOG("Invalid arguments: ".warning+"-o|-ns|-net [*action]")
end function
SS.getHost = function(a = null, t = null, p = null)
if a == "-i" then // DEPENDENCIES
h = "* "+"Script can perform all operations under cfg: ".grey+SS.cfg.label;
if not SS.mx or not SS.ccrypt then h = "* "+"Script is lacking essential libs: ".red
if SS.mx == null then h = h.s+"metaxploit.so"
if SS.crypto == null then h = h.s+"crypto.so"
if SS.dbe == null then; h = h+NL+"* "+"Script is missing exploit database".yellow; else ; h = h+NL+"* "+"Exploit database loaded".green;end if;
if SS.dbh == null then; h = h+NL+"* "+"Script is missing hash database".yellow;else ;h = h+NL+"* "+"Hash database loaded".green;end if;
if SS.cfg.dat == null then; h = h+NL+"* "+"Script is missing user config".yellow;else;h = h+NL+"* "+"User config loaded".green; end if;
if SS.cfg.macros == null then; h = h+NL+"* "+"Script is missing user macros".yellow;else;h = h+NL+"* "+"User macros loaded".green; end if;
LOG(h)
else if a == "-e" or a == "-h" then //SET
return SS.setHost(t, a, p)
else if ["-u", "-m", "-ccd", "-build", "-install"].indexOf(a) != null then
return SS.setUserConfig(a, t, p)
end if
if SS.dbhl.len == 0 and T(SS.dbh) == "file" then SS.loadHashes(SS.dbh)
_d = [
"SeaShell".title("FFFFFF", 20),
"Version".wrap.lblue.cap(SS.buildv).lblue,
"Uptime".wrap.lblue.cap(SS.Date.up(time)).lblue,
"Config".wrap.lblue.cap(SS.cfg.label, null, true).lblue,
"Cache".wrap.lblue.cap(SS.ccd).lblue,
"User".wrap.lblue.cap(SS.cfg.user).lblue,
"Active".wrap.lblue.cap(SS.Utils.user(SS.c).isRoot(SS.c)).lblue,
"Exploits".wrap.lblue.cap(SS.dbec).lblue,
"Hashes".wrap.lblue.cap(SS.dbhl.len).lblue,
]
if TW then _d.push "* Set during SeaShell build".grey.i
for d in _d ;LOG(d); end for;
if SS.mx != null then
LOG("Libraries".title("FFFFFF", 20))
for f in SS.c.File("/lib/").get_files
l = SS.mx.load(f.path)
if T(l) != "MetaLib" then continue
LOG(f.name[:-3].wrap("00BDFF").white.cap(l.version.lblue).white)
end for
end if
_d = [
"USER".title("FFFFFF", 20),
"Anonymous".wrap("A5A5A5").blue.cap(SS.Utils.ison(SS.anon)).blue,
"Old Art".wrap("A5A5A5").blue.cap(SS.Utils.ison(SS.og)).blue,
"Debug".wrap("A5A5A5").blue.cap(SS.Utils.ison(SS.debug)).blue,
"HackIp".wrap("A5A5A5").blue.cap(SS.cfg.hackip).blue,
"RepoIp".wrap("A5A5A5").blue.cap(SS.cfg.repoip).blue,
"API".wrap("A5A5A5").blue.cap(SS.cfg.api1).blue,
"API1".wrap("A5A5A5").blue.cap(SS.cfg.api2).blue,
"API2".wrap("A5A5A5").blue.cap(SS.cfg.api3).blue,
"WEAK".wrap("A5A5A5").blue.cap(T(SS.cfg.wf)).blue,
"WEAK1".wrap("A5A5A5").blue.cap(SS.cfg.wa).blue,
"WEAK2".wrap("A5A5A5").blue.cap(SS.cfg.wm).blue,
]
if TW then _d.push"* Settings can be changed in: ".grey.i+SS.ccd+NL+"* in resource:".grey+" ss.dat"+" or see -h -cfg".grey.i
for d in _d ;LOG(d); end for;
end function
SS.setHost = function(a, t, p = null)// act type path
if a == null then return LOG("Specify: -e|-h")
if p == null then
p = SS.cwd
else if p[0] != "/" then
p = SS.Utils.path(SS.cwd)
end if
if t == "-e" then
if a == "-b" then return SS.EXP.bdb(SS.c, p, SS.ccd)
//if t == "-d" then return SS.EXP.ddb(SS.c, p)
else if t == "-h" then
if a == "-b" then return SS.MD5.bdb(SS.c, p, SS.ccd)
if a == "-p" then return SS.MD5.paste(SS.s)
//if t == "-d" then return SS.MD5.ddb(SS.c, p)
end if
return LOG("Invalid arguments [type] [action]")
end function
SS.setUserConfig = function(act, flag=null, p = null)
helpwords = ["-ccd", "-install", "-install", "-build"]
if (SS.cfg.i == null) and (helpwords.indexOf(act) == null) then
return LOG("User config not found, use force flag -install to build everything, -ccd for cache".warning)
else if helpwords.indexOf(act) != null then
if act == "-ccd" then SS.c.create_folder(HOME, SS.ccd)
SS.cfg.i = SS.Utils.fileFromPath(SS.f, HOME+"/"+SS.ccd)
if act != "-ccd" then return SS.buildEntireUserCache(flag, SS.c)
end if
if T(SS.cfg.i) != "file" then return LOG("An error occured finding the cache".warning)
item = null
s = null
run = null
if act == "-u" then// userconfig
s = "User Config"
f = SS.cfg.dat
if flag == "-b" then
run = @SS["setDat"]
p = "ss.dat"
d = "anonymousMode=0"+NL+"debugMode=0"+NL+"oldArtMode=1"+NL+"tutorialMode=0"+NL+"hackShopIp=214.85.237.165"+NL+"weakMemZone=null"+NL+"weakMemAddr=null"+NL+"hackRepoIp=214.85.237.165"+NL+"hackRepoWeakLib=null"+NL+"apiIp=150.74.29.50"+NL+"apiMemZone=0xF8E54A6"+NL+"apiMemVal=becolo"+NL+"apiPort=22"+NL+"apiAuth=2008TLCNoScrubs"+NL+"apiToken=null"
else
return SS.cfgDat(flag, p)
end if
else if act == "-m" then // usermacros
s = "User Macros"
f = SS.cfg.macros
run = @SS["setMacros"]
p = "ss.macros"
d = "[MACRO NAME] [SS.CMD NAME] [ARGUMENTS/PLACEHOLDER] ; [SS.CMD NAME] [ARGUMENTS/PLACEHOLDER] *to use placeholders use format {1}*"+NL+"EXAMPLE ls ; cd {1} --> @EXAMPLE home"
else if act == "-ccd" then // user ccd
s = "User Cache"
f = SS.cfg.i
p = SS.ccd
else
return LOG("Invalid arguments".warning)
end if
dat = null
if f == null then
r = SS.c.touch(SS.cfg.i.path, p)
if T(r) == "string" then return LOG(r.warning+" "+p)
f = SS.c.File(SS.cfg.i.path+"/"+p)
if f == null then return LOG("System file error".warning)
r = f.set_content(d)
wait(0.1)
if T(r) == "string" then return LOG(r.warning)
LOG("System file created: ".ok+p)
end if
dat = f.get_content
return run(dat)
end function
SS.setDat = function(data)
if SS.debug then LOG("SS:setDat: ".debug+data)
if data.len == 0 then return LOG("No content in user.dat".warning)
if data.indexOf(NL) == null then return LOG("Data not found")
s = data.split(NL)
if s.len == 0 then return LOG("File is empty".warning)
for i in s
if i.len < 1 then continue
if i.indexOf("=") == null then continue
p = i.split("=")
isN = (p[1] == "null")
if p[0] == "anonymousMode" then
if p[1].to_int == 1 then SS.anon = true else SS.anon = false
else if p[0] == "debugMode" then
if p[1].to_int == 1 then SS.debug = true else SS.debug = false
else if p[0] == "oldArtMode" then
if p[1].to_int == 1 then SS.og = true else SS.og = false
else if p[0] == "tutorialMode" then
if p[1].to_int == 1 then SS.training_wheels = true else SS.training_wheels = false
else if p[0] == "hackShopIp" then
if isN then SS.cfg.hackip = null else SS.cfg.hackip = p[1]
else if p[0] == "hackRepoIp" then
if p[1] == "null" then SS.cfg.repoip = null else SS.cfg.repoip = p[1]
else if p[0] == "weakMemZone" then
if isN then SS.cfg.wm = null else SS.cfg.wm = p[1]
else if p[0] == "weakMemAddr" then
if isN then SS.cfg.wa = null else SS.cfg.wa = p[1]
else if p[0] == "apiIp" then
if isN then SS.API.ip = null else SS.API.ip = p[1]
else if p[0] == "apiMemZone" then
if isN then SS.API.mz = null else SS.API.mz = p[1]
else if p[0] == "apiMemVal" then
if isN then SS.API.ma = null else SS.API.ma = p[1]
else if p[0] == "apiPort" then
if isN then SS.API.p = null else SS.API.p = p[1].to_int
else if p[0] == "apiAuth" then
if isN then SS.API.ai = null else SS.API.ai = p[1]
else if p[0] == "apiToken" then
if isN then SS.API.ar = null else SS.API.ar = p[1]
end if
end for
end function
SS.cfgDat = function(item, change)
if not SS.cfg.dat then return LOG("User not configured on this machine")
data = SS.cfg.dat.get_content
if data.len < 10 then return LOG("File corrupted".error)
data = data.split(NL)
if data == null or data.len == 0 then return LOG("File corrupted".error)
c = 0; isn = null; edit = null
for i in data
p = i.split("=")
if p == null then continue
if item == "anon" and p[0] == "anonymousMode" then
label = "anonymous mode"
isn = true
edit = i; break;
else if item == "dev" and p[0] == "debugMode" then
label = "debug mode"
isn = true
edit = i; break;
else if item == "art" and p[0] == "oldArtMode" then
label = "original art mode"
isn = true
edit = i; break;
else if item == "api1" and p[0] == "apiIp" then
label = "api ip"
edit = i; break;
else if item == "api2" and p[0] == "apiMemZone" then
label = "api memzone"
edit = i; break;
else if item == "api3" and p[0] == "apiMemVal" then
label = "api memval"
edit = i; break;
else if item == "weak4" and p[0] == "apiPort" then
label = "api port"
edit=i;break
else if item == "hackip" and p[0] == "hackShopIp" then
label = "hackshop ip"
edit = i; break;
else if item == "repoip" and p[0] == "hackRepoIp" then
label = "repository ip"
edit = i; break;
else if item == "weak1" and p[0] == "weakMemZone" then
label = "weak library memory zone"
edit = i; break;
else if item == "weak2" and p[0] == "weakMemAddr" then
label = "weak library memory address"
edit = i; break;
end if
c = c+1
end for
data.remove(c-1);
if edit == null then return LOG("Incorrect setting".warning)
if isn then
change = change.to_int
if change != 0 and change != 1 then return LOG("Invalid setting option".warning)
label2 = SS.Utils.ison(change)
edit = edit.trim
edit = edit[:-1]+str(change)
else
label2 = change
ep = edit.split("=")
edit = ep[0]+"="+change
end if
data.push(edit)
data = data.join
data = data.trim
data = data.replace(" ", NL)
if SS.debug then LOG("Data set: ".debug+data)
save = SS.cfg.dat.set_content(data)
if T(save) == "string" then return LOG(save.warning)
LOG("Setting saved: ".ok+label+" --> ".white+label2)
return self.setDat(data)
end function
// TODO: set macro function
SS.setMacros = function(data)
//LOG(data)
return LOG("wip".warning)
end function
SS.isMacro = function
for m in SS.macros
end for
end function
///==================== CORE() ========================////
Core = {}
Core["anon"] = function(save = null)
t = true; s = "ENABLED".green;
if SS.anon == true then
t = false; s = "DISABLED".red;
end if
if save then SS.cfgDat("anon", str(t))
LOG("Anonymous mode: ".sys+s);SS.anon = t;
end function
Core["dev"] = function(save = null)
t=true; s="ENABLED".green;
if SS.debug == true then
t=false;s="DISABLED".red;
end if
if save then SS.cfgDat("dev", str(t))
LOG("Debug mode: ".sys+s);SS.debug = t;
end function
Core["add"] = function(o)
if T(o) == "shell" or T(o) == "ftpshell" then return SS.shells.push(o)
if T(o) == "computer" then return SS.computers.push(o)
return SS.files.push(o)
end function
Core["objects"] = function(_, p = null)
objects = [SS.shells, SS.computers, SS.files]
if p == "-c" then
SS.shells = [SEO] // our collection of global shell objects
SS.computers = [CEO] // our collection of global computer objects
SS.files = [FEO] // our collection of global file objects
return
end if
ret = null
s_l = [];c_l=[];f_l=[];
for s in SS.shells; s_l.push(s.info); end for;
for c in SS.computers; c_l.push(c.info); end for;
for f in SS.files; f_l.push(f.info); end for;
selection = SS.Utils.menu("Object Cache", [
{"name": " Shells ".wrap("FFFFFF", 15).cap(str(SS.shells.len).lblue.b), "options": s_l },
{"name": " Computers ".wrap("FFFFFF", 15).cap(str(SS.computers.len).lblue.b), "options": c_l},
{"name": " Files ".wrap("FFFFFF", 15).cap(str(SS.files.len).lblue.b), "options":f_l},
])
if selection[0] == 0 and (selection[1]) == 0 then return null
s_m = selection[0]
s_o = selection[1]
if p == "-e" then// EDIT
UI = INPUT(["Remove from cache"].select).to_int
if UI == 0 then return
if UI == 1 then return objects[s_m].remove(s_o)
end if
if s_m == -1 then return null
if SS.debug then LOG("Passing to surf mode: ".ok+objects[s_m][s_o].info)
return objects[s_m][s_o]
end function
Core["cd"] = function(o, p = null)
if SS.debug then LOG("Core:cd ".debug+T(o)+" "+p)
isF = null; if T(o) == "file" then isF = true;
if isF then
cdur = SS.Utils.fileFromPath(o, SS.cwd)
else
o = SS.Utils.ds(o, "computer")
cdur = o.File(SS.cwd)
if not cdur then cdur = o.File(SS.Utils.goHome(o))
end if
dir = null
if not cdur then return LOG("current directory error".error)
if p == null or p.len < 1 then
u = SS.Utils.user(o)
if T(o) == "file" then
dir = SS.Utils.fileFromPath(o, SS.Utils.goHome(o, u))
else if u == "root" and o.File("/root") != null then
dir = o.File("/root")
else if u != "root" and o.File("/home/"+u) != null then
dir = o.File("/home/"+u)
end if
else if p == ".." then
dir = cdur.parent
else if p == "." then
if cdur.parent then dir = cdur.parent.parent
else if p == "/" then
if isF then
dir = SS.Utils.rootFromFile(o)
else
dir = o.File("/")
end if
else if p[0] != "/" and cdur.name == "/" then
if isF then
dir = SS.Utils.fileFromPath(o, "/"+p)
else
dir = o.File("/"+p)
end if
else if p[0] != "/" and cdur.name != "/" then
if isF then
dir = SS.Utils.fileFromPath(o, cdur.path+"/"+p)
else
dir = o.File(cdur.path+"/"+p)
end if
else
if isF then
dir = SS.Utils.fileFromPath(o, p)
else
dir = o.File(p)
end if
end if
if dir == null then return LOG("No directory found: ".warning+p)
SS.cwd = dir.path
end function
Core["pwd"] = function
LOG("Current directory: ".sys+SS.cwd.white)
end function
Core["me"] = function(o, act=null, p2=null)