Dilemma の攻略のために適当に引っ張ってきたAESプログラムを寄せ集め。
適当なVisualStudioで適当なC#コンソールアプリを作っていい感じにしてください。
このプログラムにバグがあるのか、求め方が間違っているのか正しい答えには現状たどり着けません。
using System.Collections; | |
using System.IO; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace aes | |
{ | |
internal class Program | |
{ | |
static string Key = "b42e5+YWwQ6Yv/x2usUC3y7W67j/JtFsPYIrM+a8c3s="; | |
static Dictionary<string, string[]> cryptText = new Dictionary<string, string[]>(); | |
static Dictionary<string, string[]> IV = new Dictionary<string, string[]>(); | |
static string[] dd = ["Saturnus", "Thunor", "Týr", "Máni", "Wōden", "Frigg", "Sól"]; | |
static void Init() | |
{ | |
InitSaturnus(); | |
InitThunor(); | |
InitTýr(); | |
InitMáni(); | |
InitWōden(); | |
InitFrigg(); | |
InitSól(); | |
} | |
static void InitSaturnus() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX1+1O+ZmIgttJH8=", | |
"U2FsdGVkX1+SrIZIFMDVW2E=", | |
"U2FsdGVkX18JRzfoygn2Y20=", | |
"U2FsdGVkX18GDhU6ud+3DcQ=", | |
"U2FsdGVkX1/n51zyK28c4GI=", | |
"U2FsdGVkX18ugDFDV5lkglE=" | |
}; | |
cryptText.Add(dd[0], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"xZAdKng0U5d82Np4PZsPww==", | |
"YHVny/woeNDh9DpM94BBOQ==", | |
"Muf/Frv5oLFRt6SyAiA6rQ==", | |
"ehr7Twl2OF1fIJBKPbmcMA==", | |
"lbc3yR4IWHSuZdbib3QdiA==", | |
"b2Hi5VfTA6Q6Rsz2zHAvuA==" | |
}; | |
IV.Add(dd[0], IVList.ToArray()); | |
} | |
static void InitThunor() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX19rsWv2JfYRRb0=", | |
"U2FsdGVkX1+4rdZjmR3tgko=", | |
"U2FsdGVkX18ocJyAnLuozNE=", | |
"U2FsdGVkX1/AOyr4suOc4MQ=", | |
"U2FsdGVkX1+jD8DWwqTE910=", | |
"U2FsdGVkX1/+ncfXosXHwKY=" | |
}; | |
cryptText.Add(dd[1], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"MBc4iLpcZDrfSjeqJJmLEA==", | |
"fKwuELhrHqQBeaIi2R+b8A==", | |
"lHr6MzT0fYzqArra4GYm+g==", | |
"AZkW78OLribXIy+ApGJQgA==", | |
"WUxVtwiogwBgphfgHKwDzA==", | |
"zoDZNgmPTlEjZdXdpBM8tA==" | |
}; | |
IV.Add(dd[1], IVList.ToArray()); | |
} | |
static void InitTýr() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX1/4DZqbUtYRZx8=", | |
"U2FsdGVkX19czPjq8+/8UsE=", | |
"U2FsdGVkX1/6ZfI36gjoLA8=", | |
"U2FsdGVkX18V5valcsk1CsQ=", | |
"U2FsdGVkX1+xG6R0mlCkPTE=", | |
"U2FsdGVkX18g2+TuT4brgOk=" | |
}; | |
cryptText.Add(dd[2], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"m0L/fmD3/jbh0AqJk71ehg==", | |
"NnBKYEFiiAHdovEgMw7bNg==", | |
"n+/VrL4x4OrWjJGVfDUSsw==", | |
"70x6io7OfXVBss8yP1D1tg==", | |
"VzBgGklGo66w7QEAZa0GAw==", | |
"sDwVmAR6JW/kEstlwZUdZg==" | |
}; | |
IV.Add(dd[2], IVList.ToArray()); | |
} | |
static void InitMáni() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX19H6fCgY8RPxSQ=", | |
"U2FsdGVkX1968V7WtkgBfrU=", | |
"U2FsdGVkX1/8j4E7M4sVoog=", | |
"U2FsdGVkX1/f6pEN6sJBUvQ=", | |
"U2FsdGVkX1/gG/GRZhjmwYs=", | |
"U2FsdGVkX19TsTlfFVUGj8Q=" | |
}; | |
cryptText.Add(dd[3], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"IuPtED6ZqY5x7ZJaZmhxsQ==", | |
"2OiKS7E+SsE1I1SUX059qA==", | |
"yk6DUFyg/zACWi8HIm5nNA==", | |
"Iga0n7QFjo2cd9yqs3/HWA==", | |
"jDz4j363OvNa5RCNtySr/g==", | |
"vaukQua5jx7mOF5g+b76/w==" | |
}; | |
IV.Add(dd[3], IVList.ToArray()); | |
} | |
static void InitWōden() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX1+KdFdcb3NqgaY=", | |
"U2FsdGVkX18Br8lgEsFjmBA=", | |
"U2FsdGVkX18vDxlTRm4Z9Js=", | |
"U2FsdGVkX18aHNvqpLWTqaM=", | |
"U2FsdGVkX1+JsdHsFrkdB1Q=", | |
"U2FsdGVkX1+rewGsemCVLr0=" | |
}; | |
cryptText.Add(dd[4], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"XgCdv4x43LN7vebkY+xRXQ==", | |
"ObTrRz3F0icCHIoPfkUnFw==", | |
"0iQqhVfCeoCd6W/ZbxhN7w==", | |
"M/ys4cHeVKy2qYVcJxE+cw==", | |
"QmLkwbIpGd2rkPj60ZwRJA==", | |
"oD+jhRQ6K/ZZkRvwFs0WHQ==" | |
}; | |
IV.Add(dd[4], IVList.ToArray()); | |
} | |
static void InitFrigg() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX188zDjnLuA7d8A=", | |
"U2FsdGVkX1+vq+nMSjZ/8Ic=", | |
"U2FsdGVkX1+F9lTwE15KW5g=", | |
"U2FsdGVkX1+sTinWf3I4Y5w=", | |
"U2FsdGVkX1+b0z1wmodi7JA=", | |
"U2FsdGVkX1+OInpxKfqXYZI=" | |
}; | |
cryptText.Add(dd[5], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"Ci00hMTPHUE+DZ1A2n9P8Q==", | |
"zFd6wDC3Y96a9jwPjiBDWA==", | |
"biSeeU9U/wrLzExmmnsXcg==", | |
"4Oxci6J41CxUr4PADBTbwg==", | |
"IR+JGJ3LBJ+VjICMeZS7ig==", | |
"SM2lXjHoNatDExgsm5aXMA==" | |
}; | |
IV.Add(dd[5], IVList.ToArray()); | |
} | |
static void InitSól() | |
{ | |
var cryptTextList = new List<string>() { | |
"U2FsdGVkX1+wWKew/Q7zUVo=", | |
"U2FsdGVkX18yB0dA7d7IOnA=", | |
"U2FsdGVkX1/ljc4QQ9kjeU4=", | |
"U2FsdGVkX1+j47mDVGqVfCA=", | |
"U2FsdGVkX19WdnDS/Qe+qbs=", | |
"U2FsdGVkX19sOHx5jdTKNdU=" | |
}; | |
cryptText.Add(dd[6], cryptTextList.ToArray()); | |
var IVList = new List<string>() | |
{ | |
"1DftH9R07L0YBteL/yUwXA==", | |
"e+NMY/ESTAfKALB9yaYCUg==", | |
"JcIn6q3yyysIoZRgGljznA==", | |
"c5sk+xvJVevsv9D9XNIJKg==", | |
"dZi5+HpihevwGT2xgiME3w==", | |
"6Mqn5YyPWqPdYp/z/7oUgw==" | |
}; | |
IV.Add(dd[6], IVList.ToArray()); | |
} | |
static void Main(string[] args) | |
{ | |
Init(); | |
foreach (var item in dd) | |
{ | |
Console.WriteLine(String.Format("==={0}===", item)); | |
var ct = cryptText[item]; | |
var iv = IV[item]; | |
for (int i = 0; i < iv.Length; i++) | |
{ | |
byte[] dec = Decrypt(System.Convert.FromBase64String(ct[i]), System.Convert.FromBase64String(Key), System.Convert.FromBase64String(iv[i])); | |
Console.WriteLine(String.Format("{0} {1,4}", Encoding.UTF8.GetString(dec), dec[0])); | |
} | |
} | |
Console.Read(); | |
} | |
static byte[] GenerateSalt(int saltLength) | |
{ | |
var result = new byte[saltLength]; | |
using (var csp = new RNGCryptoServiceProvider()) | |
{ | |
csp.GetBytes(result); | |
return result; | |
} | |
} | |
static byte[] GenerateKIV(byte[] salt, string password, HashAlgorithmName hashAlgorithm, int iterationCount, int size) | |
{ | |
return new Rfc2898DeriveBytes(Encoding.UTF8.GetBytes(password), salt, iterationCount, hashAlgorithm) | |
.GetBytes(size); | |
} | |
public static string Encrypt(byte[] plainBytes, string password) | |
{ | |
var salt = GenerateSalt(8); | |
var kiv = GenerateKIV(salt, password, HashAlgorithmName.SHA256, 10000, 48).ToList(); | |
using (var csp = new AesManaged()) | |
{ | |
csp.KeySize = 256; | |
csp.BlockSize = 128; | |
csp.Mode = CipherMode.CBC; | |
csp.Padding = PaddingMode.PKCS7; | |
csp.Key = kiv.GetRange(0, 32).ToArray(); | |
csp.IV = kiv.GetRange(32, 16).ToArray(); | |
using (var encryptor = csp.CreateEncryptor()) | |
using (var mstream = new MemoryStream()) | |
{ | |
mstream.Write(Encoding.UTF8.GetBytes("Salted__"), 0, 8); | |
mstream.Write(salt, 0, 8); | |
using (var cstream = new CryptoStream(mstream, encryptor, CryptoStreamMode.Write)) | |
{ | |
cstream.Write(plainBytes, 0, plainBytes.Length); | |
} | |
return Convert.ToBase64String(mstream.ToArray()); | |
} | |
} | |
} | |
public static byte[] Decrypt(byte[] encryptedBytes, byte[] Key, byte[] IV) | |
{ | |
using (var csp = new AesManaged()) | |
{ | |
csp.KeySize = 128; | |
csp.BlockSize = 128; | |
csp.Mode = CipherMode.CFB; | |
csp.Padding = PaddingMode.None; | |
csp.Key = Key; | |
csp.IV = IV; | |
using (var decryptor = csp.CreateDecryptor()) | |
using (var mstream1 = new MemoryStream(encryptedBytes.Skip(16).ToArray())) | |
using (var cstream = new CryptoStream(mstream1, decryptor, CryptoStreamMode.Read)) | |
using (var mstream2 = new MemoryStream()) | |
{ | |
cstream.CopyTo(mstream2); | |
return mstream2.ToArray(); | |
} | |
} | |
} | |
public static byte[] Decrypt(string encryptedString, string password) | |
{ | |
var encryptedBytes = Convert.FromBase64String(encryptedString); | |
var salt = encryptedBytes.Skip(8).Take(8).ToArray(); | |
var kiv = GenerateKIV(salt, password, HashAlgorithmName.SHA512, 10000, 48).ToList(); | |
using (var csp = new AesManaged()) | |
{ | |
csp.KeySize = 128; | |
csp.BlockSize = 128; | |
csp.Mode = CipherMode.CFB; | |
csp.Padding = PaddingMode.None; | |
csp.Key = kiv.GetRange(0, 32).ToArray(); | |
csp.IV = kiv.GetRange(32, 16).ToArray(); | |
using (var decryptor = csp.CreateDecryptor()) | |
using (var mstream1 = new MemoryStream(encryptedBytes.Skip(16).ToArray())) | |
using (var cstream = new CryptoStream(mstream1, decryptor, CryptoStreamMode.Read)) | |
using (var mstream2 = new MemoryStream()) | |
{ | |
cstream.CopyTo(mstream2); | |
return mstream2.ToArray(); | |
} | |
} | |
} | |
} | |
} |
@NaomisDragons
No, unfortunately, the value you get by running this code, whether it's buggy or something wrong, is not the answer.
@meronmks I've been finding that out. Many of my coding friends tried it manually and couldn't solve it. But did you ever figure out what the door code is?
@NaomisDragons There's no reason to believe it, but the hint from the AI mentions the date, the encryption to be solved is divided into seven groups that correspond exactly to the day of the week, and even if the encryption is solved, there's likely only one character of data.
We think that if we solve the encryption from these, we'll get the order in which to press the buttons. We also think that the order will change depending on the day of the week.
So you think the boxes have to be selected in a specific order or just the right combination with the right day at the bottom? Have a friend who's got 441 possibe combinations (binary based) and we're worried that it is also a specific order on top of it.
So you think the boxes have to be selected in a specific order or just the right combination with the right day at the bottom? Have a friend who's got 441 possibe combinations (binary based) and we're worried that it is also a specific order on top of it.
@NaomisDragons
Me and my friends brute-forced the answer without decrypting, what @meronmks mentioned is partially right. The combination answer changes every day, so there are 7 answers available. If it's Monday, only the answer corresponding to Monday will work
The 7 answers all require the buttons to be pressed in a specific order
https://pastebin.com/R9tbY8E8
I've wrote down all the orders starting from line 140, check it out if you need it
WoW!! It's a lot of patience to go all in and find the answer!
WoW!! It's a lot of patience to go all in and find the answer!
@meronmks
It really was, but I'm not perfectly satisfied as the answers were not earned by the intended way, which I've still not figured how :(
@36DB I understand the desire to get to the answer in the right way.
The program assumes that it is AES using openSSL from ciphertext, but the trouble is that there is no hint to determine the parameters needed, such as CipherMode or PaddingMode.
@meronmks
Indeed. One of my friends claims he succeeded using some python code, he used the left strings as a key, and the right strings to be deciphered
Tho he first decoded the strings on the right through Base64, and took out the header(Salted__)and then used the remaining strings to decode.
He used AES-ECB, but not sure what PaddingMode he used. He says that some keys/value works and some doesn't, so It would be wise to try all 36 available key/value combinations on a single day page.
Unfortunately he's been unavailable for some time now and I cannot ask anything more about this topic
https://pastebin.com/rz1pcG0y
Also this is some other guy's code which I found on the web, but it seems he also somehow failed to generate meaningful results.
You guys are amazing! Thank you both so much!
@NaomisDragons
np, just come back and tell us if you find anything new or figure out the answer.
What was the answer?