pytest-3.9 -v -k 'not test_rough_doctype and not test_encrypted and not test_crypt_return and not test_all'
[ 23s] =================================== FAILURES ===================================
[ 23s] __________________________ TestOleIDBasic.test_macros __________________________
[ 23s]
[ 23s] self = <tests.oleid.test_basic.TestOleIDBasic testMethod=test_macros>
[ 23s]
[ 23s] def test_macros(self):
[ 23s] """Test indicator for macros."""
[ 23s] for filename, value_dict in self.oleids:
[ 23s] # TODO: we need a sample file with xlm macros
[ 23s] before_dot, suffix = splitext(filename)
[ 23s] if suffix == '.zip':
[ 23s] suffix = splitext(before_dot)[1]
[ 23s] # print('Debugging: {1}, {2} for {0}'
[ 23s] # .format(filename, value_dict['vba'], value_dict['xlm']))
[ 23s]
[ 23s] # xlm detection does not work in-memory (yet)
[ 23s] # --> xlm is "unknown" for excel files, except some encrypted files
[ 23s] self.assertIn(value_dict['xlm'], ('Unknown', 'No'))
[ 23s]
[ 23s] # "macro detection" in text files leads to interesting results:
[ 23s] if filename in ('ooxml/dde-in-excel2003.xml', # not really
[ 23s] 'encrypted/autostart-encrypt-standardpassword.xls',
[ 23s] 'msodde/dde-in-csv.csv', # "Windows" "calc.exe"
[ 23s] 'msodde/dde-in-excel2003.xml', # same as above
[ 23s] 'oleform/oleform-PR314.docm',
[ 23s] 'basic/empty', # WTF?
[ 23s] 'basic/text'): # no macros!
[ 23s] self.assertEqual(value_dict['vba'], 'Yes')
[ 23s] else:
[ 23s] > self.assertEqual(value_dict['vba'], 'No')
[ 23s] E AssertionError: 'Yes' != 'No'
[ 23s] E - Yes
[ 23s] E + No
[ 23s]
[ 23s] tests/oleid/test_basic.py:126: AssertionError
[ 23s] ------------------------------ Captured log call -------------------------------
[ 23s] WARNING olevba:_logger_adapter.py:32 For now, VBA stomping cannot be detected for files in memory
[ 23s] WARNING olevba:_logger_adapter.py:32 For now, VBA stomping cannot be detected for files in memory
[ 23s] _____________________ TestOlevbaBasic.test_empty_behaviour _____________________
[ 23s]
[ 23s] self = <tests.olevba.test_basic.TestOlevbaBasic testMethod=test_empty_behaviour>
[ 23s]
[ 23s] def test_empty_behaviour(self):
[ 23s] """Test behaviour of olevba when presented with pure text file."""
[ 23s] > self.do_test_behaviour('empty')
[ 23s]
[ 23s] tests/olevba/test_basic.py:24:
[ 23s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 23s] tests/olevba/test_basic.py:45: in do_test_behaviour
[ 23s] raise self.fail('Found "warn" in output line: "{}"'
[ 23s] E AssertionError: Found "warn" in output line: "/home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:580: SyntaxWarning: "is" with a literal. Did you mean "=="?"
[ 23s] ______________________ TestOlevbaBasic.test_rtf_behaviour ______________________
[ 23s]
[ 23s] self = <tests.olevba.test_basic.TestOlevbaBasic testMethod=test_rtf_behaviour>
[ 23s]
[ 23s] def test_rtf_behaviour(self):
[ 23s] """Test behaviour of olevba when presented with an rtf file."""
[ 23s] input_file = join(DATA_BASE_DIR, 'msodde', 'RTF-Spec-1.7.rtf')
[ 23s] output, ret_code = call_and_capture('olevba', args=(input_file, ),
[ 23s] accept_nonzero_exit=True)
[ 23s]
[ 23s] # check that return code is olevba.RETURN_OPEN_ERROR
[ 23s] self.assertEqual(ret_code, 5)
[ 23s]
[ 23s] # check output:
[ 23s] self.assertIn('FileOpenError', output)
[ 23s] self.assertIn('is RTF', output)
[ 23s] self.assertIn('rtfobj', output)
[ 23s] # TODO: I disabled this test because we do not log "not encrypted" as warning anymore
[ 23s] # to avoid other issues.
[ 23s] # If we really want to test this, then the test should be run with log level INFO:
[ 23s] # self.assertIn('not encrypted', output)
[ 23s]
[ 23s] # check warnings
[ 23s] for line in output.splitlines():
[ 23s] if line.startswith('WARNING ') and 'encrypted' in line:
[ 23s] continue # encryption warnings are ok
[ 23s] elif 'warn' in line.lower():
[ 23s] > raise self.fail('Found "warn" in output line: "{}"'
[ 23s] .format(line.rstrip()))
[ 23s] E AssertionError: Found "warn" in output line: "/home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:580: SyntaxWarning: "is" with a literal. Did you mean "=="?"
[ 23s]
[ 23s] tests/olevba/test_basic.py:75: AssertionError
[ 23s] _____________________ TestOlevbaBasic.test_text_behaviour ______________________
[ 23s]
[ 23s] self = <tests.olevba.test_basic.TestOlevbaBasic testMethod=test_text_behaviour>
[ 23s]
[ 23s] def test_text_behaviour(self):
[ 23s] """Test behaviour of olevba when presented with pure text file."""
[ 23s] > self.do_test_behaviour('text')
[ 23s]
[ 23s] tests/olevba/test_basic.py:20:
[ 23s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 23s] tests/olevba/test_basic.py:45: in do_test_behaviour
[ 23s] raise self.fail('Found "warn" in output line: "{}"'
[ 23s] E AssertionError: Found "warn" in output line: "/home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:580: SyntaxWarning: "is" with a literal. Did you mean "=="?"
[ 23s] ___________________________ TestOlevbaBasic.test_xlm ___________________________
[ 23s]
[ 23s] self = <tests.olevba.test_basic.TestOlevbaBasic testMethod=test_xlm>
[ 23s]
[ 23s] def test_xlm(self):
[ 23s] """Test that xlm macros are found."""
[ 23s] XLM_DIR = join(DATA_BASE_DIR, 'excel4-macros')
[ 23s] ADD_ARGS = ['-j']
[ 23s]
[ 23s] for filename in os.listdir(XLM_DIR):
[ 23s] full_name = join(XLM_DIR, filename)
[ 23s] suffix = splitext(filename)[1]
[ 23s] out_str, ret_code = call_and_capture('olevba',
[ 23s] args=[full_name, ] + ADD_ARGS,
[ 23s] accept_nonzero_exit=True)
[ 23s] > output = json.loads(out_str)
[ 23s]
[ 23s] tests/olevba/test_basic.py:122:
[ 23s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 23s] /usr/lib64/python3.9/json/__init__.py:346: in loads
[ 23s] return _default_decoder.decode(s)
[ 23s] /usr/lib64/python3.9/json/decoder.py:337: in decode
[ 23s] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[ 23s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 23s]
[ 23s] self = <json.decoder.JSONDecoder object at 0x7fbf9fb24700>
[ 23s] s = '/home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:580: SyntaxWarning: "is" with a literal. Did you mean ...ALERT(\\"This is a sample Excel 4 macro\\")\\n\' Formula or Macro: HALT()"\n }\n ]\n }\n]\n'
[ 23s] idx = 0
[ 23s]
[ 23s] def raw_decode(self, s, idx=0):
[ 23s] """Decode a JSON document from ``s`` (a ``str`` beginning with
[ 23s] a JSON document) and return a 2-tuple of the Python
[ 23s] representation and the index in ``s`` where the document ended.
[ 23s]
[ 23s] This can be used to decode a JSON document from a string that may
[ 23s] have extraneous data at the end.
[ 23s]
[ 23s] """
[ 23s] try:
[ 23s] obj, end = self.scan_once(s, idx)
[ 23s] except StopIteration as err:
[ 23s] > raise JSONDecodeError("Expecting value", s, err.value) from None
[ 23s] E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[ 23s]
[ 23s] /usr/lib64/python3.9/json/decoder.py:355: JSONDecodeError
[ 23s] =============================== warnings summary ===============================
[ 23s] oletools/rtfobj.py:271
[ 23s] /home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/rtfobj.py:271: DeprecationWarning: invalid escape sequence \d
[ 23s] DECIMAL_GROUP = b'(\d{1,250})'
[ 23s]
[ 23s] ../../../../../usr/lib/python3.9/site-packages/colorclass/codes.py:5
[ 23s] /usr/lib/python3.9/site-packages/colorclass/codes.py:5: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
[ 23s] from collections import Mapping
[ 23s]
[ 23s] oletools/oleobj.py:536
[ 23s] /home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:536: DeprecationWarning: invalid escape sequence \-
[ 23s] sane_fname = re.sub(u'[^a-zA-Z0-9.\-_ ]', replacement, basepath)
[ 23s]
[ 23s] oletools/oleobj.py:580
[ 23s] /home/abuild/rpmbuild/BUILD/oletools-0.60.1/oletools/oleobj.py:580: SyntaxWarning: "is" with a literal. Did you mean "=="?
[ 23s] if idx is -1:
[ 23s]
[ 23s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[ 23s] =========================== short test summary info ============================
[ 23s] FAILED tests/oleid/test_basic.py::TestOleIDBasic::test_macros - AssertionErro...
[ 23s] FAILED tests/olevba/test_basic.py::TestOlevbaBasic::test_empty_behaviour - As...
[ 23s] FAILED tests/olevba/test_basic.py::TestOlevbaBasic::test_rtf_behaviour - Asse...
[ 23s] FAILED tests/olevba/test_basic.py::TestOlevbaBasic::test_text_behaviour - Ass...
[ 23s] FAILED tests/olevba/test_basic.py::TestOlevbaBasic::test_xlm - json.decoder.J...
[ 23s] =========== 5 failed, 70 passed, 6 deselected, 4 warnings in 15.09s ============
Affected tool:
tests
Describe the bug
Multiple tests are failing:
test_macros:AssertionErrortest_empty_behaviour,test_rtf_behaviour,test_text_behaviour,test_xlm: AssertionError due to a correct syntax warning (ismust not be used to compare values)File/Malware sample to reproduce the bug
none
How To Reproduce the bug
Expected behavior
tests succeed
Console output / Screenshots
Version information:
Additional context