Coder Social home page Coder Social logo

Comments (2)

utkonos avatar utkonos commented on June 5, 2024

The corrected unit test reveals a new bug in the handling of newlines. I propose a fix that just finds and replaces all windows CR-NL characters with newline characters before processing and then removing all code for windows handling. The new rule rebuilding code is the only output that would need to adjust for this, and I propose just having a parameter for that function that outputs defaulting to newline, but optionally outputs windows CR-NL.

from plyara.

utkonos avatar utkonos commented on June 5, 2024
.......................[!] Unhandled String Count Condition $):
[!] Unhandled String Count Condition $a)
[!] Unhandled String Count Condition $a)
[!] Unhandled String Count Condition $b)
[!] Unhandled String Count Condition $a)
./plyara/venv/lib/python3.7/site-packages/plyara/utils.py:259: DeprecationWarning: Utility rebuild_yara_rule() is deprecated.
  warnings.warn('Utility rebuild_yara_rule() is deprecated.', DeprecationWarning)
......................F
======================================================================
FAIL: test_windows_CRNL (__main__.TestYaraRules)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit_tests.py", line 1070, in test_windows_CRNL
    self.assertEqual(result, reference)
AssertionError: Lists differ: [{'strings': [{'name': '$', 'value': '{ 00\n[221 chars]m']}] != [{'condition_terms': ['all', 'of', 'them'], [219 chars]'}]}]

First differing element 0:
{'strings': [{'name': '$', 'value': '{ 00\n[220 chars]em']}
{'condition_terms': ['all', 'of', 'them'], [218 chars]}'}]}

  [{'condition_terms': ['all', 'of', 'them'],
    'raw_condition': 'condition:\nall of them\n',
    'raw_strings': 'strings:\n$ = { 00\n      00 }\n',
    'rule_name': 'sample',
    'start_line': 1,
    'stop_line': 8,
-   'strings': [{'name': '$', 'type': 'byte', 'value': '{ 00\n      00 }'}]}]
?                                                           --

+   'strings': [{'name': '$', 'type': 'byte', 'value': '{ 00      00 }'}]}]

----------------------------------------------------------------------
Ran 47 tests in 2.938s

FAILED (failures=1)

from plyara.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.