Skip to content

Instantly share code, notes, and snippets.

@B05Fvsvl04
Created March 27, 2017 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save B05Fvsvl04/2b0534ca2885c820935b25d81939d08a to your computer and use it in GitHub Desktop.
Save B05Fvsvl04/2b0534ca2885c820935b25d81939d08a to your computer and use it in GitHub Desktop.
Mod-X Level 4
/* Level 4 from Mod-X
* This is the VB executable translated into Java
* for making easier to understand
*/
import java.util.Scanner;
public class Level_4 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int nameLen;
char letter;
String nName = "";
String tmp = "";
//From 4030F1 to 4032C3
String hardcodedName = "trautS";
System.out.print("Name: ");
String name = input.nextLine();
System.out.print("Password: ");
String password = input.nextLine();
input.close();
if (password.length()==0)
return;
nameLen = name.length();
if (nameLen != 6)
return;
for (int i=1; i<=nameLen; i++){
letter = name.charAt(nameLen-i);
nName += letter;
}
//From 4032F2 then on
if (!nName.equals(hardcodedName))
return;
nName = "";
for (int i=0; i<name.length(); i++){
letter = name.charAt(i);
nName += Integer.toHexString(letter);
}
for (int i=nName.length(); i!=0; i--){
letter = nName.charAt(i-1);
tmp += letter;
}
if (password.equals(tmp)){
System.out.println("Welcome");
System.out.println("Remote access link to Mod-X terminal created");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment