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.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.6.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

dnfile-0.6.0-py2.py3-none-any.whl (30.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: dnfile-0.6.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

File hashes

Hashes for dnfile-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3ecff2501d920f225030c6030277daf9ff8985b092d818153b030d4519b24a74
MD5 2b3aeabd94440d0f751542745f28e87c
BLAKE2b-256 1d183eab0016e020571e46692c494401087dd76369c199e2f502480e2963ec18

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: dnfile-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9

File hashes

Hashes for dnfile-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f71c89c791dd003b32a0a626c965453765d0b3a2e8755b570a79774a7d1ad5a6
MD5 b13f35bdb7f9390e4525ab93ed06e5ef
BLAKE2b-256 016b2c933250dd41bafed9033348d65792415e10aeff523815c7bcf729bf17e3

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