Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

rev/java-rev-1 #20

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions java-rev-1/RevOne.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
15 changes: 15 additions & 0 deletions java-rev-1/chall.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions java-rev-1/solve.md
Original file line number Diff line number Diff line change
@@ -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);
```
Loading