diff --git a/java-rev-1/RevOne.java b/java-rev-1/RevOne.java new file mode 100644 index 0000000..d16c1c3 --- /dev/null +++ b/java-rev-1/RevOne.java @@ -0,0 +1,26 @@ +import java.util.Scanner; + +public class RevOne { + public static void main(String[] args) { + System.out.println("Enter the password: "); + Scanner scanner = new Scanner(System.in); + + String line = scanner.nextLine(); + + if (checkPassword(line)) { + System.out.println("That's the right password!"); + } else { + System.out.println("That's the incorrect password!"); + } + + scanner.close(); + } + + public static boolean checkPassword(String passwordGuess) { + String[] flagSegments = {"C0nGr4TulAt1OnS", "Y0u", "4Re", "J4v4", "Pr0"}; + + String flag = "camp{"+String.join("_", flagSegments)+"}"; + + return flag.equals(passwordGuess); + } +} \ No newline at end of file diff --git a/java-rev-1/chall.yaml b/java-rev-1/chall.yaml new file mode 100644 index 0000000..37e46da --- /dev/null +++ b/java-rev-1/chall.yaml @@ -0,0 +1,15 @@ +name: Java Rev 1 +categories: + - rev +value: 50 +flag: camp{C0nGr4TulAt1OnS_Y0u_4Re_J4v4_Pr0} +description: |- + I keep on trying to get past this password checker but it won't let me, can you + find the right password? +hints: + - What does the String.join() method do? +files: + - src: RevOne.java +authors: + - Jack Crowley +visible: true \ No newline at end of file diff --git a/java-rev-1/solve.md b/java-rev-1/solve.md new file mode 100644 index 0000000..c0b09e2 --- /dev/null +++ b/java-rev-1/solve.md @@ -0,0 +1,9 @@ +join the segments of the flag given with underscores, as defined by the code shown + +surround with `camp{}` and you have your flag. + +Alternatively, run the file and add the following line on line 23 + +```java +System.out.println(flag); +``` \ No newline at end of file