├── README.md └── pyDDE-Extractor-v2.py /README.md: -------------------------------------------------------------------------------- 1 | # DDE-Extractor 2 | This script is used for extracting DDE in docx and xlsx 3 | -------------------------------------------------------------------------------- /pyDDE-Extractor-v2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | ''' 4 | Shitty Codes to extract DDE 5 | by Jacob Soo, @_jsoo_ 6 | 7 | Hashes for samples: 8 | f945105f5a0bc8ea0d62a28ee62883ffc14377b6abec2d0841e88935fd8902d3 9 | 09287128aaf96479f0aca8eedc3c78d3e863aae1368ed9eb62b5c2df98f92810 10 | 58bc300c0ab90fbbb1f51482eaf83ac274429ba81ea581fc56c2ecb2b501bed0 11 | 4654664436b505044cb9609595f3967bcbc8035e75904f81d8610c33268edc74 12 | ''' 13 | 14 | __author__ = "Jacob Soo, @_jsoo_" 15 | __version__ = "0.1" 16 | 17 | import zipfile 18 | import sys, os, re 19 | 20 | def _log(szString): 21 | print(szString) 22 | 23 | def ExtractDDE(szInputFile, szPath): 24 | paragraphs = [] 25 | try: 26 | document = zipfile.ZipFile(szInputFile) 27 | xml_content = document.read(szPath) 28 | document.close() 29 | 30 | matchObj = re.findall(r'(\)|(\(.*?)\<\/w\:instrText\>)|(\(.*?)\<\/w\:instrText>)', xml_content, re.DOTALL|re.UNICODE) 31 | for item in matchObj: 32 | if '' in item[4]: 35 | paragraphs.append(item[5]) 36 | elif '