All Projects → DissectMalware → Xlmmacrodeobfuscator

DissectMalware / Xlmmacrodeobfuscator

Licence: apache-2.0
Extract and Deobfuscate XLM macros (a.k.a Excel 4.0 Macros)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Xlmmacrodeobfuscator

Vipermonkey
A VBA parser and emulation engine to analyze malicious macros.
Stars: ✭ 697 (+186.83%)
Mutual labels:  parser, emulation, malware-analysis
REW-sploit
Emulate and Dissect MSF and *other* attacks
Stars: ✭ 115 (-52.67%)
Mutual labels:  emulation, malware-analysis
flare-emu
No description or website provided.
Stars: ✭ 561 (+130.86%)
Mutual labels:  emulation, malware-analysis
speakeasy
Windows kernel and user mode emulation.
Stars: ✭ 1,017 (+318.52%)
Mutual labels:  emulation, malware-analysis
Zelos
A comprehensive binary emulation and instrumentation platform.
Stars: ✭ 298 (+22.63%)
Mutual labels:  emulation, malware-analysis
Flare Emu
Stars: ✭ 487 (+100.41%)
Mutual labels:  emulation, malware-analysis
Speakeasy
Windows kernel and user mode emulation.
Stars: ✭ 605 (+148.97%)
Mutual labels:  emulation, malware-analysis
Oletools
oletools - python tools to analyze MS OLE2 files (Structured Storage, Compound File Binary Format) and MS Office documents, for malware analysis, forensics and debugging.
Stars: ✭ 1,848 (+660.49%)
Mutual labels:  parser, malware-analysis
Lief
Authors
Stars: ✭ 2,730 (+1023.46%)
Mutual labels:  parser, malware-analysis
Radare2
UNIX-like reverse engineering framework and command-line toolset
Stars: ✭ 15,412 (+6242.39%)
Mutual labels:  malware-analysis
Drsemu
DrSemu - Sandboxed Malware Detection and Classification Tool Based on Dynamic Behavior
Stars: ✭ 237 (-2.47%)
Mutual labels:  malware-analysis
Vigem
Virtual Gamepad Emulation Framework
Stars: ✭ 225 (-7.41%)
Mutual labels:  emulation
Php Parser
A PHP parser written in PHP
Stars: ✭ 15,101 (+6114.4%)
Mutual labels:  parser
Openswe1r
An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
Stars: ✭ 236 (-2.88%)
Mutual labels:  emulation
Yuzu
Nintendo Switch Emulator
Stars: ✭ 17,405 (+7062.55%)
Mutual labels:  emulation
Mercury Parser Api
🚀 A drop-in replacement for the Mercury Parser API.
Stars: ✭ 239 (-1.65%)
Mutual labels:  parser
Osweep
Don't Just Search OSINT. Sweep It.
Stars: ✭ 225 (-7.41%)
Mutual labels:  malware-analysis
Wiktionaryparser
A Python Wiktionary Parser
Stars: ✭ 224 (-7.82%)
Mutual labels:  parser
Parse5
HTML parsing/serialization toolset for Node.js. WHATWG HTML Living Standard (aka HTML5)-compliant.
Stars: ✭ 2,778 (+1043.21%)
Mutual labels:  parser
Tabloid
A minimal programming language inspired by clickbait headlines
Stars: ✭ 235 (-3.29%)
Mutual labels:  parser

XLMMacroDeobfuscator

XLMMacroDeobfuscator can be used to decode obfuscated XLM macros (also known as Excel 4.0 macros). It utilizes an internal XLM emulator to interpret the macros, without fully performing the code.

It supports both xls, xlsm, and xlsb formats.

It uses xlrd2, pyxlsb2 and its own parser to extract cells and other information from xls, xlsb and xlsm files, respectively.

You can also find XLM grammar in xlm-macro-lark.template

Installing the emulator

  1. Install using pip
pip install XLMMacroDeobfuscator
  1. Installing the latest development
pip install -U https://github.com/DissectMalware/xlrd2/archive/master.zip
pip install -U https://github.com/DissectMalware/pyxlsb2/archive/master.zip
pip install -U https://github.com/DissectMalware/XLMMacroDeobfuscator/archive/master.zip

Running the emulator

To deobfuscate macros in Excel documents:

xlmdeobfuscator --file document.xlsm

To only get the deobfuscated macros and without any indentation:

xlmdeobfuscator --file document.xlsm --no-indent --output-formula-format "[[INT-FORMULA]]"

To export the output in JSON format

xlmdeobfuscator --file document.xlsm --export-json result.json

To see a sample JSON output, please check this link out.

To use a config file

xlmdeobfuscator --file document.xlsm -c default.config

default.config file must be a valid json file, such as:

{
	"no-indent": true,
	"output-formula-format": "[[CELL-ADDR]] [[INT-FORMULA]]",
	"non-interactive": true,
	"output-level": 1
}

Command Line


          _        _______
|\     /|( \      (       )
( \   / )| (      | () () |
 \ (_) / | |      | || || |
  ) _ (  | |      | |(_)| |
 / ( ) \ | |      | |   | |
( /   \ )| (____/\| )   ( |
|/     \|(_______/|/     \|
   ______   _______  _______  ______   _______           _______  _______  _______ _________ _______  _______
  (  __  \ (  ____ \(  ___  )(  ___ \ (  ____ \|\     /|(  ____ \(  ____ \(  ___  )\__   __/(  ___  )(  ____ )
  | (  \  )| (    \/| (   ) || (   ) )| (    \/| )   ( || (    \/| (    \/| (   ) |   ) (   | (   ) || (    )|
  | |   ) || (__    | |   | || (__/ / | (__    | |   | || (_____ | |      | (___) |   | |   | |   | || (____)|
  | |   | ||  __)   | |   | ||  __ (  |  __)   | |   | |(_____  )| |      |  ___  |   | |   | |   | ||     __)
  | |   ) || (      | |   | || (  \ \ | (      | |   | |      ) || |      | (   ) |   | |   | |   | || (\ (
  | (__/  )| (____/\| (___) || )___) )| )      | (___) |/\____) || (____/\| )   ( |   | |   | (___) || ) \ \__
  (______/ (_______/(_______)|/ \___/ |/       (_______)\_______)(_______/|/     \|   )_(   (_______)|/   \__/

    
XLMMacroDeobfuscator(v0.1.7) - https://github.com/DissectMalware/XLMMacroDeobfuscator

usage: deobfuscator.py [-h] [-c FILE_PATH] [-f FILE_PATH] [-n] [-x] [-2]
                       [--with-ms-excel] [-s] [-d DAY]
                       [--output-formula-format OUTPUT_FORMULA_FORMAT]
                       [--no-indent] [--export-json FILE_PATH]
                       [--start-point CELL_ADDR] [-p PASSWORD]
                       [-o OUTPUT_LEVEL]

optional arguments:
  -h, --help            show this help message and exit
  -c FILE_PATH, --config_file FILE_PATH
                        Specify a config file (must be a valid JSON file)
  -f FILE_PATH, --file FILE_PATH
                        The path of a XLSM file
  -n, --noninteractive  Disable interactive shell
  -x, --extract-only    Only extract cells without any emulation
  -2, --no-ms-excel     [Deprecated] Do not use MS Excel to process XLS files
  --with-ms-excel       Use MS Excel to process XLS files
  -s, --start-with-shell
                        Open an XLM shell before interpreting the macros in
                        the input
  -d DAY, --day DAY     Specify the day of month
  --output-formula-format OUTPUT_FORMULA_FORMAT
                        Specify the format for output formulas ([[CELL-ADDR]],
                        [[INT-FORMULA]], and [[STATUS]]
  --no-indent           Do not show indent before formulas
  --export-json FILE_PATH
                        Export the output to JSON
  --start-point CELL_ADDR
                        Start interpretation from a specific cell address
  -p PASSWORD, --password PASSWORD
                        Password to decrypt the protected document
  -o OUTPUT_LEVEL, --output-level OUTPUT_LEVEL
                        Set the level of details to be shown (0:all commands,
                        1: commands no jump 2:important commands 3:strings in
                        important commands).
  --timeout N           stop emulation after N seconds (0: not interruption
                        N>0: stop emulation after N seconds)

Library

The following example shows how XLMMacroDeobfuscator can be used in a python project to deobfuscate XLM macros:

from XLMMacroDeobfuscator.deobfuscator import process_file

result = process_file(file='path/to/an/excel/file', 
            noninteractive= True, 
            noindent= True, 
            output_formula_format='[[CELL_ADDR]], [[INT-FORMULA]]',
            return_deobfuscated= True,
            timeout= 30)

for record in result:
    print(record)
  • note: the xlmdeofuscator logo will not be shown when you use it as a library

Requirements

Please read requirements.txt to get the list of python libraries that XLMMacroDeobfuscator is dependent on.

xlmdeobfuscator can be executed on any OS to extract and deobfuscate macros in xls, xlsm, and xlsb files. You do not need to install MS Excel.

Note: if you want to use MS Excel (on Windows), you need to install pywin32 library and use --with-ms-excel switch. If --with-ms-excel is used, xlmdeobfuscator, first, attempts to load xls files with MS Excel, if it fails it uses xlrd2 library.

Project Using XLMMacroDeofuscator

XLMMacroDeofuscator is adopted in the following projects:

Please contact me if you incorporated XLMMacroDeofuscator in your project.

How to Contribute

If you found a bug or would like to suggest an improvement, please create a new issue on the issues page.

Feel free to contribute to the project forking the project and submitting a pull request.

You can reach me (@DissectMlaware) on Twitter via a direct message.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].