mirror of https://github.com/CIRCL/PyCIRCLean
Fix description for ooxml files
parent
17b453af20
commit
e20035e325
|
@ -219,12 +219,10 @@ class File(FileBase):
|
||||||
for mt in Config.mimes_rtf:
|
for mt in Config.mimes_rtf:
|
||||||
if mt in self.subtype:
|
if mt in self.subtype:
|
||||||
self.add_description('Rich Text (rtf) file')
|
self.add_description('Rich Text (rtf) file')
|
||||||
# TODO: need a way to convert it to plain text
|
|
||||||
self.force_ext('.txt')
|
self.force_ext('.txt')
|
||||||
return
|
return
|
||||||
for mt in Config.mimes_ooxml:
|
for mt in Config.mimes_ooxml:
|
||||||
if mt in self.subtype:
|
if mt in self.subtype:
|
||||||
self.add_description('OOXML (openoffice) file')
|
|
||||||
self._ooxml()
|
self._ooxml()
|
||||||
return
|
return
|
||||||
self.add_description('Plain text file')
|
self.add_description('Plain text file')
|
||||||
|
@ -240,7 +238,6 @@ class File(FileBase):
|
||||||
|
|
||||||
def _executables(self):
|
def _executables(self):
|
||||||
"""Process an executable file."""
|
"""Process an executable file."""
|
||||||
# LOG: change the processing_type property to some other name or include in file_string
|
|
||||||
self.make_dangerous('Executable file')
|
self.make_dangerous('Executable file')
|
||||||
|
|
||||||
def _winoffice(self):
|
def _winoffice(self):
|
||||||
|
@ -275,6 +272,7 @@ class File(FileBase):
|
||||||
|
|
||||||
def _ooxml(self):
|
def _ooxml(self):
|
||||||
"""Process an ooxml file."""
|
"""Process an ooxml file."""
|
||||||
|
self.add_description('OOXML (openoffice) file')
|
||||||
try:
|
try:
|
||||||
doc = officedissector.doc.Document(self.src_path)
|
doc = officedissector.doc.Document(self.src_path)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -292,6 +290,7 @@ class File(FileBase):
|
||||||
if len(doc.features.embedded_packages) > 0:
|
if len(doc.features.embedded_packages) > 0:
|
||||||
self.make_dangerous('Ooxml file with embedded packages')
|
self.make_dangerous('Ooxml file with embedded packages')
|
||||||
|
|
||||||
|
|
||||||
def _libreoffice(self):
|
def _libreoffice(self):
|
||||||
"""Process a libreoffice file."""
|
"""Process a libreoffice file."""
|
||||||
# As long as there is no way to do a sanity check on the files => dangerous
|
# As long as there is no way to do a sanity check on the files => dangerous
|
||||||
|
@ -312,7 +311,6 @@ class File(FileBase):
|
||||||
"""Process a PDF file."""
|
"""Process a PDF file."""
|
||||||
xmlDoc = PDFiD(self.src_path)
|
xmlDoc = PDFiD(self.src_path)
|
||||||
oPDFiD = cPDFiD(xmlDoc, True)
|
oPDFiD = cPDFiD(xmlDoc, True)
|
||||||
# TODO: are there other pdf characteristics which should be dangerous?
|
|
||||||
if oPDFiD.encrypt.count > 0:
|
if oPDFiD.encrypt.count > 0:
|
||||||
self.make_dangerous('Encrypted pdf')
|
self.make_dangerous('Encrypted pdf')
|
||||||
if oPDFiD.js.count > 0 or oPDFiD.javascript.count > 0:
|
if oPDFiD.js.count > 0 or oPDFiD.javascript.count > 0:
|
||||||
|
@ -437,7 +435,6 @@ class File(FileBase):
|
||||||
using PIL.Image, saves it to the temporary directory, and copies it to
|
using PIL.Image, saves it to the temporary directory, and copies it to
|
||||||
the destination.
|
the destination.
|
||||||
"""
|
"""
|
||||||
# TODO: make sure this method works for png, gif, tiff
|
|
||||||
if self.has_metadata:
|
if self.has_metadata:
|
||||||
self.extract_metadata()
|
self.extract_metadata()
|
||||||
tempdir_path = self.make_tempdir()
|
tempdir_path = self.make_tempdir()
|
||||||
|
|
Loading…
Reference in New Issue