diff --git a/eCDPSerialGenerator.sln b/eCDPSerialGenerator.sln new file mode 100644 index 0000000..5072897 --- /dev/null +++ b/eCDPSerialGenerator.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29806.167 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eCDPSerialGenerator", "eCDPSerialGenerator\eCDPSerialGenerator.vcxproj", "{68A9AA05-ACE7-45ED-9054-71C6683EC955}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Debug|x64.ActiveCfg = Debug|x64 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Debug|x64.Build.0 = Debug|x64 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Debug|x86.ActiveCfg = Debug|Win32 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Debug|x86.Build.0 = Debug|Win32 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Release|x64.ActiveCfg = Release|x64 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Release|x64.Build.0 = Release|x64 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Release|x86.ActiveCfg = Release|Win32 + {68A9AA05-ACE7-45ED-9054-71C6683EC955}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3F3CEA65-88A4-49A0-BCE2-C53FDB6099CA} + EndGlobalSection +EndGlobal diff --git a/eCDPSerialGenerator/eCDPSerialGenerator.c b/eCDPSerialGenerator/eCDPSerialGenerator.c new file mode 100644 index 0000000..69abf4e --- /dev/null +++ b/eCDPSerialGenerator/eCDPSerialGenerator.c @@ -0,0 +1,169 @@ +#include +#include +#include +#include +BYTE key[0xA8] = { 0x01,0x0A,0x16,0x04,0x07,0x18,0x0C,0x10,0x05,0x17,0x09,0x03,0x12,0x08,0x15,0x13,0x0B,0x02,0x0F,0x0D,0x11,0x0E,0x06,0x14,0x07,0x0C,0x0E,0x11,0x09,0x16,0x10,0x06,0x14,0x0D,0x01,0x02,0x12,0x08,0x13,0x0B,0x0F,0x0A,0x18,0x15,0x04,0x05,0x03,0x17,0x0F,0x04,0x09,0x03,0x06,0x07,0x11,0x12,0x15,0x16,0x02,0x08,0x05,0x17,0x0C,0x0D,0x01,0x18,0x0B,0x14,0x0E,0x10,0x13,0x0A,0x02,0x0A,0x0E,0x12,0x0B,0x03,0x0C,0x06,0x13,0x07,0x11,0x09,0x15,0x18,0x10,0x17,0x14,0x0F,0x04,0x01,0x05,0x08,0x16,0x0D,0x0B,0x02,0x09,0x16,0x14,0x01,0x12,0x11,0x15,0x06,0x0F,0x17,0x07,0x10,0x0C,0x0E,0x08,0x18,0x13,0x03,0x0A,0x0D,0x04,0x05,0x09,0x0F,0x05,0x0D,0x16,0x15,0x12,0x11,0x03,0x0A,0x04,0x10,0x0E,0x14,0x02,0x01,0x13,0x0C,0x06,0x0B,0x17,0x18,0x07,0x08,0x12,0x02,0x0C,0x09,0x0D,0x0E,0x04,0x07,0x16,0x14,0x17,0x01,0x11,0x03,0x10,0x15,0x08,0x0A,0x05,0x13,0x0B,0x18,0x0F,0x06 }; +char* hex_values = "0123456789ABCDEF"; +unsigned short output_vals[6]; + +void substitute(char* input, char* output, int multiply_by) +{ + int i; + char* keyChar; + + i = 0; + keyChar = (char*)(multiply_by * 0x18 + (key)); + for(int i = 0; i < 0x18; i++) { + output[i] = input[*keyChar + -1]; + keyChar ++; + } + output[0x18] = 0; +} + +int the_crazy_math_part(unsigned int val1, unsigned int val2) +{ + int c = 1; + + long long r1 = 0xFFFFFFF9; + long long r0 = val1; + long long r3 = val2; + + // yes this is just the asm implemented in C, dont @ me + + for (int i = 0; i < 4; i++) + { + // adcs r3,r1,r3,lsl 1h + r3 = (r1 + (r3 << 1)) + c; //same as r3 = (r3+(r1 * 2)) + c; + c = (r3 >> 32); // set c flag + r3 &= 0xFFFFFFFF; + + // subcc r3,r3,r1 + if (!c) + { + r3 = (r3 - r1); + r3 &= 0xFFFFFFFF; + } + + // adcs r0,r0,r0 + r0 = r0 + r0 + c; //Same as r0 = (r0 * 2) + c; + c = (r0 >> 32); // set c flag + r0 &= 0xFFFFFFFF; + + } + + return r3; +} + +byte* ascii_to_byte(byte* enc, byte* input) +{ + int i; + int ii; + byte* iii; + byte c; + + c = *enc; + i = 0; + while (1) { + if (c == 0) { + return (byte*)0x0; + } + ii = 0; + iii = enc + i; + while ((c = input[ii], c != 0 && (*iii == c))) { + iii = iii + 1; + ii = ii + 1; + } + if (c == 0) break; + i = i + 1; + c = enc[i]; + } + return enc + i; +} + +int idontunderstandthispartyet(char* system_in, unsigned int maccasId) +{ + int system_in_len; + byte* next_var; + byte* this_char; + byte* extraout_r1; + unsigned int total_iterations; + int i = 0; + int ii = 0; + byte* system_in_2; + unsigned int c; + char* starting_inc; + + total_iterations = 0; + c = maccasId & 0xffff00ff; + system_in_len = strlen(system_in); + starting_inc = hex_values; + system_in_2 = (byte*)system_in; + if (0 < system_in_len) { + do { + system_in_2 = system_in_2 + 1; + c = c & 0xffffff00 | (unsigned int)*system_in_2; + next_var = ascii_to_byte((byte*)starting_inc, (byte*)&c); + this_char = next_var + -(int)starting_inc; + if (next_var == (byte*)0x0) { + this_char = (byte*)0x0; + } + i = i + 1; + total_iterations = (unsigned int)(this_char + total_iterations); + system_in_len = strlen(system_in); + system_in_2 = system_in_2; + } while (i < system_in_len); + } + + // step 2 + + int ret; + unsigned int offset = 7; + + if (offset <= total_iterations) { + i = 0x1c; + ii = total_iterations >> 4; + if ((int)offset <= (int)(total_iterations >> 0x10)) { + i = 0xc; + ii = total_iterations >> 0x14; + } + if ((int)offset <= (int)(ii >> 4)) { + i = i - 8; + ii = ii >> 8; + } + if ((int)offset <= (int)ii) { + i = i - 4; + ii = ii >> 4; + } + + return the_crazy_math_part((total_iterations << (i & 0xff)) * 2, ii); + } + return 0; +} + +int main() +{ + char maccas_id[7]; + char mannager_id[7]; + char mac_address[18]; + char formatted[64]; + char encoded[64]; + char final_key[100]; + char total_output [64]; + printf("eCDP Serial Number Generator (By SilicaAndPina)\n"); + printf("-- A backdoor on the worlds rarest DS game.\n"); + printf("Enter your NDS's Mac Address (without any seperators): "); + gets_s(mac_address, 18); + printf("Enter McDonalds Store Id (first 6 digit entry): "); + gets_s(maccas_id,7); + printf("Enter McDonalds Manager Id (second 6 digit entry): "); + gets_s(mannager_id, 7); + + + snprintf(formatted, 64, "%s%s%s", mac_address, maccas_id, mannager_id); + printf("Formatted Data: %s\n", formatted); + + int multiplier = idontunderstandthispartyet(formatted, (unsigned int)maccas_id); + printf("Multiplier: %x\n", multiplier); + substitute(formatted, encoded, multiplier); + printf("Encoded Data: %s\n", encoded); +} diff --git a/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj new file mode 100644 index 0000000..7cb22b4 --- /dev/null +++ b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj @@ -0,0 +1,155 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {68A9AA05-ACE7-45ED-9054-71C6683EC955} + Win32Proj + eCDPSerialGenerator + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.filters b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.filters new file mode 100644 index 0000000..5b7741d --- /dev/null +++ b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.user b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.user new file mode 100644 index 0000000..0f14913 --- /dev/null +++ b/eCDPSerialGenerator/eCDPSerialGenerator.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file