Hi there I'm doing a capture the flag event and the current problem is in Java but I don't have any experience working with Java. When I try to run the file I get "could not find or load main class Espresso". I've seen other posts on here and I tried java -cp . Espresso
but didn't have any luck. I did run javac Espresso.java
to compile it before running java Espresso
. Any help would be appreciated here is the code:
package com.hackinglab.ctf;
import java.io.PrintStream;
public class Espresso { public Espresso() {} private static String key = "Stringab";
private static String cipher = "'>xgx47#)~Fp?8k4%IHsC9_a";
public static void main(String[] paramArrayOfString) {
if (paramArrayOfString.length != 1) {
System.out.println("You must enter the flag.");
System.exit(-1);
}
String str = paramArrayOfString[0];
System.out.println(str);
StringBuffer localStringBuffer = new StringBuffer();
for (int i = 0; i < cipher.length(); i++) {
localStringBuffer.append((char)(key.charAt(i % key.length()) - cipher.charAt(i) + 55));
}
if (localStringBuffer.toString().equals(str)) {
System.out.println("Flag correct, well done!");
} else {
System.out.println("Dude, that's wrong!");
}
}
}