OpenXML is the standard used for Office documents.
You can think of it as a .zip in a trenchcoat.
Every part of an Excel, PowerPoint, or Word document is saved into an archive.
You can prove this to yourself by renaming any .docx file to .zip.
I sometimes call this the "zip epiphany", because it helps you understand how much technology is really a "zip in a trenchcoat".
(hint: it's much more than just OpenXML files)
This module is here to help you automate, inspect, and understand OpenXML files.
You can install OpenXML from the PowerShell gallery
Install-Module OpenXML -Scope CurrentUser -Force
Once installed, you can simply Import-Module
Import-Module OpenXML- Export-OpenXML
- Get-OpenXML
- Import-OpenXML
- Set-OpenXML
# Get text from a word document Get-OpenXML ./Examples/HelloWorld.docx | Select-Object -ExpandProperty Text
# Get modification times Get-OpenXML ./Examples/HelloWorld.docx | Select-Object -Property Created, Modified
# Get PowerPoint slides Get-OpenXML ./Examples/ASlideDeck.pptx | Select-Object -ExpandProperty Slides
# Get text from PowerPoint Get-OpenXML ./Examples/ASlideDeck.pptx | Select-Object -ExpandProperty Text
# Get worksheets from Excel Get-OpenXML ./Examples/Sample.xlsx | Select-Object -ExpandProperty Worksheets
# Get cells from Excel Get-OpenXML ./Examples/Sample.xlsx | Select-Object -ExpandProperty Worksheets | Select-Object -ExpandProperty Cell
# Get formulas from Excel Get-OpenXML ./Examples/Sum.xlsx | Select-Object -ExpandProperty Worksheets | Select-Object -ExpandProperty Formula
While OpenXML has been around since 2006, this module is considerably younger.
It has a large amount of room to grow.
The primary goal for the forseeable future is to increase coverage of office features. If you would like to help, please consider contributing.
OpenXML presents some unique security challenges.
This module makes OpenXML documents easier to read and write, which can be useful to both red and blue teams. Please see the security guide for more information.