Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Drop openxmllib as it doesn't work for Python 3.

smicallef940a46757ca7
diff --git a/modules/sfp_filemeta.py b/modules/sfp_filemeta.py
index fddaa52d..3fbccfc3 100644
--- a/modules/sfp_filemeta.py
+++ b/modules/sfp_filemeta.py
@@ -13,7 +13,8 @@
import mimetypes
import PyPDF2
-import openxmllib
+import docx
+import pptx
import exifread
import lxml
from StringIO import StringIO
@@ -25,7 +26,7 @@ class sfp_filemeta(SpiderFootPlugin):
# Default options
opts = {
- 'fileexts': ["docx", "pptx", 'xlsx', 'pdf', 'jpg', 'jpeg', 'tiff', 'tif'],
+ 'fileexts': ["docx", "pptx", 'pdf', 'jpg', 'jpeg', 'tiff', 'tif'],
'timeout': 300
}
@@ -103,21 +104,31 @@ class sfp_filemeta(SpiderFootPlugin):
eventData + "(" + str(e) + ")", False)
return None
- if fileExt.lower() in ["pptx", "docx", "xlsx"]:
+ if fileExt.lower() in ["docx"]:
try:
+ c = StringIO(ret['content'])
+ doc = docx.Document(c)
mtype = mimetypes.guess_type(eventData)[0]
- doc = openxmllib.openXmlDocument(data=ret['content'], mime_type=mtype)
- self.sf.debug("Office type: " + doc.mimeType)
- data = doc.allProperties
- meta = str(data)
- except ValueError as e:
- self.sf.error("Unable to parse meta data from: " +
- eventData + "(" + str(e) + ")", False)
- return None
- except lxml.etree.XMLSyntaxError as e:
- self.sf.error("Unable to parse XML within: " +
+ self.sf.debug("Office type: " + str(mtype))
+ a = doc.core_properties.author
+ c = doc.core_properties.comments
+ data = filter(None, [a, c])
+ meta = ", ".join(data)
+ except BaseException as e:
+ self.sf.error("Unable to process file: " +
eventData + "(" + str(e) + ")", False)
return None
+
+ if fileExt.lower() in ["pptx"]:
+ try:
+ c = StringIO(ret['content'])
+ doc = pptx.Presentation(c)
+ mtype = mimetypes.guess_type(eventData)[0]
+ self.sf.debug("Office type: " + str(mtype))
+ a = doc.core_properties.author
+ c = doc.core_properties.comments
+ data = filter(None, [a, c])
+ meta = ", ".join(data)
except BaseException as e:
self.sf.error("Unable to process file: " +
eventData + "(" + str(e) + ")", False)
diff --git a/modules/sfp_openstreetmap.py b/modules/sfp_openstreetmap.py
index 4f894a01..984b1248 100644
--- a/modules/sfp_openstreetmap.py
+++ b/modules/sfp_openstreetmap.py
@@ -11,12 +11,11 @@
# Licence: GPL
# -------------------------------------------------------------------------------
-import json
try:
import re2 as re
except ImportError as e:
import re
-
+import json
import time
import urllib
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
diff --git a/requirements.txt b/requirements.txt
index 48c5b334..f27a2e11 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,5 +15,6 @@ PyPDF2>=1.26.0
stem>=1.7.1
python-whois>=0.7.1
future
-openxmllib>=1.1.1
pyOpenSSL>=16.2.0
+python-docx>=0.8.10
+python-pptx>=0.6.18