not done yet!

This commit is contained in:
Bluzume 2020-11-24 15:40:57 +13:00 committed by GitHub
parent 3542127281
commit 90384f2179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 381 additions and 0 deletions

31
eCDPSerialGenerator.sln Normal file
View File

@ -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

View File

@ -0,0 +1,169 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <Windows.h>
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);
}

View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{68A9AA05-ACE7-45ED-9054-71C6683EC955}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>eCDPSerialGenerator</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="eCDPSerialGenerator.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="eCDPSerialGenerator.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>