-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommands.src
2080 lines (1718 loc) · 76.2 KB
/
commands.src
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
//
// Marinette's commands
////////////////////////////////////////////////////////////
// Any session type
////////////////////////////////////////////////////////////
command "help", ["h", "?"], Const.any, Messages.HelpEntryHelp, function(arguments)
commands = Helps.indexes
if arguments.len != 0 then commands = arguments
foundHelps = {}
for command in commands
if Commands.indexes.indexOf(command) == null then
for kv in Aliases
if kv.value.indexOf(command) != null then
command = kv.key
break
end if
end for
if Commands.indexes.indexOf(command) == null then
continue
end if
end if
if Aliases.indexes.indexOf(command) != null then
aliases = Aliases[command]
commands = [command] + aliases
else
commands = [command]
end if
commands = commands.join(", ")
categories = Messages.HelpUndeterminedDescription
args = Messages.HelpNoArguments
description = Messages.HelpUndeterminedDescription
if Helps.indexes.indexOf(command) != null then
help = Helps[command]
parts = help.split(" - ")
if parts.len == 1 then
description = parts[0]
else if parts.len == 2 then
categories = parts[0]
description = parts[1]
else if parts.len == 3 then
categories = parts[0]
args = parts[1]
description = parts[2]
end if
end if
help = {
"commands": commands,
"args": args,
"description": description,
}
if foundHelps.indexes.indexOf(categories) == null then foundHelps[categories] = []
foundHelps[categories].push(help)
end for
printCategories = function(categories)
print(primary("<b><--"+categories+"--></b>"))
for help in foundHelps[categories]
print(primary(help.commands)+secondary(" - "+help.args+" - "+help.description))
end for
end function
if foundHelps.len > 0 then
categories = removeDuplicates(foundHelps.indexes)
for category in categories
foundHelps[category].sort("commands")
end for
typePredicate = function(iItem, jItem)
priority = {
Messages.SessionTypeAny: "A"*32,
Messages.SessionTypeHost: "A"*31+"B",
Messages.SessionTypeShell: "A"*31+"C",
Messages.SessionTypeComputer: "A"*31+"D",
Messages.SessionTypeFile: "A"*31+"E",
Messages.HelpCategoryPlugins: "A"*31+"F",
Messages.HelpUndeterminedDescription: "A"*31+"G",
}
if priority.indexes.indexOf(iItem) == null then priority[iItem] = iItem
if priority.indexes.indexOf(jItem) == null then priority[jItem] = jItem
return priority[iItem] > priority[jItem]
end function
mergeSort(categories, @typePredicate)
last = categories.pop
for category in categories
printCategories(category)
print(" ")
end for
printCategories(last)
else
Console.error(Messages.ErrorNoHelpEntries)
end if
end function
command "credits", [], Const.any, Messages.HelpEntryLicense, function(arguments)
Conditions.arguments(arguments, 0)
contributors = [
"Kurouzu", "Joe Strout", "Clover", "Roupi",
"Finko42", "Ariavne", "Guest", "Simonize", "Olipro",
"Volk", "Plu70", "Rocketorbit", "Darkie", "Ayecue", "Wyatt",
]
print(primary(Messages.SpecialThanksAndCredits))
print(" ")
print(primary(contributors.join(", ")))
print(" ")
print(primary(Messages.YouAreAllAwesome+" <3"))
end function
command "exit", ["quit", "q"], Const.any, Messages.HelpEntryQuit, function(arguments)
Conditions.arguments(arguments, 0)
Console.log(Messages.LogThanksAndQuit)
exit
end function
command "cls", ["clear"], Const.any, Messages.HelpEntryClear, function(arguments)
Conditions.arguments(arguments, 0)
clear_screen
end function
command "sessions", [], Const.any, Messages.HelpEntrySm, function(arguments)
Conditions.argumentsMoreThan(arguments, 0)
command = arguments.pull
if "add".indexOf(command) == 0 and arguments.len != 0 then return Conditions.arguments(arguments, 1)
if "delete".indexOf(command) == 0 and arguments.len == 0 then return Conditions.argumentsMoreThan(arguments, 1)
if "use".indexOf(command) == 0 and arguments.len != 1 then return Conditions.arguments(arguments, 2)
if "look".indexOf(command) == 0 and arguments.len != 0 then return Conditions.arguments(arguments, 1)
if "add".indexOf(command) == 0 then
SessionsHelpers.add(Intrinsics)
Console.log(Messages.LogSuccessfullSessionsUpdate)
else if "delete".indexOf(command) == 0 then
shownIds = deepCopy(arguments)
i = 0; while i < arguments.len; i = i + 1
id = arguments[i-1]
if id isa string or not SessionsHelpers.delete(id) then
Console.error(Messages.ErrorIncorrectSessionId)
else
j = i-1; while j < arguments.len; j = j + 1
arguments[j-1] = arguments[j-1] - 1
end while
Console.log(Messages.LogSuccessfullSessionDeletion, {"ID": shownIds[i-1]})
end if
end while
else if "use".indexOf(command) == 0 then
id = arguments[0]
if id isa string or not SessionsHelpers.get(id) then return Console.error(Messages.ErrorIncorrectSessionId)
globals.Intrinsics = SessionsHelpers.get(id)
Console.log(Messages.LogSuccessfullSessionLoad)
else if "look".indexOf(command) == 0 then
output = Messages.SmHeader
i = 1
while SessionsHelpers.get(i) != null
intrinsics = SessionsHelpers.get(i)
output = output+char(10)+(i)+" "+SessionsHelpers.generateSessionName(intrinsics)
i = i + 1
end while
print(formatColumnsColored(output, Theme.miscPrimary, Theme.miscSecondary))
else
return Console.error(Messages.ErrorUnknownArguments)
end if
end function
command "theme", [], Const.any, Messages.HelpEntryTheme, function(arguments)
Conditions.arguments(arguments, 0)
asciiArt = [
" __ __ _ _ _ ",
" | \/ |__ _ _ _(_)_ _ ___| |_| |_ ___ ",
" | |\/| / _` | '_| | ' \/ -_) _| _/ -_)",
" |_| |_\__,_|_| |_|_||_\___|\__|\__\___|",
" ",
]
Console.asciiArt(asciiArt)
Console.log(randomString(40))
Console.warning(randomString(40))
Console.error(randomString(40))
print(" ")
table = [
randomString(10)+" "+randomString(10)+" "+randomString(10)+" "+randomString(10),
randomString(11)+" "+randomString(11)+" "+randomString(11)+" "+randomString(11),
randomString(12)+" "+randomString(12)+" "+randomString(12)+" "+randomString(12),
].join(char(10))
print(formatColumnsColored(table, Theme.miscPrimary, Theme.miscSecondary))
end function
command "hash", [], Const.any, Messages.HelpEntryHashcrack, function(arguments)
Conditions.argumentsMoreThan(arguments, 0)
Conditions.crypto
crypto = Libs.crypto
Console.log(Messages.LogHashCracking)
for md5hash in fmap(@str, arguments)
name = md5hash
toCrack = md5hash
if md5hash.indexOf(":") != null then
parts = md5hash.split(":")
name = parts[0]
toCrack = parts[1]
end if
result = decipherPassword(crypto, toCrack)
if not result then
Console.error(replaceF(Messages.ErrorUncrackableHash, {"HASH": name}))
else
Console.log(replaceF(Messages.LogSuccessfullHashCracking, {"HASH": name, "PASSWORD": result}))
end if
end for
end function
command "whois", ["wi"], Const.any, Messages.HelpEntryWhois, function(arguments)
Conditions.network
whoisOne = function(addr)
router = getNetworkNode(addr)
if not router then return Console.error(Messages.ErrorIncorrectNetworkAddress)
addr = router.public_ip
domain = getDomainName(addr)
email = getDomainEmailAddress(addr)
phone = getDomainPhoneNumber(addr)
admin = getAdministrativeContact(addr)
if not domain or not admin or not email or not phone then return Console.error(Messages.ErrorFailedWhoisLookup)
Console.log(replaceF(Messages.LogWhoisLookup, {"ADDRESS": addr}))
lines = [
"<color="+Theme.miscPrimary+">"+Messages.WhoisDomain+" - <color="+Theme.miscSecondary+">"+domain,
"<color="+Theme.miscPrimary+">"+Messages.WhoisEmail+" - <color="+Theme.miscSecondary+">"+email,
"<color="+Theme.miscPrimary+">"+Messages.WhoisPhoneNumber+" - <color="+Theme.miscSecondary+">"+phone,
"<color="+Theme.miscPrimary+">"+Messages.WhoisAdministrator+" - <color="+Theme.miscSecondary+">"+admin,
]
if whois(addr).indexOf("[Neurobox Network]") != null then lines.push(primary("[Neurobox Network]"))
print(lines.join(char(10)))
end function
if arguments.len == 0 then
whoisOne(getNetworkNode.public_ip)
else
arguments = fmap(@str, arguments)
last = arguments.pop
for path in arguments
whoisOne(path)
print(" ")
end for
whoisOne(last)
end if
end function
command "meow", ["mpm"], Const.any, Messages.HelpEntryMeow, function(arguments)
Conditions.argumentsMoreThan(arguments, 1)
Conditions.network
Conditions.apt
fd = Intrinsics.file
apt = Libs.apt
command = str(arguments.pull)
if "add".indexOf(command) == 0 then
for repo in fmap(@str, arguments)
parts = repo.split(":")
if parts.len > 2 then return Console.error(Messages.ErrorIncorrectRepositoryAddress)
address = parts[0]
port = 1542
if parts.len == 2 then port = parts[1].to_int
router = getNetworkNode(address)
if not router then return Console.error(Messages.ErrorIncorrectNodeAddress)
address = router.public_ip
if not port isa number then return Console.error(Messages.ErrorCouldNotAccessSuchPort)
result = apt.add_repo(address, port)
if result and result isa string then
Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "add_repo", "ERROR": result}))
else
Console.log(replaceF(Messages.LogSuccessfullRepositoryAddition, {"ADDRESS": address, "PORT": port}))
end if
end for
else if "delete".indexOf(command) == 0 then
for address in fmap(@str, arguments)
router = getNetworkNode(address)
if not router then return Console.error(Messages.ErrorIncorrectNodeAddress)
address = router.public_ip
result = apt.del_repo(address)
if result and result isa string then
Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "del_repo", "ERROR": result}))
else
Console.log(replaceF(Messages.LogSuccessfullRepositoryDeletion, {"ADDRESS": address}))
end if
end for
else if "download".indexOf(command) == 0 then
apt.update
for package in fmap(@str, arguments)
result = apt.install(package)
if result and result isa string then
Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "install", "ERROR": result}))
else
Console.log(replaceF(Messages.LogSuccessfullPackageInstallation, {"PACKAGE": package}))
end if
end for
else if "look".indexOf(command) == 0 then
apt.update
for address in fmap(@str, arguments)
router = getNetworkNode(address)
if not router then return Console.error(Messages.ErrorIncorrectNodeAddress)
address = router.public_ip
result = apt.show(address)
if result.indexOf(" repository not found") then
Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "show", "ERROR": result}))
else
Console.log(replaceF(Messages.LogContentsOfRepository, {"ADDRESS": address}))
lines = result.split(char(10))
lines.pop
for line in lines
print("<color="+Theme.miscPrimary+">"+line)
end for
end if
end for
else
return Console.error(Messages.ErrorUnknownArguments)
end if
end function
command "pktmon", [], Const.any, Messages.HelpEntryPktmon, function(arguments)
Conditions.argumentsFewerThan(arguments, 2)
Conditions.network
Conditions.metaxploit
packets = 1
metaxploit = Libs.metaxploit
if arguments.len == 1 then packets = arguments[0]
if not packets isa number then return Console.error(Messages.ErrorUnknownArguments)
Console.log(Messages.LogStartingSniffing)
i = 0; while i < packets; i = i + 1
desyncFix
result = metaxploit.sniffer(true)
if not result then return Console.error(Messages.ErrorUnknown)
lines = result.trim.split(char(10))
lines = lines[2:]
source = lines.pull.replace("<b>Source:</b> ", "")
destination = lines.pull.replace("<b>Destination:</b> ", "")
port = lines.pull.replace("<b>Protocol:</b> ", "")
user = escape(lines.pull.replace("<b>USER:</b> ", ""))
password = lines.join("\n")
if password.indexOf("<b>PASSWORD[encrypted]:</b> ") == 0 then
prefix = "O"
password = password["<b>PASSWORD[encrypted]:</b> ".len:]
else
prefix = "X"
password = password["<b>PASSWORD:</b> ".len:]
end if
password = escape(password)
Console.log(prefix+": "+destination+":"+port+" <- "+source+" - "+user+"@"+password)
end while
end function
//
// Thanks Ariavne for allowing me to use their nickname as a tool name <3
command "ariadne", ["aria"], Const.any, Messages.HelpEntryAriadne, function(arguments)
Conditions.metaxploit
fd = Intrinsics.file
metaxploit = Libs.metaxploit
while fd.parent
fd = fd.parent
end while
Console.log(Messages.LogSearchingForLocalLibraries)
metalibs = []
files = [] + fd.get_folders + fd.get_files
while files.len > 0
fd = files.pull
if fd.is_folder then
files = fd.get_folders + fd.get_files + files
continue
end if
if not fd.is_binary then continue
metalib = metaxploit.load(fd.path)
if not metalib then continue
isAlreadyFound = false
for foundLib in metalibs
if foundLib.lib_name == metalib.lib_name and foundLib.version == metalib.version then
isAlreadyFound = true
break
end if
end for
if not isAlreadyFound then metalibs.push(metalib)
end while
Console.log(Messages.LogScanningLocalLibraries, {"AMOUNT": metalibs.len})
exploits = []
for metalib in metalibs
memory = scanLibrary(metaxploit, metalib)
for address in memory
vulners = scanMemoryAddress(metaxploit, metalib, address)
exploits.push({"metalib": metalib, "address": address, "vulners": vulners})
end for
end for
if exploits.len == 0 then return Console.error(Messages.ErrorNoExploitsInScannedLibraries)
Console.log(Messages.LogExploitingVulnerabilities)
results = []
for exploit in exploits
for vulner in exploit.vulners
ofArgs = [null]
if arguments.len > 0 then ofArgs = ofArgs + fmap(@str, arguments)
ofArgs = removeDuplicates(ofArgs)
for ofArg in ofArgs
result = bufferOverflow(exploit.metalib, exploit.address, vulner.value, ofArg)
if result == null then continue
object = result
result = {
"publicAddr": Intrinsics.publicAddress,
"localAddr": Intrinsics.localAddress,
"metalib": exploit.metalib,
"address": exploit.address,
"vulner": vulner,
"ofArg": null,
"object": object,
}
if ofArg != null then result.ofArg = ofArg
results.push(result)
end for
end for
end for
if results.len == 0 then return Console.error(Messages.ErrorNoVulnerabilitiesInLibraries)
Console.log(Messages.LogAddingNewSessions)
for result in results
object = result.object
type = typeof(object)
if object isa string or object isa number then continue
intrinsics = deepCopy(Intrinsics)
intrinsics.shell = null
intrinsics.computer = null
intrinsics.file = null
intrinsics.publicAddress = result.publicAddr
intrinsics.localAddress = result.localAddr
intrinsics.isConnectionRemote = true
if type == "shell" then
intrinsics.shell = object
intrinsics.computer = intrinsics.shell.host_computer
intrinsics.file = intrinsics.computer.File("/")
else if type == "computer" then
intrinsics.computer = object
intrinsics.file = intrinsics.computer.File("/")
else if type == "file" then
fd = object
while fd.parent
fd = fd.parent
end while
intrinsics.file = fd
end if
SessionsHelpers.add(intrinsics)
end for
Console.log(Messages.LogCompilingExploitResults)
outputs = {}
for result in results
library = result.metalib.lib_name
version = result.metalib.version
address = result.address
vulner = result.vulner.value
ofArg = ""
object = result.object
type = typeof(object)
if result.ofArg then ofArg = result.ofArg
key = [library,version,ofArg].join(" ")
if outputs.indexes.indexOf(key) == null then
outputs[key] = [address,vulner,type].join(" ")
else
outputs[key] = outputs[key]+char(10)+[address,vulner,type].join(" ")
end if
end for
if outputs.len == 0 then return Console.error(Messages.ErrorNoUsefullExploits)
Console.log(Messages.LogUsefullExploits)
counter = 0
for kv in outputs
Console.log(Messages.LogVulnerabilitesIn, {"LIBRARY": kv.key})
output = Messages.ExploitsHeader+char(10)+kv.value
print(formatColumnsColored(output, Theme.miscPrimary, Theme.miscSecondary))
counter = counter + 1
if counter != outputs.len then print(" ")
end for
Console.log(Messages.LogSuccessfullSessionsUpdate)
end function
command "nemesis", ["ns"], Const.any, Messages.HelpEntryNemesis, function(arguments)
Conditions.argumentsMoreThan(arguments, 2)
Conditions.network
Conditions.metaxploit
metaxploit = Libs.metaxploit
addr = str(arguments.pull)
argLocAddr = str(arguments.pull)
argPort = arguments.pull
router = getNetworkNode(addr)
if not router then return Console.error(Messages.ErrorIncorrectNodeAddress)
addr = router.public_ip
if isNodeLocallyAccessible(router) then addr = router.local_ip
targets = []
if isNodeLocallyAccessible(router) then
for port in getNetworkPorts(addr)
target = {
"publicAddr": router.public_ip,
"localAddr": port.local.get_lan_ip,
"ip": port.local.get_lan_ip,
"port": port.local.port_number,
"portObject": port,
}
targets.push(target)
end for
for localAddr in router.devices_lan_ip
node = null
isRouter = false
if isNodeLocallyAccessible(router) then
node = getNetworkNode(localAddr)
if node then isRouter = true
end if
if isRouter then
target = {
"publicAddr": node.public_ip,
"localAddr": localAddr,
"ip": localAddr,
"port": 0,
"portObject": null,
}
targets.push(target)
end if
end for
else
for port in getNetworkPorts(addr)
if not port.public then continue
target = {
"publicAddr": router.public_ip,
"localAddr": port.public.get_lan_ip,
"ip": router.public_ip,
"port": port.public.port_number,
"portObject": port,
}
targets.push(target)
end for
target = {
"publicAddr": router.public_ip,
"localAddr": router.local_ip,
"ip": router.public_ip,
"port": 0,
"portObject": null,
}
targets.push(target)
end if
targets = removeDuplicates(targets)
libraries = []
for target in targets
if "all".indexOf(argLocAddr) != 0 and target.localAddr != argLocAddr then continue
if "all".indexOf(argPort) != 0 and target.port != argPort then continue
netSession = metaxploit.net_use(target.ip, target.port)
if not netSession then continue
metalib = netSession.dump_lib
port = target.port
if target.portObject then port = target.portObject.local.port_number
library = {
"publicAddr": target.publicAddr,
"localAddr": target.localAddr,
"port": port,
"metalib": metalib,
}
libraries.push(library)
end for
Console.log(Messages.LogScanningRemoteLibraries, {"AMOUNT": libraries.len})
exploits = []
for library in libraries
memory = scanLibrary(metaxploit, library.metalib)
for address in memory
vulners = scanMemoryAddress(metaxploit, library.metalib, address)
exploit = {
"publicAddr": library.publicAddr,
"localAddr": library.localAddr,
"port": library.port,
"metalib": library.metalib,
"address": address,
"vulners": vulners,
}
exploits.push(exploit)
end for
end for
if exploits.len == 0 then return Console.error(Messages.ErrorNoExploitsInScannedLibraries)
Console.log(Messages.LogExploitingVulnerabilities)
results = []
for exploit in exploits
for vulner in exploit.vulners
ofArgs = [null]
if arguments.len > 0 then ofArgs = ofArgs + fmap(@str, arguments)
ofArgs = removeDuplicates(ofArgs)
for ofArg in ofArgs
result = bufferOverflow(exploit.metalib, exploit.address, vulner.value, ofArg)
if result == null then continue
object = result
result = {
"publicAddr": exploit.publicAddr,
"localAddr": exploit.localAddr,
"port": exploit.port,
"metalib": exploit.metalib,
"address": exploit.address,
"vulner": vulner,
"ofArg": null,
"object": object,
}
if ofArg != null then result.ofArg = ofArg
results.push(result)
end for
end for
end for
if results.len == 0 then return Console.error(Messages.ErrorNoVulnerabilitiesInLibraries)
Console.log(Messages.LogAddingNewSessions)
for result in results
object = result.object
type = typeof(object)
if object isa string or object isa number then continue
intrinsics = deepCopy(Intrinsics)
intrinsics.shell = null
intrinsics.computer = null
intrinsics.file = null
intrinsics.publicAddress = result.publicAddr
intrinsics.localAddress = result.localAddr
intrinsics.port = result.port
intrinsics.isConnectionRemote = true
if type == "shell" then
intrinsics.shell = object
intrinsics.computer = intrinsics.shell.host_computer
intrinsics.file = intrinsics.computer.File("/")
else if type == "computer" then
intrinsics.computer = object
intrinsics.file = intrinsics.computer.File("/")
else if type == "file" then
fd = object
while fd.parent
fd = fd.parent
end while
intrinsics.file = fd
end if
ofArgIsAddress = result.ofArg != null and is_valid_ip(result.ofArg)
typeIsComputer = type == "computer"
targetIsRouter = result.localAddr[-1] == "1"
targetNotOfArg = result.ofArg != result.localAddr
if ofArgIsAddress and typeIsComputer and targetIsRouter and targetNotOfArg then intrinsics.localAddress = result.ofArg
SessionsHelpers.add(intrinsics)
end for
Console.log(Messages.LogCompilingExploitResults)
outputs = {}
for result in results
library = result.metalib.lib_name
version = result.metalib.version
address = result.address
vulner = result.vulner.value
ofArg = ""
object = result.object
type = typeof(object)
if result.ofArg then ofArg = result.ofArg
key = [library,version,ofArg].join(" ")
if outputs.indexes.indexOf(key) == null then
outputs[key] = [address,vulner,type].join(" ")
else
outputs[key] = outputs[key]+char(10)+[address,vulner,type].join(" ")
end if
end for
if outputs.len == 0 then return Console.error(Messages.ErrorNoUsefullExploits)
Console.log(Messages.LogUsefullExploits)
counter = 0
for kv in outputs
Console.log(Messages.LogVulnerabilitesIn, {"LIBRARY": kv.key})
output = Messages.ExploitsHeader+char(10)+kv.value
print(formatColumnsColored(output, Theme.miscPrimary, Theme.miscSecondary))
counter = counter + 1
if counter != outputs.len then print(" ")
end for
Console.log(Messages.LogSuccessfullSessionsUpdate)
end function
command "wificrack", [], Const.any, Messages.HelpEntryNetcrack, function(arguments)
Conditions.arguments(arguments, 2)
Conditions.crypto
crypto = Libs.crypto
iface = str(arguments[0])
id = arguments[1]
if not isExistingWirelessInterface(Intrinsics.computer, iface) then return Console.error(Messages.ErrorIncorrectNetworkInterface)
networks = getNetworksSortedByPower(Intrinsics.computer, iface)
if not networks then return Console.error(Messages.ErrorCouldNotGetNetworksList)
if not id isa number or id > networks.len then return Console.error(Messages.ErrorIncorrectNetworkId)
network = networks[id-1].split(" ")
bssid = network[0]
pwr = network[1].replace("%", "").to_int
essid = network[2]
acks = ceil(300000 / pwr)
Console.log(Messages.LogStartingMonitorMode)
result = crypto.airmon("start", iface)
if result isa string then
crypto.airmon("stop", iface)
return Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "airmon", "ERROR": result}))
end if
Console.log(replaceF(Messages.LogAireplayingOn, {"ESSID": essid, "ACKS": acks}))
result = crypto.aireplay(bssid, essid, acks)
if result isa string then
crypto.airmon("stop", iface)
return Console.error(replaceF(Messages.ErrorStringGeneral, {"FUNC": "aireplay", "ERROR": result}))
end if
desyncFix
Console.log(Messages.LogAircrackingTheHandshake)
password = crypto.aircrack(current_path+"/file.cap")
Console.log(Messages.LogStoppingMonitorMode)
crypto.airmon("stop", iface)
if not password then
return Console.error(Messages.ErrorFailedPasswordCrack)
else
return Console.log(replaceF(Messages.LogSuccessfullPasswordCrack, {"ESSID": essid, "ID": id, "PASSWORD": password}))
end if
end function
command "string", ["str"], Const.any, Messages.HelpEntryString, function(arguments)
Conditions.arguments(arguments, 1)
length = arguments[0]
if not length isa number or length < 1 then return Console.error(Messages.ErrorUnknownArguments)
Console.log(randomString(length))
end function
command "md5", [], Const.any, Messages.HelpEntryMd5, function(arguments)
Conditions.argumentsMoreThan(arguments, 0)
for arg in fmap(@str, arguments)
Console.log(arg+" -> "+md5(arg))
end for
end function
command "marikey", [], Const.any, Messages.HelpEntryMarikey, function(arguments)
Conditions.argumentsMoreThan(arguments, 0)
Conditions.argumentsFewerThan(arguments, 6)
Conditions.metaxploit
command = str(arguments[0])
if "open".indexOf(command) == 0 then
Conditions.argumentsMoreThan(arguments, 3)
addr = str(arguments[1])
locAddr = str(arguments[2])
port = arguments[3]
router = getNetworkNode(addr)
if not router then return Console.error(Messages.ErrorIncorrectNodeAddress)
addr = router.public_ip
rshellPort = getExactPort(addr, locAddr, port)
if not rshellPort or not rshellPort.public then return Console.error(Messages.ErrorCouldNotAccessSuchPort)
port = rshellPort.public.port_number
process = "MARIKEY"
if arguments.len == 5 then process = str(arguments[4])
result = Libs.metaxploit.rshell_client(addr, port, process)
if result isa string then
return Console.error(Messages.ErrorStringGeneral, {"FUNC": "rshell_client", "ERROR": result})
else if not result then
return Console.error(Messages.ErrorUnknown)
else
return Console.log(Messages.LogSuccessfullBackdoor)
end if
else if "listen".indexOf(command) == 0 then
Conditions.arguments(arguments, 1)
result = Libs.metaxploit.rshell_server()
if result isa string then return Console.error(Messages.ErrorStringGeneral, {"FUNC": "rshell_server", "ERROR": result})
Console.log(Messages.LogAddingNewSessions)
for shell in result
intrinsics = deepCopy(Intrinsics)
intrinsics.shell = shell
intrinsics.computer = intrinsics.shell.host_computer
intrinsics.file = intrinsics.computer.File("/")
intrinsics.publicAddress = intrinsics.computer.public_ip
intrinsics.localAddress = intrinsics.computer.local_ip
intrinsics.port = null
intrinsics.isConnectionRemote = true
SessionsHelpers.add(intrinsics)
end for
return Console.log(Messages.LogSuccessfullSessionsUpdate)
else
return Console.error(Messages.ErrorUnknownArguments)
end if
end function
////////////////////////////////////////////////////////////
// Host session type
////////////////////////////////////////////////////////////
command "systeminfo", ["si"], Const.host, Messages.HelpEntrySysinf, function(arguments)
Conditions.arguments(arguments, 0)
Conditions.host
shell = get_shell
computer = shell.host_computer
print("<color="+Theme.miscPrimary+"><b><--"+Messages.SysInfLocalSystem+"-->")
if user_bank_number then bank = user_bank_number else bank = error(Messages.SysInfUnavailable)
if user_mail_address then mail = user_mail_address else mail = error(Messages.SysInfUnavailable)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfUserName+" <color="+Theme.miscSecondary+">- "+active_user)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfHostName+" <color="+Theme.miscSecondary+">- "+computer.get_name)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfHomePath+" <color="+Theme.miscSecondary+">- "+home_dir)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfBankLogin+" <color="+Theme.miscSecondary+">- "+bank)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfEmail+" <color="+Theme.miscSecondary+">- "+mail)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfProgramPath+" <color="+Theme.miscSecondary+">- "+program_path)
print("")
print("<color="+Theme.miscPrimary+"><b><--"+Messages.SysInfNetwork+"-->")
bssid = error(Messages.SysInfUnavailable)
essid = error(Messages.SysInfUnavailable)
kernel = error(Messages.SysInfUnavailable)
localIp = error(Messages.SysInfUnavailable)
publicIp = error(Messages.SysInfUnavailable)
deviceIp = error(Messages.SysInfUnavailable)
if computer.is_network_active then
router = getNetworkNode
bssid = router.bssid_name
essid = router.essid_name
kernel = router.kernel_version
localIp = router.local_ip
publicIp = router.public_ip
deviceIp = computer.local_ip
end if
print("<color="+Theme.miscPrimary+">"+Messages.SysInfMacAddress+" <color="+Theme.miscSecondary+">- "+bssid)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfNetworkName+" <color="+Theme.miscSecondary+">- "+essid)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfKernelVersion+" <color="+Theme.miscSecondary+">- "+kernel)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfLocalAddress+" <color="+Theme.miscSecondary+">- "+localIp)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfPublicAddress+" <color="+Theme.miscSecondary+">- "+publicIp)
print("<color="+Theme.miscPrimary+">"+Messages.SysInfDeviceAddress+" <color="+Theme.miscSecondary+">- "+deviceIp)
print(" ")
print("<color="+Theme.miscPrimary+"><b><--"+Messages.SysInfLibraries+"-->")
crypto = error(Messages.SysInfNotLoaded)
apt = error(Messages.SysInfNotLoaded)
metaxploit = error(Messages.SysInfNotLoaded)
blockchain = error(Messages.SysInfNotLoaded)
if Libs.indexes.indexOf("crypto") != null then crypto = Messages.SysInfLoaded
if Libs.indexes.indexOf("apt") != null then apt = Messages.SysInfLoaded
if Libs.indexes.indexOf("metaxploit") != null then metaxploit = Messages.SysInfLoaded
if Libs.indexes.indexOf("blockchain") != null then blockchain = Messages.SysInfLoaded
print("<color="+Theme.miscPrimary+">Crypto <color="+Theme.miscSecondary+">- "+crypto)
print("<color="+Theme.miscPrimary+">Apt <color="+Theme.miscSecondary+">- "+apt)
print("<color="+Theme.miscPrimary+">Metaxploit <color="+Theme.miscSecondary+">- "+metaxploit)
print("<color="+Theme.miscPrimary+">Blockchain <color="+Theme.miscSecondary+">- "+blockchain)
print(" ")
print(primary("<b><--"+Messages.SysInfMainframe+"-->"))
protocol = error(Messages.SysInfUnavailable)
publicAddress = error(Messages.SysInfUnavailable)
localAddress = error(Messages.SysInfUnavailable)
port = error(Messages.SysInfUnavailable)
credentials = error(Messages.SysInfUnavailable)
connection = error(Messages.SysInfUnavailable)
patches = error(Messages.SysInfUnavailable)
if Config.mainframe then
if Mainframe.protocol then protocol = Mainframe.protocol
if Mainframe.publicAddress then publicAddress = Mainframe.publicAddress
if Mainframe.localAddress then localAddress = Mainframe.localAddress
if Mainframe.port != null then port = Mainframe.port
if Mainframe.credentials then credentials = Mainframe.credentials
if Mainframe.shell then connection = Messages.SysInfAvailable
if Config.patches.len > 0 then patches = Mainframe.patches.len+"/"+Config.patches.len
end if
print(primary(Messages.SysInfMainframeProtocol)+secondary(" - "+protocol))
print(primary(Messages.SysInfPublicAddress)+secondary(" - "+publicAddress))
print(primary(Messages.SysInfLocalAddress)+secondary(" - "+localAddress))
print(primary(Messages.SysInfMainframePort)+secondary(" - "+port))
print(primary(Messages.SysInfMainframeCredentials)+secondary(" - "+credentials))
print(primary(Messages.SysInfMainframeConnection)+secondary(" - "+connection))
print(primary(Messages.SysInfMainframePatches)+secondary(" - "+patches))
print(" ")
print("<color="+Theme.miscPrimary+"><b><--"+Messages.SysInfMiscellaneous+"-->")
print("<color="+Theme.miscPrimary+">"+Messages.SysInfDateTime+" <color="+Theme.miscSecondary+">- "+current_date)
end function
command "reload", ["rl"], Const.host, Messages.HelpEntryReload, function(arguments)
Conditions.arguments(arguments, 0)
Conditions.host
RuntimeHelpers.makeNeccessaryRuntimeAssigns
RuntimeHelpers.checkIfEverythingIsAssigned
end function
command "su", [], Const.host, Messages.HelpEntryUserchange, function(arguments)
Conditions.arguments(arguments, 2)
Conditions.host
user = str(arguments[0])
pass = str(arguments[1])
shell = get_shell(user, pass)
if not shell then
Console.error(Messages.ErrorIncorrectUsernameOrPassword)
else
Console.log(Messages.LogLookingForMyself)
// Now that I think of it - this is potentially a security vulnerability. Should be cautious.
fd = findMyself(get_shell, Config.identificator, "--identify-marinette --password "+Var.password)
if not fd then return Console.error(Messages.ErrorCouldNotFindMyself)
Intrinsics.shell = shell
Intrinsics.computer = Intrinsics.shell.host_computer
Intrinsics.file = Intrinsics.computer.File("/")