scripts icon indicating copy to clipboard operation
scripts copied to clipboard

Automate downloading, extracting and updating of cab files

Open SkyLined opened this issue 9 years ago • 0 comments

In order to automate a few manual steps and to make it easier to do this in bulk, I added scripts that can download and extract PDB files from the Microsoft Symbol server and then apply the type information from one of these files to another.

PDBTypeCopy.py is the main script. Usage:

PDBTypeCopy.py [binary file name] [from hash] [to hash] [symbol cache folder]

Where:

  • binary file name = the binary for which to download and update PDB-s (e.g. ntdll.dll)

  • from hash = the PDB's hash from which to copy type information.

  • to hash = the PDB's hash to which to copy type information.

  • symbol cache folder = the symbol cache folder in which to download and update the files. Example:

    H:\dev\py\scripts>PDBTypeCopy.py ntdll.pdb 6610BBDECCA44BA5B080A03FA694E08C2 00C54168286C479D81823570A9C442462 c:\symbols

    • Downloading PDB Cab file for ntdll.pdb @ 6610BBDECCA44BA5B080A03FA694E08C2...
      • Cab file size: 628446 bytes.
    • Extracting PDB Cab file to c:\symbols\ntdll.pdb\6610BBDECCA44BA5B080A03FA694E08C2...
      • PDB file size: 2124800 bytes.
    • Downloading PDB Cab file for ntdll.pdb @ 00C54168286C479D81823570A9C442462...
      • Cab file size: 624210 bytes.
    • Extracting PDB Cab file to c:\symbols\ntdll.pdb\00C54168286C479D81823570A9C442462...
      • PDB file size: 2132992 bytes.
    • Copying PDB type data...
    • Saving updated PDB file...
      • PDB file size: 2117668 bytes.

fbDownloadPDB.py is a helper script to download a Cab PDB file from the Microsoft symbol server and extract the PDB into a given symbol cache folder.

fbCopyPDBTypeData.py is a helper script that contains a copy of the "type_theft" function with minor changes to fit the code and output style of the rest of my code.

ExpandCab.ps1 is a powershell script that can extract a cab file to a folder (used by fbDownloadPDB.py)

Please have a look, optionally update the code style to fit yours and merge if you think others will find it useful.

SkyLined avatar Oct 26 '15 11:10 SkyLined