From 54038f9098dbda2b3399cf4be5cece894e8fff77 Mon Sep 17 00:00:00 2001 From: thomashaw Date: Fri, 10 Aug 2018 16:07:28 +0100 Subject: [PATCH] Task 18.1 - echo string challenge working over the network --- .../programming/echo_string/secgen_local/challenge.rb | 4 +++- .../ctf_challenge_examples/echo_string_example.xml | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/generators/challenges/misc/programming/echo_string/secgen_local/challenge.rb b/modules/generators/challenges/misc/programming/echo_string/secgen_local/challenge.rb index 3aee60a09..b0eff5f2e 100644 --- a/modules/generators/challenges/misc/programming/echo_string/secgen_local/challenge.rb +++ b/modules/generators/challenges/misc/programming/echo_string/secgen_local/challenge.rb @@ -1,17 +1,19 @@ require 'securerandom' require 'timeout' +$stdout.sync = true # Disable stdout caching (for challenges that can be run over the network) puts 'Prepare yourself. You need to work quickly for this challenge.' + sleep 2 puts 'Echo the string back to me before the script times out. Try writing a script of your own to make it easier!' sleep 2 puts 'Get ready, here we go...' sleep 2 - # Generate random string string = [SecureRandom.base64(rand(20..40)), SecureRandom.hex(rand(20..40))].sample puts string +STDOUT.flush begin Timeout.timeout 0.25 do diff --git a/scenarios/examples/ctf_challenge_examples/echo_string_example.xml b/scenarios/examples/ctf_challenge_examples/echo_string_example.xml index 367ef3a2a..95ed3434b 100644 --- a/scenarios/examples/ctf_challenge_examples/echo_string_example.xml +++ b/scenarios/examples/ctf_challenge_examples/echo_string_example.xml @@ -10,7 +10,13 @@ - + + + + + 1337 + +