OGG Memes
Thanks OGG for repeating the two bytes i needed, elsewhere in the file ;)
This commit is contained in:
parent
ca87e8f3e9
commit
4ec1857de1
Binary file not shown.
|
@ -131,10 +131,13 @@ namespace RMDEC
|
||||||
|
|
||||||
private static byte[] guessKey(string path) // Incase you think your smart
|
private static byte[] guessKey(string path) // Incase you think your smart
|
||||||
{
|
{
|
||||||
|
bool useOgg = false;
|
||||||
string[] mzPngs = Directory.GetFiles(path, "*._png", SearchOption.AllDirectories);
|
string[] mzPngs = Directory.GetFiles(path, "*._png", SearchOption.AllDirectories);
|
||||||
string[] mvPngs = Directory.GetFiles(path, "*.rpgmvp", SearchOption.AllDirectories);
|
string[] mvPngs = Directory.GetFiles(path, "*.rpgmvp", SearchOption.AllDirectories);
|
||||||
string[] mzM4as = Directory.GetFiles(path, "*._m4a", SearchOption.AllDirectories);
|
string[] mzM4as = Directory.GetFiles(path, "*._m4a", SearchOption.AllDirectories);
|
||||||
string[] mvM4as = Directory.GetFiles(path, "*.rpgmvm", SearchOption.AllDirectories);
|
string[] mvM4as = Directory.GetFiles(path, "*.rpgmvm", SearchOption.AllDirectories);
|
||||||
|
string[] mzOggs = Directory.GetFiles(path, "*._ogg", SearchOption.AllDirectories);
|
||||||
|
string[] mvOggs = Directory.GetFiles(path, "*.rpgmvo", SearchOption.AllDirectories);
|
||||||
|
|
||||||
List<string> files = new List<string>();
|
List<string> files = new List<string>();
|
||||||
files.AddRange(mzPngs);
|
files.AddRange(mzPngs);
|
||||||
|
@ -144,7 +147,23 @@ namespace RMDEC
|
||||||
files.AddRange(mvM4as);
|
files.AddRange(mvM4as);
|
||||||
|
|
||||||
if (files.Count <= 0)
|
if (files.Count <= 0)
|
||||||
return new byte[0x10];
|
{
|
||||||
|
if(mzOggs.Length > 0 || mvOggs.Length > 0) // still encryted audio?
|
||||||
|
{
|
||||||
|
files.AddRange(mzOggs);
|
||||||
|
files.AddRange(mvOggs);
|
||||||
|
useOgg = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new byte[0x10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] pngHeader = new byte[0x10] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52 };
|
||||||
|
byte[] m4aHeader = new byte[0x10] { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
byte[] oggHeader = new byte[0x10] { 0x4F, 0x67, 0x67, 0x53, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF };
|
||||||
|
|
||||||
|
|
||||||
Random rng = new Random();
|
Random rng = new Random();
|
||||||
int index = rng.Next(0, files.Count);
|
int index = rng.Next(0, files.Count);
|
||||||
|
@ -154,12 +173,16 @@ namespace RMDEC
|
||||||
FileStream fs = File.OpenRead(file);
|
FileStream fs = File.OpenRead(file);
|
||||||
fs.Seek(0x10, SeekOrigin.Begin);
|
fs.Seek(0x10, SeekOrigin.Begin);
|
||||||
fs.Read(encryptedHeader, 0x00, 0x10);
|
fs.Read(encryptedHeader, 0x00, 0x10);
|
||||||
|
if (useOgg)
|
||||||
|
{
|
||||||
|
fs.Seek(0x58, SeekOrigin.Begin);
|
||||||
|
oggHeader[0x0E] = (byte)fs.ReadByte();
|
||||||
|
oggHeader[0x0F] = (byte)fs.ReadByte();
|
||||||
|
}
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
string filetype = Path.GetExtension(file).ToLower();
|
string filetype = Path.GetExtension(file).ToLower();
|
||||||
byte[] pngHeader = new byte[0x10] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52 };
|
|
||||||
byte[] m4aHeader = new byte[0x10] { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
if (filetype == "._png" || filetype == ".rpgmvp") {
|
if (filetype == "._png" || filetype == ".rpgmvp") {
|
||||||
byte[] key = RMProject.Xor(encryptedHeader, pngHeader);
|
byte[] key = RMProject.Xor(encryptedHeader, pngHeader);
|
||||||
if(!tryKey(path, key))
|
if(!tryKey(path, key))
|
||||||
|
@ -183,7 +206,18 @@ namespace RMDEC
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// OGG Header is not 0x10 bytes unfortunately.
|
else if (filetype == "._ogg" || filetype == ".rpgmvo")
|
||||||
|
{
|
||||||
|
byte[] key = RMProject.Xor(encryptedHeader, oggHeader);
|
||||||
|
if (!tryKey(path, key))
|
||||||
|
{
|
||||||
|
throw new Exception("Cannot find key (ITS TOO STRONG!)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception("Cannot find key (ITS TOO STRONG!)");
|
throw new Exception("Cannot find key (ITS TOO STRONG!)");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue