rev/vault_door_6
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import java.util.*;
|
||||
|
||||
class VaultDoor6 {
|
||||
public static void main(String args[]) {
|
||||
VaultDoor6 vaultDoor = new VaultDoor6();
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.print("Enter vault password: ");
|
||||
String userInput = scanner.next();
|
||||
String input = userInput.substring("picoCTF{".length(),userInput.length()-1);
|
||||
if (vaultDoor.checkPassword(input)) {
|
||||
System.out.println("Access granted.");
|
||||
} else {
|
||||
System.out.println("Access denied!");
|
||||
}
|
||||
}
|
||||
|
||||
// Dr. Evil gave me a book called Applied Cryptography by Bruce Schneier,
|
||||
// and I learned this really cool encryption system. This will be the
|
||||
// strongest vault door in Dr. Evil's entire evil volcano compound for sure!
|
||||
// Well, I didn't exactly read the *whole* book, but I'm sure there's
|
||||
// nothing important in the last 750 pages.
|
||||
//
|
||||
// -Minion #3091
|
||||
public boolean checkPassword(String password) {
|
||||
if (password.length() != 32) {
|
||||
return false;
|
||||
}
|
||||
byte[] passBytes = password.getBytes();
|
||||
byte[] myBytes = {
|
||||
0x3b, 0x65, 0x21, 0xa , 0x38, 0x0 , 0x36, 0x1d,
|
||||
0xa , 0x3d, 0x61, 0x27, 0x11, 0x66, 0x27, 0xa ,
|
||||
0x21, 0x1d, 0x61, 0x3b, 0xa , 0x2d, 0x65, 0x27,
|
||||
0xa , 0x33, 0x34, 0x34, 0x30, 0x6d, 0x37, 0x61,
|
||||
};
|
||||
for (int i=0; i<32; i++) {
|
||||
if (((passBytes[i] ^ 0x55) - myBytes[i]) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# byte[] myBytes = {
|
||||
# 0x3b, 0x65, 0x21, 0xa , 0x38, 0x0 , 0x36, 0x1d,
|
||||
# 0xa , 0x3d, 0x61, 0x27, 0x11, 0x66, 0x27, 0xa ,
|
||||
# 0x21, 0x1d, 0x61, 0x3b, 0xa , 0x2d, 0x65, 0x27,
|
||||
# 0xa , 0x33, 0x34, 0x34, 0x30, 0x6d, 0x37, 0x61,
|
||||
# };
|
||||
# for (int i=0; i<32; i++) {
|
||||
# if (((passBytes[i] ^ 0x55) - myBytes[i]) != 0) {
|
||||
# return false;
|
||||
# }
|
||||
# }
|
||||
|
||||
my_bytes = [
|
||||
0x3b, 0x65, 0x21, 0xa , 0x38, 0x0 , 0x36, 0x1d,
|
||||
0xa , 0x3d, 0x61, 0x27, 0x11, 0x66, 0x27, 0xa ,
|
||||
0x21, 0x1d, 0x61, 0x3b, 0xa , 0x2d, 0x65, 0x27,
|
||||
0xa , 0x33, 0x34, 0x34, 0x30, 0x6d, 0x37, 0x61,
|
||||
];
|
||||
|
||||
def main():
|
||||
print('picoCTF{', end='')
|
||||
for x in my_bytes:
|
||||
print(chr(x ^ 0x55), end='')
|
||||
print('}')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user