Commit 281a2e3c04175161da47e7880af2ab9134afca5c

Authored by Etienne Stalmans
Committed by Philippe Lagadec
1 parent a7938bfa

Adds an additional check to detect DDE (#205)

* Adds an additional check to detect if DDE links exist inside fldSimple values

* clean-up to use TAG_W_INSTRATTR instead of constructing string during parsing
Showing 1 changed file with 9 additions and 1 deletions
oletools/msodde.py
@@ -80,7 +80,8 @@ NS_WORD = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main' @@ -80,7 +80,8 @@ NS_WORD = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'
80 80
81 # XML tag for 'w:instrText' 81 # XML tag for 'w:instrText'
82 TAG_W_INSTRTEXT = '{%s}instrText' % NS_WORD 82 TAG_W_INSTRTEXT = '{%s}instrText' % NS_WORD
83 - 83 +TAG_W_FLDSIMPLE = '{%s}fldSimple' % NS_WORD
  84 +TAG_W_INSTRATTR= '{%s}instr' % NS_WORD
84 85
85 # === FUNCTIONS ============================================================== 86 # === FUNCTIONS ==============================================================
86 87
@@ -111,6 +112,13 @@ def process_file(filepath): @@ -111,6 +112,13 @@ def process_file(filepath):
111 # concatenate the text of the field, if present: 112 # concatenate the text of the field, if present:
112 if elem.text is not None: 113 if elem.text is not None:
113 text += elem.text 114 text += elem.text
  115 +
  116 + for elem in root.iter(TAG_W_FLDSIMPLE):
  117 + # concatenate the attribute of the field, if present:
  118 + if elem.attrib is not None:
  119 + text += elem.attrib[TAG_W_INSTRATTR]
  120 +
  121 +
114 return text 122 return text
115 123
116 124