Skip to content

Commit 1ab4420

Browse files
tests: Add sample and test for interactive ppt
Self-made sample that triggers default browser with an URL upon clicking a shape, and that calls calc.exe upon hovering over another shape.
1 parent 7fe4055 commit 1ab4420

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

tests/olevba/test_basic.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,26 @@ def test_xlm(self):
147147
self.assertIn('AutoExec', types)
148148
self.assertIn('Suspicious', types)
149149

150+
def test_interactive_ppt(self):
151+
"""Test detection of interactive ppt feature in special sample."""
152+
SAMPLE = join(DATA_BASE_DIR, 'olevba', 'mouse-over.ppt')
153+
out_str, _ = call_and_capture('olevba', args = [SAMPLE, '-j'])
154+
output = json.loads(out_str)
155+
self.assertEqual(len(output), 2)
156+
self.assertEqual(output[0]['type'], 'MetaInformation')
157+
self.assertEqual(output[0]['script_name'], 'olevba')
158+
result = output[1]
159+
self.assertTrue(result['json_conversion_successful'])
160+
self.assertEqual(len(result['macros']), 1)
161+
self.assertEqual(result['macros'][0]['ole_stream'], 'PowerPoint Document')
162+
self.assertTrue(result['macros'][0]['code'].startswith('ExHyperlinkContainer'))
163+
self.assertTrue(result['macros'][0]['code'].endswith('calc.exe'))
164+
self.assertTrue(entry['type'] == 'AutoExec' for entry in result['analysis'])
165+
self.assertTrue(entry['type'] == 'Suspicious' for entry in result['analysis'])
166+
self.assertTrue(entry['keyword'] == 'calc.exe' for entry in result['analysis'])
167+
self.assertTrue(entry['keyword'] == 'InteractiveControls' for entry in result['analysis'])
168+
self.assertTrue(entry['keyword'] == 'MouseClick/OverInteractiveInfoContainer' for entry in result['analysis'])
169+
150170

151171
# just in case somebody calls this file as a script
152172
if __name__ == '__main__':
91 KB
Binary file not shown.

0 commit comments

Comments
 (0)