{"library":"minidump","title":"Minidump File Parser","description":"minidump is a Python library designed for parsing Windows minidump (.dmp) files. It allows developers and security researchers to programmatically extract information such as modules, threads, handles, and exception data from crash dumps. Currently at version 0.0.24, the library receives updates primarily for bug fixes and feature enhancements related to parsing accuracy and additional stream support.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install minidump"],"cli":null},"imports":["from minidump.minidumpfile import MinidumpFile"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from minidump.minidumpfile import MinidumpFile\nimport os\n\n# For this example, ensure 'example.dmp' exists in the current directory\n# and is a valid Windows minidump file.\n# You can create a dummy file for testing, but real parsing requires a valid minidump.\nminidump_path = os.path.join(os.path.dirname(__file__), 'example.dmp')\n\n# Create a dummy file if it doesn't exist, though it won't be a valid minidump\n# This is just to make the example runnable without crashing on FileNotFoundError\nif not os.path.exists(minidump_path):\n    with open(minidump_path, 'w') as f:\n        f.write('DUMMY MINIDUMP CONTENT - REPLACE WITH REAL .dmp FILE')\n    print(f\"Warning: '{minidump_path}' created as a dummy. Replace with a real minidump for actual parsing.\")\n\ntry:\n    with open(minidump_path, 'rb') as f:\n        md = MinidumpFile.parse(f)\n        print(f\"Successfully parsed minidump: {minidump_path}\")\n        \n        # Accessing common streams\n        if md.modules:\n            print(f\"\\nModules found: {len(md.modules)}\")\n            for module in md.modules[:5]: # Print first 5 modules\n                print(f\"  - {module.name} (Base: {hex(module.baseofdll)})\")\n        \n        if md.threads:\n            print(f\"\\nThreads found: {len(md.threads)}\")\n            for thread in md.threads[:5]: # Print first 5 threads\n                print(f\"  - TID: {thread.threadid}, EIP: {hex(thread.stack.stackptr)}\")\n\n        if md.exceptions:\n            print(f\"\\nException Record found: {md.exceptions.exceptionrecord.exceptioncode}\")\n            \nexcept FileNotFoundError:\n    print(f\"Error: Minidump file not found at '{minidump_path}'. Please ensure it exists.\")\nexcept Exception as e:\n    print(f\"An error occurred during parsing: {e}\")\n\n# Clean up dummy file if it was created and is still dummy content\nif os.path.exists(minidump_path) and os.path.getsize(minidump_path) > 0:\n    with open(minidump_path, 'r') as f:\n        content = f.read(100) # Read first 100 chars\n        if 'DUMMY MINIDUMP CONTENT' in content:\n            os.remove(minidump_path)\n            print(f\"Cleaned up dummy file: '{minidump_path}'.\")","lang":"python","description":"This example demonstrates how to parse a minidump file and access its basic streams like modules, threads, and exception records. It assumes a file named 'example.dmp' exists in the same directory. Note that for actual parsing, 'example.dmp' must be a valid Windows minidump file.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}