Code Monkey home page Code Monkey logo

pdbdownload's Introduction

A Python script to download PDB files associated with a Portable Executable (PE).
GitHub release (latest by date) YouTube Channel Subscribers

Features

  • Download PDB symbols from msdl.microsoft.com.
  • Process a single or a batch of PortableExecutable (PE) files.

Installation

pdbdownload is available on PyPi:

python3 -m pip install pdbdownload

Usage

$ ./pdbdownload.py -h
usage: pdbdownload.py [-h] (-f PE_FILE | -d PE_DIR) [-S SYMBOLS_DIR] [-v]

Description message

optional arguments:
  -h, --help            show this help message and exit
  -f PE_FILE, --pe-file PE_FILE
  -d PE_DIR, --pe-dir PE_DIR
  -S SYMBOLS_DIR, --symbols-dir SYMBOLS_DIR
                        Output dir where symbols will be downloaded.
  -v, --verbose         Verbose mode. (default: False)

Example

To recursively download the PDBs of all executables in a folder, use:

pdbdownload -d . -S .

Contributing

Pull requests are welcome. Feel free to open an issue if you want to add other features.

pdbdownload's People

Contributors

daaximus avatar luke0x90 avatar mrexodia avatar p0dalirius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pdbdownload's Issues

[bug] Updating PyPi version

Hello,

Thank you for this amazing tool.

May I ask you if it's possible to update the version on PyPi ? The PyPi version doesn't seems to integrate fixes of #5 and #6.

Regards.

[enhancement] Gather this code to __init__.py

Here you go

def download_pdb(pathtopefile):
    p = pefile.PE(pathtopefile, fast_load=False)
    pedata = {d.name: d for d in p.OPTIONAL_HEADER.DATA_DIRECTORY}
    raw_debug_data = [e for e in p.parse_debug_directory(pedata["IMAGE_DIRECTORY_ENTRY_DEBUG"].VirtualAddress, pedata["IMAGE_DIRECTORY_ENTRY_DEBUG"].Size) if e.entry is not None]
    raw_debug_data = raw_debug_data[0].entry
    pdbname: str = raw_debug_data.PdbFileName.strip(b'\x00').decode("utf-8")
    signature: str = p.DIRECTORY_ENTRY_DEBUG[0].entry.Signature_String
    # If an absolute path is embedded the server uses just the filename
    pdbname = pdbname.split("\\")[-1]
    download_url = "https://msdl.microsoft.com/download/symbols/%s/%s/%s" % (pdbname, signature.upper(), pdbname)
    r = requests.head(
        download_url,
        headers={"User-Agent": "Microsoft-Symbol-Server/10.0.10036.206"},
        allow_redirects=True
    )
    if r.status_code == 200:
        return r.content
    else:
        return None

Originally posted by @p0dalirius in #8 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.