prototype setup
@@ -9,9 +9,11 @@ import org.owasp.wrongsecrets.challenges.Challenge;
import org.owasp.wrongsecrets.challenges.Spoiler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
+import org.springframework.core.io.ClassPathResource;
import org.springframework.security.crypto.codec.Hex;
import org.springframework.stereotype.Component;
+import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
@@ -51,7 +53,17 @@ public class Challenge19 extends Challenge {
guess = "spoil";
}
try {
- return runTime.exec(new String[]{"resources/wrongsecrets-c", guess}).getOutputStream().toString();
+ String systemARch = System.getProperty("os.arch");
+ log.info("System arch detected: {}", systemARch);
+ String fileLocation;
+ if (systemARch == "x86_64") {
+ fileLocation = "wrongsecrets-c";
+ } else {
+ fileLocation = "wrongsecrets-c-arm";
+ }
+ String output = runTime.exec(new String[]{fileLocation, guess}).getOutputStream().toString();
+ log.info("Output challenge 19: {}", output);
+ return output;
} catch (IOException e) {
log.warn("Error executing:", e);
return "Error with executing";
