Metadata-Version: 2.4
Name: dnpy
Version: 1.0.0
Summary: A library for reading .NET modules
Author-email: "Utku Corbaci (rhotav)" <utku@rhotav.com>
Maintainer-email: "Utku Corbaci (rhotav)" <utku@rhotav.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/rhotav/dnpy
Project-URL: Repository, https://github.com/rhotav/dnpy
Project-URL: Documentation, https://github.com/rhotav/dnpy#readme
Project-URL: Bug Tracker, https://github.com/rhotav/dnpy/issues
Keywords: dotnet,.net,parser,disassembly
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pefile>=2024.8.26
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Dynamic: license-file

# dnpy

A pure-Python library for parsing .NET assemblies. It reads PE files
containing ECMA-335 metadata and CIL bytecode, and exposes them through a
typed object model.

The current focus is reading. Writing assemblies back to disk is deliberately
out of scope until the read path is fully hardened

## Installation

```
pip install dnpy
```

## Quick start

```python
from dnpy import Module

module = Module.from_path("MyAssembly.exe")

if module.assembly:
    a = module.assembly
    print(f"{a.name} v{a.major_version}.{a.minor_version}.{a.build_number}.{a.revision_number}")

for type_def in module.types:
    print(type_def.full_name)
    for method in type_def.methods:
        print(f"  {method.name}")
        for instruction in method.instructions:
            print(f"    {instruction}")
```

`Module.from_bytes(data)` is also available for in-memory binaries.

## Documentation

The [`docs/`](docs/) directory has longer-form material:

- [Getting started](docs/getting-started.md) – installation, the first
  script, and recipes for the most common tasks.
- [Architecture](docs/architecture.md) – how a `Module` is layered on top
  of the PE file, metadata streams, tables, and heaps.
- [Walking IL](docs/walking-il.md) – the instruction stream, branch
  targets, exception handlers, and operand resolution.
- [API reference](docs/api-reference.md) – the public surface of the
  `dnpy.Module`, `TypeDef`, `MethodDef`, and friends.

## Out of scope

The following are not implemented:

- Writing or modifying assemblies
- Reading PDB / `.pdb` symbol files
- Strong-name signing or verification
- Decompilation back to C#

## License

MIT. See [`LICENSE`](LICENSE).
