For their 25th anniversary HOB Software decided to have a Problem Solving competition
I was at work and decided to give it a go during the break. After decompressing the HSM Problem solving Competition.rar
Stage 1:
I opened the raw class file in vim and noticed something interesting
<p style=”font-size:110%”><b>Stage 2: U3RhZ2UgMzogNTMgNzQgNjEgNjcgNjUgMjAgMzQgM2EgMjAgMzEgMzMgMzQgMzcgMzcgMzcgMzMgMzcgMzUgMzY=</b></p>
To me this seemed like a base64 encoded string prefixed with Stage 2: meant I somehow solved the first Stage. Not being satisfied I decided to decompile the class back to java which produced the following code:
import Main; import java.awt.Color; import java.awt.Component; import java.awt.GridBagLayout; import java.awt.LayoutManager; import java.io.File; import java.net.URL; import java.security.CodeSource; import java.security.ProtectionDomain; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.border.Border; public class Competition extends JFrame { final String gz = "STAGE 1 COMPLETE! 4 STAGES LEFT!"; private static final long serialVersionUID = 1; private String gotostage2dottxt = "gotostage2.txt"; private JTextPane label; public Competition() { super("HOB Software Malta Competition"); this.setDefaultCloseOperation(3); this.setLayout(new GridBagLayout()); this.label = new JTextPane(); this.label.setEditable(false); this.label.setBackground(null); this.label.setBorder(null); this.label.setContentType("text/html"); File file = new File(String.valueOf(this.getExecutableLocation()) + this.gotostage2dottxt); if (file.exists() && !file.isDirectory()) { this.doTextFilePresentProcedure(); this.setSize(1000, 200); } else { this.doTextFileAbsentProcedure(); this.setSize(600, 200); } this.setLocationRelativeTo(null); this.setVisible(true); } String getExecutableLocation() { return Main.class.getProtectionDomain().getCodeSource().getLocation().getPath().replaceAll("%20", " "); } void doTextFilePresentProcedure() { this.label.setText("<p style=\"font-size:110%\"><b>Stage 2: U3RhZ2UgMzogNTMgNzQgNjEgNjcgNjUgMjAgMzQgM2EgMjAgMzEgMzMgMzQgMzcgMzcgMzcgMzMgMzcgMzUgMzY=</b></p>"); JPanel panel1 = new JPanel(new GridBagLayout()); panel1.add(this.label); this.add(panel1); } void doTextFileAbsentProcedure() { this.label.setText("<p style=\"font-size:150%\"><b>404 - File Not Found</b></p>"); JPanel panel1 = new JPanel(new GridBagLayout()); panel1.add(this.label); this.add(panel1); } }
There is a conditional looking for a file named gotostage2.txt, so in reality the first stage was to create an empty text file named gotostage2.txt and execute the run_me.bat.
another fact seems like that from “STAGE 1 COMPLETE! 4 STAGES LEFT!” this competition has 5 stages.
Stage 2:
https://www.base64decode.org/
U3RhZ2UgMzogNTMgNzQgNjEgNjcgNjUgMjAgMzQgM2EgMjAgMzEgMzMgMzQgMzcgMzcgMzcgMzMgMzcgMzUgMzY=
Stage 3: 53 74 61 67 65 20 34 3a 20 31 33 34 37 37 37 33 37 35 36
Stage 3:
http://www.rapidtables.com/convert/number/hex-to-ascii.htm
53 74 61 67 65 20 34 3a 20 31 33 34 37 37 37 33 37 35 36
Stage 4: 1347773756
Stage 4:
1347773756
I tried a lot of things including trying to map the numbers to letters on the phone keypad but yielded no success.
Stuck here!!
Stage 5:
??