Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.11 KB

File metadata and controls

46 lines (32 loc) · 1.11 KB

RPS

Author

WILL HONG

Description

Here's a program that plays rock, paper, scissors against you. I hear something good happens if you win 5 times in a row. Connect to the program with netcat: $ nc saturn.picoctf.net 52524 The program's source code with the flag redacted can be downloaded here.

Hints

  1. How does the program check if you won?

Approach

Running the code, it gives:

Welcome challenger to the game of Rock, Paper, Scissors
For anyone that beats me 5 times in a row, I will offer up a flag I found
Are you ready?
Type '1' to play a game
Type '2' to exit the program

Looking at the code, what compares your move and the computers move is the following:

if (strstr(player_turn, loses[computer_turn])) {
    puts("You win! Play again?");
    return true;
} else {
    puts("Seems like you didn't win this time. Play again?");
    return false;
}

strstr(String a, String b) checks if the String b is in String a. To ensure that we win every time, we can input "rockpaperscissors". Doing this 5 times, we get the flag

Flag

picoCTF{50M3_3X7R3M3_1UCK_32F730C2}