unidecompiler-plugin-dotnet-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unidecompiler_plugin_dotnet_cli/__init__.py +1 -0
- unidecompiler_plugin_dotnet_cli/assembly.py +675 -0
- unidecompiler_plugin_dotnet_cli/lifter.py +686 -0
- unidecompiler_plugin_dotnet_cli/plugin.py +52 -0
- unidecompiler_plugin_dotnet_cli/support.py +11 -0
- unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/METADATA +21 -0
- unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/RECORD +10 -0
- unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/WHEEL +5 -0
- unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/entry_points.txt +2 -0
- unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from unidecompiler.core.ir import ModuleIR
|
|
4
|
+
from unidecompiler.plugins import FrontendModule
|
|
5
|
+
from unidecompiler_plugin_dotnet_cli.assembly import (
|
|
6
|
+
DnfileAssemblyDecoder,
|
|
7
|
+
DotNetAssemblyDecoder,
|
|
8
|
+
looks_like_dotnet,
|
|
9
|
+
)
|
|
10
|
+
from unidecompiler_plugin_dotnet_cli.lifter import lift_dotnet_assembly
|
|
11
|
+
from unidecompiler_plugin_dotnet_cli.support import DOTNET_CLI_VERSION_SUPPORT
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DotNetFrontendPlugin:
|
|
15
|
+
id = "dotnet-cli"
|
|
16
|
+
display_name = ".NET CLI assembly"
|
|
17
|
+
supported_inputs = (".dll", ".exe")
|
|
18
|
+
version_support = DOTNET_CLI_VERSION_SUPPORT
|
|
19
|
+
|
|
20
|
+
def __init__(self, decoder: DotNetAssemblyDecoder | None = None) -> None:
|
|
21
|
+
self.decoder = decoder or DnfileAssemblyDecoder()
|
|
22
|
+
|
|
23
|
+
def can_load(self, data: bytes, filename: str | None = None) -> bool:
|
|
24
|
+
return looks_like_dotnet(data) and self.decoder.can_decode(data, filename)
|
|
25
|
+
|
|
26
|
+
def decode(self, data: bytes, filename: str | None = None) -> FrontendModule:
|
|
27
|
+
assembly = self.decoder.decode(data, filename)
|
|
28
|
+
return FrontendModule(
|
|
29
|
+
frontend_id=self.id,
|
|
30
|
+
payload=assembly,
|
|
31
|
+
metadata={
|
|
32
|
+
"filename": filename,
|
|
33
|
+
"format": "cli-assembly",
|
|
34
|
+
"version": None,
|
|
35
|
+
"endianness": "little",
|
|
36
|
+
"debug_info_present": False,
|
|
37
|
+
"diagnostics": [],
|
|
38
|
+
"dotnet": {
|
|
39
|
+
"decoder": assembly.decoder_id or self.decoder.id,
|
|
40
|
+
"assembly_name": assembly.name,
|
|
41
|
+
"method_count": len(assembly.methods),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def lift(self, module: FrontendModule) -> ModuleIR:
|
|
47
|
+
if module.frontend_id != self.id:
|
|
48
|
+
raise TypeError(
|
|
49
|
+
f".NET frontend cannot lift module from {module.frontend_id!r}"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return lift_dotnet_assembly(module.payload, module.metadata)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from unidecompiler.plugins import FrontendVersionSupport
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DOTNET_CLI_VERSION_SUPPORT = FrontendVersionSupport(
|
|
7
|
+
family=".NET CLI assembly",
|
|
8
|
+
versions=("ECMA-335 CLI metadata accepted by dnfile",),
|
|
9
|
+
parser="dnfile PE/.NET metadata library",
|
|
10
|
+
status="thin IL step submission",
|
|
11
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unidecompiler-plugin-dotnet-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: .NET CLI assembly frontend plugin for unidecompiler
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: unidecompiler<0.2.0,>=0.1.0
|
|
8
|
+
Requires-Dist: dnfile<1,>=0.15
|
|
9
|
+
|
|
10
|
+
# unidecompiler-plugin-dotnet-cli
|
|
11
|
+
|
|
12
|
+
Frontend plugin for .NET CLI `.dll` and `.exe` assemblies. It uses `dnfile` to
|
|
13
|
+
read assembly metadata and IL, then submits neutral thin IR to `unidecompiler`.
|
|
14
|
+
|
|
15
|
+
Install with:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
python -m pip install unidecompiler-plugin-dotnet-cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The plugin is discovered automatically by compatible CLI and GUI hosts.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
unidecompiler_plugin_dotnet_cli/__init__.py,sha256=RE7kJwvNvFKZQmTHvhX_vYtIBK-yQO-Y2dhtDgQzBo0,48
|
|
2
|
+
unidecompiler_plugin_dotnet_cli/assembly.py,sha256=LJtnApetS_qGhsi-3ydz13tEKjid_gaGtd_oQOYotz0,24387
|
|
3
|
+
unidecompiler_plugin_dotnet_cli/lifter.py,sha256=WWLeMgIswyUpQVExjkznNxkNpA-1C_mxnJ9-fvEsIao,26847
|
|
4
|
+
unidecompiler_plugin_dotnet_cli/plugin.py,sha256=FyoKRZoqBL5X9PA87PpDQIFDOtT3tekmR8LMfi7roko,1922
|
|
5
|
+
unidecompiler_plugin_dotnet_cli/support.py,sha256=2Xig1VcD4FuriyDyAlAe9XYtxZndgqn_CcKL3oopWRM,326
|
|
6
|
+
unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/METADATA,sha256=sgeyCVnxdVe_oKTs0-OfmgJr-a9VRHmSxvxpMaeYg9Q,622
|
|
7
|
+
unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
8
|
+
unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/entry_points.txt,sha256=weBk_t22nMTe9VsrulHIlNT8wkuAFGomlJByP2fH1sc,99
|
|
9
|
+
unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/top_level.txt,sha256=-XhscjKJbq2GLAR7qwxRKqmZd7d9X0numfuYoQmu7oo,32
|
|
10
|
+
unidecompiler_plugin_dotnet_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
unidecompiler_plugin_dotnet_cli
|