[Forensics-changes] [yara] 95/160: Perform stream I/O tests without relying on a predefined compiled file
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:29:22 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.4.0
in repository yara.
commit 348dae651e11b055dc68370be9656646bb1edd6d
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Wed Apr 29 12:19:47 2015 +0200
Perform stream I/O tests without relying on a predefined compiled file
The binary format of compiled files can change, and that would require updating the predefined file.
---
yara-python/tests.py | 108 ++++-----------------------------------------------
1 file changed, 7 insertions(+), 101 deletions(-)
diff --git a/yara-python/tests.py b/yara-python/tests.py
index e0fb777..f67e299 100644
--- a/yara-python/tests.py
+++ b/yara-python/tests.py
@@ -70,96 +70,6 @@ b801000000bb2a000000cd8000546865204e65747769646520417373656d626c\
ab000000000000001a0000000000000000000000000000000100000000000000\
0000000000000000')
-# generated from
-# rule test { condition: true }
-YAC_FILE = binascii.unhexlify('\
-59415241590a000006000000005008000000000000a8090000000000003d0800\
-000000000024000000000000002c00000000000000002c00000000000000daba\
-faff000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000d01000000000000001b5008000000000000ff00000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000540a00\
-0000000000dabafaff00000000dabafaff00000000dabafaff00000000c40900\
-000000000000100000fafafafafafafafafafafafafafafafafafafafafafafa\
-fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa\
-fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa\
-fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa\
-fafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafa\
-fafafafafafafafafafafafafafafafafa00000000fafafafafafafafafafafa\
-fafafafafafafafafafafafafa00000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-0000000000000000000000000000000000000000000000000000000000000000\
-000000000000000000000000004c0a00000000000064656661756c7400746573\
-7400040000000c000000140000001c000000240000002d000000350000004708\
-0000d4080000dc080000ec080000e4080000f4080000440a0000ffffffff')
-
-
# The 3 possible outcomes for each pattern
[SUCCEED, FAIL, SYNTAX_ERROR] = range(3)
@@ -926,22 +836,18 @@ class TestYara(unittest.TestCase):
# Python 2/3
try:
- yac1 = StringIO.StringIO(YAC_FILE)
- yac2 = StringIO.StringIO()
+ stream = StringIO.StringIO()
except:
- yac1 = io.BytesIO(YAC_FILE)
- yac2 = io.BytesIO()
+ stream = io.BytesIO()
- r = yara.load(yac1)
- r.save(yac2)
+ r1 = yara.compile(source='rule test { condition: true }')
+ r1.save(stream)
- m = r.match(data="dummy")
- self.assertTrue(len(m) == 1)
+ stream.seek(0)
- yac2.seek(0)
- r = yara.load(yac2)
+ r2 = yara.load(stream)
+ m = r2.match(data="dummy")
- m = r.match(data="dummy")
self.assertTrue(len(m) == 1)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list