{"id":13843310,"url":"https://github.com/DissectMalware/XLMMacroDeobfuscator","last_synced_at":"2025-07-11T18:31:25.744Z","repository":{"id":40431204,"uuid":"254221371","full_name":"DissectMalware/XLMMacroDeobfuscator","owner":"DissectMalware","description":"Extract and Deobfuscate XLM macros (a.k.a Excel 4.0 Macros)","archived":false,"fork":false,"pushed_at":"2024-05-05T15:44:11.000Z","size":4757,"stargazers_count":563,"open_issues_count":25,"forks_count":112,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-05-28T12:53:35.325Z","etag":null,"topics":["deobfuscator","emulation","excel-macro","excel-macros","macro-deobfuscator","malware-analysis","parser","xlm","xlm-deobfuscator","xlm-grammar","xlm-interactive-shell","xlm-parser"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DissectMalware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["DissectMalware"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-08T23:13:12.000Z","updated_at":"2024-06-20T23:23:51.552Z","dependencies_parsed_at":"2024-06-20T23:23:50.477Z","dependency_job_id":"3682235e-fca1-4a0e-871d-534a88e5d077","html_url":"https://github.com/DissectMalware/XLMMacroDeobfuscator","commit_stats":{"total_commits":370,"total_committers":17,"mean_commits":"21.764705882352942","dds":"0.42162162162162165","last_synced_commit":"43114164d89b8b3b426144f1fdfeb2ca75d28b92"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/DissectMalware/XLMMacroDeobfuscator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DissectMalware%2FXLMMacroDeobfuscator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DissectMalware%2FXLMMacroDeobfuscator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DissectMalware%2FXLMMacroDeobfuscator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DissectMalware%2FXLMMacroDeobfuscator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DissectMalware","download_url":"https://codeload.github.com/DissectMalware/XLMMacroDeobfuscator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DissectMalware%2FXLMMacroDeobfuscator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264870207,"owners_count":23676180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deobfuscator","emulation","excel-macro","excel-macros","macro-deobfuscator","malware-analysis","parser","xlm","xlm-deobfuscator","xlm-grammar","xlm-interactive-shell","xlm-parser"],"created_at":"2024-08-04T17:01:59.203Z","updated_at":"2025-07-11T18:31:25.372Z","avatar_url":"https://github.com/DissectMalware.png","language":"Python","readme":"# XLMMacroDeobfuscator\nXLMMacroDeobfuscator 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.\n\nIt supports both xls, xlsm, and xlsb formats. \n\nIt uses [xlrd2](https://github.com/DissectMalware/xlrd2), [pyxlsb2](https://github.com/DissectMalware/pyxlsb2) and its own parser to extract cells and other information from xls, xlsb and xlsm files, respectively.\n\nYou can also find XLM grammar in [xlm-macro-lark.template](XLMMacroDeobfuscator/xlm-macro.lark.template)\n\n# Installing the emulator\n\n1. Install using pip\n\n```\npip install XLMMacroDeobfuscator --force\n```\n\nor\n\n```\npip install xlmmacrodeobfuscator[defusedxml] --force\n```\n\n2. Installing the latest development\n\n```\npip install -U https://github.com/DissectMalware/XLMMacroDeobfuscator/archive/master.zip --force\n```\n\n# Running the emulator\nTo deobfuscate macros in Excel documents: \n\n```\nxlmdeobfuscator --file document.xlsm\n```\n\nTo only extract macros in Excel documents (without any deobfuscation): \n\n```\nxlmdeobfuscator --file document.xlsm -x\n```\n\nTo only get the deobfuscated macros and without any indentation:\n\n```\nxlmdeobfuscator --file document.xlsm --no-indent --output-formula-format \"[[INT-FORMULA]]\"\n```\n\nTo export the output in JSON format \n```\nxlmdeobfuscator --file document.xlsm --export-json result.json\n```\nTo see a sample JSON output, please check [this link](https://pastebin.com/bwmS7mi0) out.\n\nTo use a config file\n```\nxlmdeobfuscator --file document.xlsm -c default.config\n```\n\ndefault.config file must be a valid json file, such as:\n\n```json\n{\n\t\"no-indent\": true,\n\t\"output-formula-format\": \"[[CELL-ADDR]] [[INT-FORMULA]]\",\n\t\"non-interactive\": true,\n\t\"output-level\": 1\n}\n```\n\n# Command Line \n\n```\n\n          _        _______\n|\\     /|( \\      (       )\n( \\   / )| (      | () () |\n \\ (_) / | |      | || || |\n  ) _ (  | |      | |(_)| |\n / ( ) \\ | |      | |   | |\n( /   \\ )| (____/\\| )   ( |\n|/     \\|(_______/|/     \\|\n   ______   _______  _______  ______   _______           _______  _______  _______ _________ _______  _______\n  (  __  \\ (  ____ \\(  ___  )(  ___ \\ (  ____ \\|\\     /|(  ____ \\(  ____ \\(  ___  )\\__   __/(  ___  )(  ____ )\n  | (  \\  )| (    \\/| (   ) || (   ) )| (    \\/| )   ( || (    \\/| (    \\/| (   ) |   ) (   | (   ) || (    )|\n  | |   ) || (__    | |   | || (__/ / | (__    | |   | || (_____ | |      | (___) |   | |   | |   | || (____)|\n  | |   | ||  __)   | |   | ||  __ (  |  __)   | |   | |(_____  )| |      |  ___  |   | |   | |   | ||     __)\n  | |   ) || (      | |   | || (  \\ \\ | (      | |   | |      ) || |      | (   ) |   | |   | |   | || (\\ (\n  | (__/  )| (____/\\| (___) || )___) )| )      | (___) |/\\____) || (____/\\| )   ( |   | |   | (___) || ) \\ \\__\n  (______/ (_______/(_______)|/ \\___/ |/       (_______)\\_______)(_______/|/     \\|   )_(   (_______)|/   \\__/\n\n    \nXLMMacroDeobfuscator(v0.2.0) - https://github.com/DissectMalware/XLMMacroDeobfuscator\n\nError: --file is missing\n\nusage: deobfuscator.py [-h] [-c FILE_PATH] [-f FILE_PATH] [-n] [-x]\n                       [--sort-formulas] [--defined-names] [-2]\n                       [--with-ms-excel] [-s] [-d DAY]\n                       [--output-formula-format OUTPUT_FORMULA_FORMAT]\n                       [--extract-formula-format EXTRACT_FORMULA_FORMAT]\n                       [--no-indent] [--silent] [--export-json FILE_PATH]\n                       [--start-point CELL_ADDR] [-p PASSWORD]\n                       [-o OUTPUT_LEVEL] [--timeout N]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c FILE_PATH, --config-file FILE_PATH\n                        Specify a config file (must be a valid JSON file)\n  -f FILE_PATH, --file FILE_PATH\n                        The path of a XLSM file\n  -n, --noninteractive  Disable interactive shell\n  -x, --extract-only    Only extract cells without any emulation\n  --sort-formulas       Sort extracted formulas based on their cell address\n                        (requires -x)\n  --defined-names       Extract all defined names\n  -2, --no-ms-excel     [Deprecated] Do not use MS Excel to process XLS files\n  --with-ms-excel       Use MS Excel to process XLS files\n  -s, --start-with-shell\n                        Open an XLM shell before interpreting the macros in\n                        the input\n  -d DAY, --day DAY     Specify the day of month\n  --output-formula-format OUTPUT_FORMULA_FORMAT\n                        Specify the format for output formulas ([[CELL-ADDR]],\n                        [[INT-FORMULA]], and [[STATUS]]\n  --extract-formula-format EXTRACT_FORMULA_FORMAT\n                        Specify the format for extracted formulas ([[CELL-\n                        ADDR]], [[CELL-FORMULA]], and [[CELL-VALUE]]\n  --no-indent           Do not show indent before formulas\n  --silent              Do not print output\n  --export-json FILE_PATH\n                        Export the output to JSON\n  --start-point CELL_ADDR\n                        Start interpretation from a specific cell address\n  -p PASSWORD, --password PASSWORD\n                        Password to decrypt the protected document\n  -o OUTPUT_LEVEL, --output-level OUTPUT_LEVEL\n                        Set the level of details to be shown (0:all commands,\n                        1: commands no jump 2:important commands 3:strings in\n                        important commands).\n  --timeout N           stop emulation after N seconds (0: not interruption\n                        N\u003e0: stop emulation after N seconds)\n```\n\n# Library\nThe following example shows how XLMMacroDeobfuscator can be used in a python project to deobfuscate XLM macros:\n\n```python\nfrom XLMMacroDeobfuscator.deobfuscator import process_file\n\nresult = process_file(file='path/to/an/excel/file', \n            noninteractive= True, \n            noindent= True, \n            output_formula_format='[[CELL-ADDR]], [[INT-FORMULA]]',\n            return_deobfuscated= True,\n            timeout= 30)\n\nfor record in result:\n    print(record)\n```\n\n* note: the xlmdeofuscator logo will not be shown when you use it as a library\n\n# Requirements\n\nPlease read requirements.txt to get the list of python libraries that XLMMacroDeobfuscator is dependent on.\n\nxlmdeobfuscator 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.\n\nNote: if you want to use MS Excel (on Windows), you need to install pywin32 library and use --with-ms-excel switch.\nIf --with-ms-excel is used, xlmdeobfuscator, first, attempts to load xls files with MS Excel, if it fails it uses [xlrd2 library](https://github.com/DissectMalware/xlrd2).\n\n# Project Using XLMMacroDeofuscator\nXLMMacroDeofuscator is adopted in the following projects:\n* [CAPE Sandbox](https://github.com/ctxis/CAPE)\n* [FAME](https://certsocietegenerale.github.io/fame/)\n* [REMNUX](https://remnux.org/)\n* [IntelOwl](https://github.com/intelowlproject/IntelOwl)\n* [Assemblyline 4](https://cybercentrecanada.github.io/assemblyline4_docs/) by Canadian Centre for Cyber Security \n* [oletools](https://github.com/decalage2/oletools) by [@decalage2](https://twitter.com/decalage2)\n\nPlease contact me if you incorporated XLMMacroDeofuscator in your project.\n\n# How to Contribute\nIf you found a bug or would like to suggest an improvement, please create a new issue on the [issues page](https://github.com/DissectMalware/XLMMacroDeobfuscator/issues).\n\nFeel free to contribute to the project forking the project and submitting a pull request.\n\nYou can reach [me (@DissectMlaware) on Twitter](https://twitter.com/DissectMalware) via a direct message.\n\n","funding_links":["https://github.com/sponsors/DissectMalware"],"categories":["Python","Python (1887)","Reverse Engineering"],"sub_categories":["Malware Articles and Sources"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDissectMalware%2FXLMMacroDeobfuscator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDissectMalware%2FXLMMacroDeobfuscator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDissectMalware%2FXLMMacroDeobfuscator/lists"}