mirror of
https://github.com/LiEnby/eCDP-Serial-Code.git
synced 2025-04-18 22:18:51 +01:00
add src code to web service ..
This commit is contained in:
parent
e42b16a8f5
commit
141492307f
BIN
Web Service/bg.gif
Normal file
BIN
Web Service/bg.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
Web Service/donald.jpg
Normal file
BIN
Web Service/donald.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
270
Web Service/eCDPSerialGenerator.c
Normal file
270
Web Service/eCDPSerialGenerator.c
Normal file
@ -0,0 +1,270 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
char 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";
|
||||
char* password_chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
||||
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 carry, int start_at)
|
||||
{
|
||||
int c = carry;
|
||||
|
||||
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 = start_at; i < 0x20; 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;
|
||||
}
|
||||
|
||||
|
||||
int find_multiplier(char* system_in)
|
||||
{
|
||||
int total_iterations = 0;
|
||||
int ii = 0;
|
||||
int next_var = 0;
|
||||
|
||||
char* system_in_base_ptr = system_in;
|
||||
char* hex_values_ptr = hex_values;
|
||||
for (int i = 0; i < strlen(system_in_base_ptr); i++)
|
||||
{
|
||||
char c = *system_in++;
|
||||
char characters[2];
|
||||
memset(characters, 0, 2);
|
||||
characters[0] = c;
|
||||
|
||||
char* a2b = strstr(hex_values_ptr, characters);
|
||||
next_var = a2b - (uintptr_t)hex_values_ptr;
|
||||
if (!a2b)
|
||||
next_var = 0;
|
||||
total_iterations += next_var;
|
||||
}
|
||||
// step 2
|
||||
|
||||
unsigned int offset = 7;
|
||||
|
||||
if (offset <= total_iterations)
|
||||
{
|
||||
int c = 0;
|
||||
int start_at = 0x1c;
|
||||
unsigned int r3 = total_iterations >> 4;
|
||||
if (offset <= r3 >> 0xC)
|
||||
{
|
||||
start_at -= 0x10;
|
||||
r3 >>= 0x10;
|
||||
}
|
||||
if (offset <= r3 >> 0x10)
|
||||
{
|
||||
start_at -= 0x8;
|
||||
r3 >>= 0x8;
|
||||
}
|
||||
if (offset <= r3)
|
||||
{
|
||||
start_at -= 0x4;
|
||||
r3 >>= 0x4;
|
||||
}
|
||||
|
||||
unsigned int r0 = total_iterations << (start_at & 0xFF);
|
||||
|
||||
|
||||
c = ((long long int)r0 * 2) > 0xFFFFFFFF;
|
||||
r0 = r0 * 2;
|
||||
|
||||
// printf("Starting Carry: %x\n", c);
|
||||
|
||||
|
||||
return the_crazy_math_part(r0, r3, c, start_at);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int hex_to_bytes(char* input, int iterator)
|
||||
{
|
||||
char* iteration;
|
||||
char* final_char;
|
||||
int result;
|
||||
int i;
|
||||
char* current_char;
|
||||
char* enc = hex_values;
|
||||
result = 0;
|
||||
i = 0;
|
||||
current_char = input + iterator;
|
||||
int ii = 0xc;
|
||||
do {
|
||||
char curChar[2];
|
||||
memset(curChar, 0x00, 2);
|
||||
curChar[0] = current_char[0];
|
||||
|
||||
iteration = strstr(enc, curChar);
|
||||
final_char = iteration + -(intptr_t)enc;
|
||||
if (iteration == (char*)0x0) {
|
||||
final_char = (char*)0x0;
|
||||
}
|
||||
i = i + 1;
|
||||
result = result + ((int)final_char << (ii & 0xff));
|
||||
ii = ii - 4 & 0xffff;
|
||||
current_char = current_char + 1;
|
||||
} while (i < 4);
|
||||
return result & 0xffff;
|
||||
}
|
||||
|
||||
void generate_password(unsigned short* input, char* output)
|
||||
{
|
||||
int i;
|
||||
i = 0;
|
||||
do {
|
||||
output[i] = password_chars[input[i] - 1];
|
||||
i = i + 1;
|
||||
} while (i < 6);
|
||||
output[i] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char maccas_id[64];
|
||||
char mannager_id[64];
|
||||
char mac_address[64];
|
||||
char formatted[64];
|
||||
char encoded[64];
|
||||
char final_key[100];
|
||||
char total_output [64];
|
||||
int iterator = 0;
|
||||
int i = 0;
|
||||
int ii = 0;
|
||||
memset(mac_address, 0x00, 64);
|
||||
memset(maccas_id, 0x00, 64);
|
||||
memset(mannager_id, 0x00, 64);
|
||||
|
||||
if(argc >= 4){
|
||||
strncpy(mac_address,argv[1],63);
|
||||
strncpy(maccas_id,argv[2],63);
|
||||
strncpy(mannager_id,argv[3],63);
|
||||
goto run;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// printf("eCDP Serial Number Generator\n");
|
||||
// printf("Credits: SilicaAndPina (Reversing, writing code), Rufis_ (ARM asm help)\n");
|
||||
// printf("-- A backdoor on the worlds rarest DS game.\n");
|
||||
|
||||
|
||||
entry:
|
||||
|
||||
|
||||
// printf("Enter your NDS's Mac Address (ALL uppercase, no seperators): ");
|
||||
fgets(mac_address, 64, stdin);
|
||||
int len = 0;
|
||||
|
||||
len = strlen(mac_address)-1;
|
||||
mac_address[len] = '\0'; // remove \n
|
||||
if (len != 12)
|
||||
goto entry;
|
||||
|
||||
|
||||
// printf("Enter McDonalds 'Store Number' (first 6 digit entry): ");
|
||||
fgets(maccas_id, 64, stdin);
|
||||
|
||||
len = strlen(maccas_id)-1;
|
||||
maccas_id[len] = '\0';
|
||||
if (len != 6)
|
||||
goto entry;
|
||||
|
||||
|
||||
// printf("Enter McDonalds 'Store Management Number of DS Card' (second 6 digit entry): ");
|
||||
fgets(mannager_id, 64, stdin);
|
||||
|
||||
len = strlen(mannager_id)-1;
|
||||
mannager_id[len] = '\0';
|
||||
if (len != 6)
|
||||
goto entry;
|
||||
|
||||
run:
|
||||
snprintf(formatted, 64, "%s%s%s", mac_address, maccas_id, mannager_id);
|
||||
// printf("Formatted Data: %s\n", formatted);
|
||||
int multiplier = find_multiplier(formatted);
|
||||
// printf("Multiplier: %x\n", multiplier);
|
||||
substitute(formatted, encoded, multiplier);
|
||||
// printf("Encoded Data: %s\n", encoded);
|
||||
unsigned short password_values[6];
|
||||
memset(password_values, 0x00, 6 * 2);
|
||||
|
||||
do {
|
||||
int chr = hex_to_bytes(encoded, iterator);
|
||||
i = ii + 1;
|
||||
password_values[ii] = (unsigned short)chr;
|
||||
iterator = iterator + 4;
|
||||
ii = i;
|
||||
} while (i < 6);
|
||||
|
||||
// printf("Password Values 1: ");
|
||||
// for (int i = 0; i < 6; i++)
|
||||
// {
|
||||
// printf("%x ", password_values[i]);
|
||||
// }
|
||||
// printf("\n");
|
||||
i = 0;
|
||||
ii = 0;
|
||||
do
|
||||
{
|
||||
i = ii;
|
||||
int chr = password_values[ii++];
|
||||
password_values[i] = chr % 33 + 1;
|
||||
} while (ii < 6);
|
||||
// printf("Password Values 2: ");
|
||||
// for (int i = 0; i < 6; i++)
|
||||
// {
|
||||
// printf("%x ", password_values[i]);
|
||||
// }
|
||||
// printf("\n");
|
||||
generate_password(password_values, final_key);
|
||||
printf("%s\n", final_key);
|
||||
|
||||
|
||||
// printf("\n\nThou hast been reversed!\n");
|
||||
// getchar();
|
||||
}
|
BIN
Web Service/eCDPSerialGenerator.elf
Normal file
BIN
Web Service/eCDPSerialGenerator.elf
Normal file
Binary file not shown.
56
Web Service/ecdp.css
Normal file
56
Web Service/ecdp.css
Normal file
@ -0,0 +1,56 @@
|
||||
body{
|
||||
background-image: url("bg.gif");
|
||||
background-repeat: repeat;
|
||||
position: relative;
|
||||
}
|
||||
.keygen{
|
||||
display: inline-block;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
-ms-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding:20px;
|
||||
width:50%;
|
||||
text-align:center;
|
||||
background-color: green;
|
||||
color: white;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.macAddr{
|
||||
width: 60px;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
border-radius: 100%;
|
||||
background-color: black;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.button{
|
||||
width: 60%;
|
||||
margin-top:50px;
|
||||
padding:12px;
|
||||
border-radius: 4px;
|
||||
background-color: yellow;
|
||||
}
|
||||
.entry{
|
||||
width: 60%;
|
||||
padding:12px;
|
||||
border-radius: 4px;
|
||||
background-color: black;
|
||||
color:white;
|
||||
}
|
||||
.leaveOffering{
|
||||
text-align:center;
|
||||
width:100%;
|
||||
padding: 20px;
|
||||
color: white;
|
||||
font-size: 140%;
|
||||
font-weight: bold;
|
||||
}
|
||||
.askRonald{
|
||||
float:left;
|
||||
padding-right: 3%;
|
||||
}
|
BIN
Web Service/favicon.ico
Normal file
BIN
Web Service/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 KiB |
47
Web Service/index.html
Normal file
47
Web Service/index.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<title> McKeygen - Serial Key Generator for eCDP</title>
|
||||
<link rel="stylesheet" type="text/css" href="ecdp.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="keygen">
|
||||
<img src="donald.jpg" class="askRonald" width="228" height="406">
|
||||
<div class="leaveOffering"> Leave an offering for Ronald McDonald </div>
|
||||
DSi Mac Address:<br>
|
||||
<input type="text" id="dsiMac0" class="macAddr" value="00" maxlength="2"> :
|
||||
<input type="text" id="dsiMac1" class="macAddr" value="00" maxlength="2"> :
|
||||
<input type="text" id="dsiMac2" class="macAddr" value="00" maxlength="2"> :
|
||||
<input type="text" id="dsiMac3" class="macAddr" value="00" maxlength="2"> :
|
||||
<input type="text" id="dsiMac4" class="macAddr" value="00" maxlength="2"> :
|
||||
<input type="text" id="dsiMac5" class="macAddr" value="00" maxlength="2"><br>
|
||||
Store Number:<br>
|
||||
<input type="text" id="storeId" class="entry" value="000000" maxlength="6" size="3"><br>
|
||||
Store Management Number of DS Card:
|
||||
<input type="text" id="managementId" class="entry" value="000000" maxlength="6" size="3"><br>
|
||||
<input type="submit" id="generate_password" class="button" value="Place Offering" onclick="placeOffering()">
|
||||
<div id="offering"></div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function placeOffering()
|
||||
{
|
||||
query = "/password.php?mac0="+dsiMac0.value+"&mac1="+dsiMac1.value+"&mac2="+dsiMac2.value+"&mac3="+dsiMac3.value+"&mac4="+dsiMac4.value+"&mac5="+dsiMac5.value+"&store="+storeId.value+"&management="+managementId.value;
|
||||
offering.innerText = "Contacting Ronald McDonald...";
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET",query,true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if(xhr.readyState === XMLHttpRequest.DONE) {
|
||||
var status = xhr.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
offering.innerText = "Ronald McDonald speaks with a cryptic message: "+xhr.responseText;
|
||||
} else {
|
||||
offering.innerText = "Ronald McDonald looks at you, disgusted, throwing your BigMac right back at you.";
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
31
Web Service/password.php
Normal file
31
Web Service/password.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
if(isset($_GET["mac0"]) && isset($_GET["mac1"]) && isset($_GET["mac2"]) && isset($_GET["mac3"]) && isset($_GET["mac4"]) && isset($_GET["mac5"]) && isset($_GET['store']) && isset($_GET['management']))
|
||||
{
|
||||
$full_mac = "";
|
||||
|
||||
$full_mac .= $_GET["mac0"];
|
||||
$full_mac .= $_GET["mac1"];
|
||||
$full_mac .= $_GET["mac2"];
|
||||
$full_mac .= $_GET["mac3"];
|
||||
$full_mac .= $_GET["mac4"];
|
||||
$full_mac .= $_GET["mac5"];
|
||||
$full_mac = strtoupper($full_mac);
|
||||
|
||||
$management = $_GET['management'];
|
||||
$store = $_GET['store'];
|
||||
if((strlen($full_mac) == 12 && preg_match("/[A-F0-9]/",$full_mac)) && (strlen($management) == 6 && preg_match("/[0-9]/",$management)) && (strlen($store) == 6 && preg_match("/[0-9]/",$store)))
|
||||
{
|
||||
echo(exec("./eCDPSerialGenerator.elf ".escapeshellarg($full_mac)." ".escapeshellarg($store)." ".escapeshellarg($management)));
|
||||
exit();
|
||||
}
|
||||
|
||||
http_response_code(500);
|
||||
echo("invalid query");
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
http_response_code(500);
|
||||
echo("invalid request");
|
||||
exit();
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user