From be23ab471c5b2ca8f58a670eedbe61212f4d3734 Mon Sep 17 00:00:00 2001 From: rk89gc Date: Tue, 19 Jan 2021 21:11:36 +0100 Subject: [PATCH 1/2] - Fixed: when an element has both chart and pseudo-html objects, the document does not fully render. --- src/report.py | 13 +++++-------- src/version.py | 7 +++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/report.py b/src/report.py index 0c621c3..7530250 100755 --- a/src/report.py +++ b/src/report.py @@ -76,7 +76,6 @@ class ns: #__vulnparam_highlighting = True #__truncate = True _pPr_annotation = False - chartIterator = 0 def __init__(self): self._meta_init() @@ -872,10 +871,8 @@ def _xml_apply_chart(self, chart_struct, values): chart_rid = chart.attrib['{%s}id' % self.ns.r] # iterator used for identifying copies of charts - self.chartIterator += 1 - chartNewId = chart_rid + 'copy' + str(self.chartIterator) - - chart.attrib['{%s}id' % self.ns.r] = chartNewId + newId = self._openxml.new_rel_id() + chart.attrib['{%s}id' % self.ns.r] = "rId" + str(newId) # charts/chart.xml chart_rel = filter(lambda x: x.attrib['Id'] == chart_rid and x.attrib[ @@ -883,9 +880,9 @@ def _xml_apply_chart(self, chart_struct, values): etree.ETXPath('//{%s}Relationship' % self.ns.a)(self._xml))[0] chart_rel_target = chart_rel.attrib['Target'] - chart_rel_targetCopy = 'copy' + str(self.chartIterator) + chart_rel_target + chart_rel_targetCopy = 'copy' + str(newId) + chart_rel_target chart_relCopy = copy.deepcopy(chart_rel) - chart_relCopy.attrib['Id'] = chartNewId + chart_relCopy.attrib['Id'] = "rId" + str(newId) chart_relCopy.attrib['Target'] = chart_rel_targetCopy chart_relParent = chart_rel.getparent() chart_relParent.append(chart_relCopy) @@ -918,7 +915,7 @@ def _xml_apply_chart(self, chart_struct, values): def copyRelPackages(relationship): # the original drawing name used for the chart relationshipName = relationship.attrib["Target"] - relationshipCopyName = relationshipName.replace("../", "../copy" + str(self.chartIterator)) + relationshipCopyName = relationshipName.replace("../", "../copy" + str(newId)) relationship.attrib["Target"] = relationshipCopyName pkgName = relationshipName.replace("../", "/word/") diff --git a/src/version.py b/src/version.py index 8f5024c..e8f1b16 100755 --- a/src/version.py +++ b/src/version.py @@ -31,10 +31,13 @@ class Version(object): Generate reports based on HP WebInspect, BurpSuite Pro scans, own custom data, knowledge base and Microsoft Office Word templates. ''' - version = '1.0.3' - date = 'Tuesday Jan 12 11:00:00 2021' + version = '1.0.4' + date = 'Tue Jan 19 20:42:36 2021' changelog = ''' ''' + version + ''' - ''' + date + ''' + - Fixed HTML support + + 1.0.3 - Tuesday Jan 12 11:00:00 2021 - Nmap scan support for multiple XML files - gets enabled if 'OpenPorts' directive is found in the template - FIX: Fixed deprecated functions e.g. icon/OnFileDrop handling - Added support for multiple charts in the _xml_apply_chart functions via objects cloning From 25d37e47a6e334900bdef4124a49999c20816de0 Mon Sep 17 00:00:00 2001 From: rk89gc Date: Wed, 20 Jan 2021 19:35:46 +0100 Subject: [PATCH 2/2] Fixed images not resizing for width exceeding the inital size. --- src/openxml.py | 7 +++---- src/version.py | 7 +++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openxml.py b/src/openxml.py index 8608208..c07d130 100755 --- a/src/openxml.py +++ b/src/openxml.py @@ -580,7 +580,7 @@ def xl(self, children): self._insert(e) return e - def picture(self, filename, name='', descr='', cap=627): + def picture(self, filename, name='', descr='', cap=None): # ext, content_type, relationships ext = filename.split('.')[-1] if ext == 'jpg': @@ -618,9 +618,8 @@ def picture(self, filename, name='', descr='', cap=627): im = Image.open(filename) x, y = im.size if cap != None: - if x > cap: - y = int(round(float(cap * y) / x)) - x = cap + y = int(round(float(cap * y) / x)) + x = cap x = str(x * 9525) y = str(y * 9525) e = etree.fromstring(''' diff --git a/src/version.py b/src/version.py index e8f1b16..f0cf36f 100755 --- a/src/version.py +++ b/src/version.py @@ -31,10 +31,13 @@ class Version(object): Generate reports based on HP WebInspect, BurpSuite Pro scans, own custom data, knowledge base and Microsoft Office Word templates. ''' - version = '1.0.4' - date = 'Tue Jan 19 20:42:36 2021' + version = '1.0.5' + date = 'Wed Jan 20 13:38:46 2021' changelog = ''' ''' + version + ''' - ''' + date + ''' + - Fixed images not resizing for width exceeding the inital size + + 1.0.4 - Tue Jan 19 20:42:36 2021 - Fixed HTML support 1.0.3 - Tuesday Jan 12 11:00:00 2021