Skip to main content

Parse .NET executable files.

Project description

dnfile

https://img.shields.io/pypi/v/dnfile.svg

Parse .NET executable files.

  • Free software: MIT license

Features

  • Parse as much as we can, even if the file is partially malformed.

  • Easy to use. Developed with IDE autocompletion in mind.

Quick Start

pip install dnfile

Then create a simple program that loads a .NET binary, parses it, and displays information about the streams and Metadata Tables.

import sys
import dnfile

filepath = sys.argv[1]

pe = dnfile.dnPE(filepath)
pe.print_info()

Everything is an object, and raw structure values are stored in an object’s “struct” attribute. The CLR directory entry object is accessible from the “net” attribute of a dnPE object.

pe = dnfile.dnPE(FILEPATH)

# access the directory entry raw structure values
pe.net.struct

# access the metadata raw structure values
pe.net.metadata.struct

# access the streams
for s in pe.net.metadata.streams_list:
    if isinstance(s, dnfile.stream.MetaDataTables):
        # how many Metadata tables are defined in the binary?
        num_of_tables = len(s.tables_list)

# the first Metadata tables stream can also be accessed by a shortcut
num_of_tables = len(pe.net.mdtables.tables_list)

TODO

  • CI

  • Documentation on readthedocs

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.7.1 (2021)

  • bugfix: coded index always None

0.7.0 (2021)

  • bugfix: improper data length check

0.6.0 (2021)

  • bugfix: referenced wrong object

  • parse utf-16 strings in #US stream

0.5.0 (2021-01-29)

  • First release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dnfile-0.7.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

dnfile-0.7.1-py2.py3-none-any.whl (30.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dnfile-0.7.1.tar.gz.

File metadata

  • Download URL: dnfile-0.7.1.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.10

File hashes

Hashes for dnfile-0.7.1.tar.gz
Algorithm Hash digest
SHA256 d128e4d64d3fbb9f6df55f67044cc3d297028a269658e4d4b01fcfe676f2613f
MD5 85014bd0e614d60bed4868378fc0c9fb
BLAKE2b-256 2595b3fcd7a39f6fa88ceb3e94fbfd3952e03c9c8523565463a697e0a9a0504f

See more details on using hashes here.

Provenance

File details

Details for the file dnfile-0.7.1-py2.py3-none-any.whl.

File metadata

  • Download URL: dnfile-0.7.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.10

File hashes

Hashes for dnfile-0.7.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cbb598db1a1a7040ad9c9ad48804712fa6c54a4218611f5cebfdf1d55112a566
MD5 d4f6be6a3876252438ce62d135ebaab4
BLAKE2b-256 29a7d77f0e4e5aa471178b4089bb3d01630ae7a0cf9703d5764106f0414a3857

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page