Advertisement
sudoaptinstallname

bruteClient.java

Feb 18th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.79 KB | None | 0 0
  1. package com.company;
  2.  
  3. /*
  4. Amon Guinan
  5. January - February 2018
  6. Compilation of three increasingly efficient codes
  7. that use Brute Force methods to find specified strings.
  8.  */
  9. import java.util.Scanner;
  10.  
  11. public class bruteClient {
  12.     public static void main(String [] args)
  13.     {
  14.         helloWorld brute1 = new helloWorld();
  15.         Brute_Diction_V2 brute2 = new Brute_Diction_V2();
  16. //        Brute_Diction_String brute3 = new Brute_Diction_String(); Broken. Extremely similar to 2.
  17.         Brute_Diction_V3 brute4 = new Brute_Diction_V3();
  18.  
  19.         int x = 0;
  20.  
  21.         System.out.println();
  22.         System.out.println("-INTRODUCTION-");
  23.         System.out.println("This client program can initiate a series of other programs, designed to demonstrate \"Brute Force\" techniques.");
  24.         System.out.println("These techniques are a simple method to find an unknown piece of information.");
  25.         System.out.println("Essentially, the program runs through every possible output until it finds the correct one.");
  26.         System.out.println("As such, this technique is used in scenarios when the attempted output can be compared to a secret correct output.");
  27.         System.out.println("A scenario such as finding a password.");
  28.         System.out.println("Of course, this would not work on current passwords, as security measures have been developed to prevent a program like this one from working.");
  29.         System.out.println();
  30.  
  31.  
  32.  
  33.  
  34.  
  35.         do {
  36.             System.out.println("-EXECUTION-");
  37.             System.out.print("Select Program 1 through 3: ");
  38.             Scanner input = new Scanner(System.in);
  39.             String word = input.nextLine();
  40.             word = word.toLowerCase();
  41.  
  42.  
  43.             switch(word)
  44.             {
  45.  
  46.                 case("1"):
  47.                 case("one"):
  48.                     System.out.println();
  49.                     System.out.println("Program one is the primary inspiration for this project.");
  50.                     System.out.println("It outputs a random string, until it gets an individual letter correct.");
  51.                     System.out.println("Once it does, it remembers that letter, but otherwise it prints the unknowns completely randomly.");
  52.                     System.out.println();
  53.                     System.out.print(brute1.main());
  54.                     break;
  55.                 case("2"):
  56.                 case("two"):
  57.                     System.out.println();
  58.                     System.out.println("Program two was an attempt to incorporate a dictionary to improve efficiency.");
  59.                     System.out.println("That's to say, once it gets a letter wrong, it won't try it again.");
  60.                     System.out.println("However, it can only test for a single character.");
  61.                     System.out.println("This limitation comes from the fact that it tests all the characters at once, and it doesn't refresh its dictionary.");
  62.                     System.out.println("Attempting to input more than one character will confuse it.");
  63.                     System.out.println();
  64.                     System.out.print(brute2.main());
  65.                     break;
  66. //                case("3"):
  67. //                case("three"):
  68. //                    System.out.print(brute3.main());
  69. //                    break;
  70.                 //broken attempt at two.
  71.  
  72.                 case("3"):
  73.                 case("three"):
  74.                     System.out.println();
  75.                     System.out.println("Program three resolves the limitations of program two, but at a cost of efficiency.");
  76.                     System.out.println("Program three tests using a dictionary, but it tests only one charater at a time.");
  77.                     System.out.println("Technically, this would still be more efficient resource wise compared to method one, but it results in more iterations.");
  78.                     System.out.println("This program can accept full sentences of any length, composed of any set of ascii characters predefined in the code.");
  79.                     System.out.println();
  80.                     System.out.print(brute4.main());
  81.                     break;
  82.                 default:
  83.                     System.out.print("Please enter a valid number, 1 through 3.");
  84.                     break;
  85.  
  86.             }
  87.             System.out.println();
  88.             System.out.print("Would you like to run another program? >");
  89.             String decision = input.nextLine();
  90.             decision = decision.toLowerCase();
  91.             switch(decision)
  92.             {
  93.                 case("yes"):
  94.                 case("y"):
  95.                 case("1"):
  96.                     break;
  97.                 case("no"):
  98.                 case("n"):
  99.                 case("0"):
  100.                     x = 1;
  101.                     break;
  102.             }
  103.         }
  104.         while(x == 0);
  105.     }
  106.  
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement