Skip to content

Instantly share code, notes, and snippets.

Last active Dec 7, 2019
What would you like to do?
Script to extract unusual URLs, IPs, etc from OpenXML files using olevba
import sys, zipfile
from oletools.olevba import detect_patterns
# samples:
fname = sys.argv[1]
print(f'Opening {fname}')
if zipfile.is_zipfile(fname):
print('filetype: OpenXML or Zip')
z = zipfile.ZipFile(fname)
for f in z.infolist():
print(f'- subfile: {f.filename}')
data ='utf8', errors='replace')
for description, value in detect_patterns(data):
if not value.startswith('') \
and not value.startswith('') \
and not value.startswith('') \
and not value.startswith(''):
print(f' {value} - {description}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment