Skip to content

Commit

Permalink
improve dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
pr701 committed Sep 22, 2021
1 parent 9a297cd commit 2b71180
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,4 @@ FodyWeavers.xsd
*.tlog

# End of https://www.toptal.com/developers/gitignore/api/visualstudio,c++
/vc/ida.key
154 changes: 111 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,41 @@ Products
57-B813-7E44-DB 1 2016-04-08 Never x86 Decompiler (Windows)

Signature:
Key Number: 25143
Key Version: 680
License Type: Named
User Number: 0
Reserved0: -1
Reserved1: -1
Started: 2015-05-25 19:07:13
Expires: Never
Support Exp: Never
License ID: 48-3255-7514-28
Username: Giancarlo Russo, HT Srl
Version Flag: 0x07
MD5: 1A 7C 54 CF 96 02 83 23 F7 07 4C 05 5B B3 B5 05
Key Number:
25143
37 62
Key Version:
680
A8 02
License Type:
Named
01 00
User Number:
0
00 00
Reserved0:
-1
FF FF FF FF
Reserved1:
-1
FF FF FF FF
Started:
2015-05-25 19:07:13
B1 48 63 55
Expires:
Never
00 00 00 00
Support Exp:
Never
00 00 00 00
License ID:
48-3255-7514-28
Username:
Giancarlo Russo, HT Srl
Version Flag:
0x00000007
MD5:
1A 7C 54 CF 96 02 83 23 F7 07 4C 05 5B B3 B5 05

Save signature to: "sign.bin"
Signature saved
Expand All @@ -84,45 +106,91 @@ Binary MD5: 37 5F 8D 73 1F 74 AC A9 4B 28 4B 17 46 41 DF D2

Original User:
Pirated Key: 0
Key Number: 6279
Key Version: 700
License Type: Named
User Number: 0
Reserved0: -1
Reserved1: -1
Started: 2017-09-21 10:18:24
Expires: Never
Support Exp: Never
License ID: 48-3FBD-7F04-2C
Username: Jiang Ying, Personal license
Version Flag: 0x0f
MD5: D5 6B 3D 90 90 36 99 51 1D 71 D9 64 1C 2B 21 C9
Key Number:
6279
87 18
Key Version:
700
BC 02
License Type:
Named
01 00
User Number:
0
00 00
Reserved0:
-1
FF FF FF FF
Reserved1:
-1
FF FF FF FF
Started:
2017-09-21 10:18:24
C0 67 C3 59
Expires:
Never
00 00 00 00
Support Exp:
Never
00 00 00 00
License ID:
48-3FBD-7F04-2C
Username:
Jiang Ying, Personal license
Version Flag:
0x0000000f
MD5:
D5 6B 3D 90 90 36 99 51 1D 71 D9 64 1C 2B 21 C9

User1:
License Type: Named
User Number: 1
Reserved0: ffffffff
Reserved1: ffffffff
Started: 2017-09-21 10:18:24
Expires: Never
Support Exp: 2018-09-21 02:00:00
License ID: 48-3FBD-7F04-2C
Username: Jiang Ying, Personal license
Version Flag: 0x0f
MD5: D5 6B 3D 90 90 36 99 51 1D 71 D9 64 1C 2B 21 C9
License Type:
Named
01 00
User Number:
1
01 00
Reserved0:
ffffffff
FF FF FF FF
Reserved1:
ffffffff
FF FF FF FF
Started:
2017-09-21 10:18:24
C0 67 C3 59
Expires:
Never
00 00 00 00
Support Exp:
2018-09-21 02:00:00
70 26 A4 5B
License ID:
48-3FBD-7F04-2C
Username:
Jiang Ying, Personal license
Version Flag:
0x0000000f
MD5:
D5 6B 3D 90 90 36 99 51 1D 71 D9 64 1C 2B 21 C9
```

Get HexRays license from binary:
```bash
ida_key_checker.exe -i hexx64.dll
HEXRAYS_VERSION 7.0.0.170914

IDA ID: 48-3FBD-7F04-2C
Plugin ID: 55-BAE5-8A04-93 (x64)
Username: Jiang Ying, Personal license
Issued: 2017-09-21 10:18:34
Support: 2018-09-21 02:00:00
MD5: af4c3c64e8ba7d137cc75e1574ecbf56
IDA ID:
48-3FBD-7F04-2C
Plugin ID:
55-BAE5-8A04-93 (x64)
Username:
Jiang Ying, Personal license
Issued:
2017-09-21 10:18:34
Support:
2018-09-21 02:00:00
MD5:
af4c3c64e8ba7d137cc75e1574ecbf56
```

## About databases
Expand Down
53 changes: 31 additions & 22 deletions src/ida_cnv_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ namespace ida
}

if (!skip_ver)
cout << "Key Number:" << '\t' << license.keyNumber << endl
<< "Key Version:" << '\t' << license.keyVer << endl;

cout << "License Type:" << '\t' << get_license_type(license.typeLic) << endl
<< "User Number:" << '\t' << license.userNumber << endl
<< "Reserved0:" << '\t' << license.reserved0 << endl
<< "Reserved1:" << '\t' << license.reserved1 << endl
<< "Started:" << '\t' << get_time(license.started, true) << endl
<< "Expires:" << '\t' << get_time(license.expires, true) << endl
<< "Support Exp:" << '\t' << get_time(license.expSupp, true) << endl
<< "License ID:" << '\t' << get_license_id(license.licenseId) << endl
<< "Username:" << '\t' << get_string(license.username, IDA_LIC_USERNAME_SIZE) << endl
<< "Version Flag:" << '\t' << "0x" << setfill('0') << setw(8) << hex << license.versionFlag << endl
<< "MD5:" << '\t' << '\t' << get_hex(license.md5, sizeof(md5_t)) << endl;
cout << "Key Number:" << endl << '\t' << license.keyNumber << endl
<< '\t' << get_hex(&license.keyNumber, sizeof(license.keyNumber)) << endl
<< "Key Version:" << endl << '\t' << license.keyVer << endl
<< '\t' << get_hex(&license.keyVer, sizeof(license.keyVer)) << endl;

cout << "License Type:" << endl << '\t' << get_license_type(license.typeLic) << endl
<< '\t' << get_hex(&license.typeLic, sizeof(license.typeLic)) << endl
<< "User Number:" << endl << '\t' << license.userNumber << endl
<< '\t' << get_hex(&license.userNumber, sizeof(license.userNumber)) << endl
<< "Reserved0:" << endl << '\t' << license.reserved0 << endl
<< '\t' << get_hex(&license.reserved0, sizeof(license.reserved0)) << endl
<< "Reserved1:" << endl << '\t' << license.reserved1 << endl
<< '\t' << get_hex(&license.reserved1, sizeof(license.reserved1)) << endl
<< "Started:" << endl << '\t' << get_time(license.started, true) << endl
<< '\t' << get_hex(&license.started, sizeof(license.started)) << endl
<< "Expires:" << endl << '\t' << get_time(license.expires, true) << endl
<< '\t' << get_hex(&license.expires, sizeof(license.expires)) << endl
<< "Support Exp:" << endl << '\t' << get_time(license.expSupp, true) << endl
<< '\t' << get_hex(&license.expSupp, sizeof(license.expSupp)) << endl
<< "License ID:" << endl << '\t' << get_license_id(license.licenseId) << endl
<< "Username:" << endl << '\t' << get_string(license.username, IDA_LIC_USERNAME_SIZE) << endl
<< "Version Flag:" << endl << '\t' << "0x" << setfill('0') << setw(8) << hex << license.versionFlag << endl
<< "MD5:" << endl << '\t' << get_hex(license.md5, sizeof(md5_t)) << endl;
}

void print_rays_license(const rays_license_t& license)
Expand All @@ -52,8 +61,8 @@ namespace ida
{ 0x57, "x86" },
};

cout << "IDA ID:" << '\t' << '\t' << get_license_id(license.ida_id) << endl
<< "Plugin ID:" << '\t' << get_license_id(license.plugin_id);
cout << "IDA ID:" << endl << '\t' << get_license_id(license.ida_id) << endl
<< "Plugin ID:" << endl << '\t' << get_license_id(license.plugin_id);

for (const auto& p : k_pair)
if (p.id == license.plugin_id[0])
Expand All @@ -62,10 +71,10 @@ namespace ida
break;
}
cout << endl
<< "Username:" << '\t' << get_string(license.name, sizeof(license.name)) << endl
<< "Issued:" << '\t' << '\t' << get_time(license.creation, true) << endl
<< "Support:" << '\t' << get_time(license.support, true) << endl
<< "MD5:" << '\t' << '\t' << get_string(license.md5, sizeof(license.md5)) << endl;
<< "Username:" << endl << '\t' << get_string(license.name, sizeof(license.name)) << endl
<< "Issued:" << endl << '\t' << get_time(license.creation, true) << endl
<< "Support:" << endl << '\t' << get_time(license.support, true) << endl
<< "MD5:" << endl << '\t' << get_string(license.md5, sizeof(license.md5)) << endl;
}

string get_license_type(uint16_t type)
Expand Down Expand Up @@ -135,15 +144,15 @@ namespace ida
return string(buf.c_str());
}

string get_hex(const uint8_t* data, size_t size)
string get_hex(const void* data, size_t size)
{
if (!data || !size) return "null";

string result;
for (size_t i = 0; i < size; ++i)
{
char val[8] = { 0 };
sprintf_s(val, 8, "%02X", data[i]);
sprintf_s(val, 8, "%02X", reinterpret_cast<const uint8_t*>(data)[i]);
result.append(val);
if (i != size - 1) result.append(" ");
}
Expand Down
2 changes: 1 addition & 1 deletion src/ida_cnv_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace ida
string get_license_id(const id_t& id);
string get_time(time_t time, bool extended = false);
string get_string(const char* str, size_t limit);
string get_hex(const uint8_t* data, size_t size);
string get_hex(const void* data, size_t size);
string get_hex(const string& value);

template<typename T>
Expand Down
23 changes: 18 additions & 5 deletions src/ida_key_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ int check_idb_user(path idb_database, path signature_file = "")

string originaluser = id0.getdata(id0.node("$ original user"), 'S', 0);
string user1 = id0.getdata(id0.node("$ user1"), 'S', 0);
string evaluser;

license_t license;
signature_t signature;
Expand All @@ -206,7 +207,7 @@ int check_idb_user(path idb_database, path signature_file = "")

if (originaluser.empty())
{
cout << endl << "OriginalUser block not present" << endl;
cout << endl << "OriginalUser block doesn't present" << endl;
}
else
{
Expand All @@ -218,7 +219,10 @@ int check_idb_user(path idb_database, path signature_file = "")
{
// check evaluation version
license_t* license = reinterpret_cast<license_t*>(&signature[0] - 1);
if (!memcmp(license->username, "Evaluation version", 18))
evaluser = get_string(license->username, IDA_LIC_USERNAME_SIZE);

if (!evaluser.compare("Evaluation version") ||
!evaluser.compare("Freeware version"))
{
is_pirated = false;
is_evaluation = true;
Expand All @@ -231,9 +235,18 @@ int check_idb_user(path idb_database, path signature_file = "")

cout << endl << "Original User:" << endl
<< "Pirated Key:" << '\t' << is_pirated << endl;
if (is_evaluation) cout << "Evaluation Key:" << '\t' << is_evaluation << endl;

if (is_decrypted) print_license(license);
if (is_evaluation)
{
cout << "Evaluation Key:" << '\t' << is_evaluation << endl
<< "User: " << '\t' << evaluser << endl;
}
else
{
if (is_decrypted)
print_license(license);
else
cout << "Error: Unknown decryption key." << endl;
}

if (!signature_file.empty())
{
Expand Down
8 changes: 4 additions & 4 deletions vc/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,0
FILEVERSION 1,2,0,0
PRODUCTVERSION 1,2,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "RnD"
VALUE "FileDescription", "IDA Key Checker"
VALUE "FileVersion", "1.1.0.0"
VALUE "FileVersion", "1.2.0.0"
VALUE "InternalName", "ida_key_.exe"
VALUE "LegalCopyright", "RnD, 2021"
VALUE "OriginalFilename", "ida_key_checker.exe"
VALUE "ProductName", "ida_key_checker"
VALUE "ProductVersion", "1.1.0.0"
VALUE "ProductVersion", "1.2.0.0"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 4 additions & 2 deletions vc/ida_key_checker.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;IDB_ZLIB_COMPRESSION_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\..\zlib;..\..\idb3\include;..\..\cxxopts\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\zlib\projects\visualc6\Win64_LIB_Release\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -147,7 +148,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;_LIB;IDB_ZLIB_COMPRESSION_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>..\..\zlib;..\..\idb3\include;..\..\cxxopts\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand All @@ -157,6 +158,7 @@
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>..\..\zlib\projects\visualc6\Win64_LIB_Release\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit 2b71180

Please sign in to comment.