Add VGS provider from VGSNAG2

This commit is contained in:
JinGen Lim 2021-07-02 10:47:44 +08:00
parent 67ea57be10
commit bcb77faa30
5 changed files with 74 additions and 23 deletions

View File

@ -6,6 +6,8 @@ Free, open-source ECU seed-key unlocking tool.
## Getting started ## Getting started
[Try it out here in your browser](https://unlockecu.sn.sg/), or read more on how to use a local, offline copy:
Download and unarchive the application from the [Releases](https://github.com/jglim/UnlockECU/releases/) page, then run the main application `VisualUnlockECU.exe`. Download and unarchive the application from the [Releases](https://github.com/jglim/UnlockECU/releases/) page, then run the main application `VisualUnlockECU.exe`.
Ensure that you have *.NET Desktop Runtime 5.0.0*. , available from [here](https://dotnet.microsoft.com/download/dotnet/5.0). Ensure that you have *.NET Desktop Runtime 5.0.0*. , available from [here](https://dotnet.microsoft.com/download/dotnet/5.0).
@ -14,9 +16,7 @@ Ensure that you have *.NET Desktop Runtime 5.0.0*. , available from [here](https
MIT MIT
Icon from [http://www.famfamfam.com/lab/icons/silk/](http://www.famfamfam.com/lab/icons/silk/) This application **does not include or require copyrighted or proprietary files**. Security functions and definitions have been reverse-engineered and reimplemented.
Excluding the icon, this application **does not include or require copyrighted or proprietary files**. Security functions and definitions have been reverse-engineered and reimplemented.
*When interacting with this repository (PR, issues, comments), please avoid including copyrighted/proprietary files, as they will be removed without notice.* *When interacting with this repository (PR, issues, comments), please avoid including copyrighted/proprietary files, as they will be removed without notice.*
@ -40,25 +40,26 @@ Here is an example of a definition:
``` ```
{ {
"EcuName": "ME97", "EcuName": "ME97",
"AccessLevel": 5, "Aliases": [],
"SeedLength": 2, "AccessLevel": 1,
"KeyLength": 2, "SeedLength": 2,
"Provider": "PowertrainBoschContiSecurityAlgo2", "KeyLength": 2,
"Origin": "ME97_ME97_13_10_01", "Provider": "PowertrainBoschContiSecurityAlgo1",
"Parameters": [ "Origin": "ME97_ME97_13_10_01_J",
{ "Parameters": [
"Key": "Table", {
"Value": "37C1A8179AE3745B", "Key": "ubTable",
"DataType": "ByteArray" "Value": "FCAD1E5941992FCD",
}, "DataType": "ByteArray"
{ },
"Key": "uwMasc", {
"Value": "4108", "Key": "Mask",
"DataType": "ByteArray" "Value": "4300",
} "DataType": "ByteArray"
] }
} ]
}
``` ```
Currently, these security providers are available: Currently, these security providers are available:
@ -82,6 +83,8 @@ Currently, these security providers are available:
- RDU222 - RDU222
- RVC222_MPC222_FCW246_LRR3 - RVC222_MPC222_FCW246_LRR3
- SWSP177 - SWSP177
- VGSSecurityAlgo
- VolkswagenSA2
The definitions file `db.json` should be found alongside the application's main binary. The definitions file `db.json` should be found alongside the application's main binary.

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
namespace UnlockECU
{
/// <summary>
/// Implementation of VGS Algo from VGSNAG2
/// No formal name was found for this provider and it may be renamed in the future.
/// </summary>
class VGSSecurityAlgo : SecurityProvider
{
public override bool GenerateKey(byte[] inSeed, byte[] outKey, int accessLevel, List<Parameter> parameters)
{
byte[] cryptoKeyBytes = GetParameterBytearray(parameters, "K");
uint cryptoKey = BytesToInt(cryptoKeyBytes, Endian.Big);
if ((inSeed.Length != 4) || (outKey.Length != 4))
{
return false;
}
long seed = BytesToInt(inSeed, Endian.Big);
long seedKey = cryptoKey * (cryptoKey ^ seed);
IntToBytes((uint)seedKey, outKey, Endian.Big);
return true;
}
public override string GetProviderName()
{
return "VGSSecurityAlgo";
}
}
}

View File

@ -180,7 +180,6 @@ namespace UnlockECU
// Console.WriteLine($"IP: 0x{InstructionPointer:X} Reg: 0x{Register:X8} CF: 0x{CarryFlag:X8} Op: {instructionSet[InstructionTape[InstructionPointer]].Method.Name} "); // Console.WriteLine($"IP: 0x{InstructionPointer:X} Reg: 0x{Register:X8} CF: 0x{CarryFlag:X8} Op: {instructionSet[InstructionTape[InstructionPointer]].Method.Name} ");
instructionSet[InstructionTape[InstructionPointer]](); instructionSet[InstructionTape[InstructionPointer]]();
} }
Console.WriteLine($"Exec done, reg = 0x{Register:X8}");
return Register; return Register;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -8684,5 +8684,21 @@
"DataType": "ByteArray" "DataType": "ByteArray"
} }
] ]
},
{
"EcuName": "VGSNAG2",
"Aliases": [],
"AccessLevel": 17,
"SeedLength": 4,
"KeyLength": 4,
"Provider": "VGSSecurityAlgo",
"Origin": "VGSNAG2_vgsnag2_sec_12_06_01",
"Parameters": [
{
"Key": "K",
"Value": "1E71744E",
"DataType": "ByteArray"
}
]
} }
] ]