Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yara-python
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
yara-python
Commits
eea79f44
Commit
eea79f44
authored
Aug 03, 2018
by
Victor M. Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set_config now returns None instead of an empty string and have a test case.
parent
be1ac232
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
tests.py
tests.py
+10
-0
yara-python.c
yara-python.c
+16
-9
No files found.
tests.py
View file @
eea79f44
...
@@ -1000,6 +1000,16 @@ class TestYara(unittest.TestCase):
...
@@ -1000,6 +1000,16 @@ class TestYara(unittest.TestCase):
r
=
next
(
it
)
r
=
next
(
it
)
self
.
assertTrue
(
r
.
identifier
==
'test3'
)
self
.
assertTrue
(
r
.
identifier
==
'test3'
)
def
testSetConfig
(
self
):
yara
.
set_config
(
max_strings_per_rule
=
1
)
self
.
assertSyntaxError
([
'''
rule test { strings: $a = "1" $b = "2" condition: all of them }
'''
])
yara
.
set_config
(
max_strings_per_rule
=
10000
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
yara-python.c
View file @
eea79f44
...
@@ -1836,21 +1836,28 @@ static PyObject* yara_set_config(
...
@@ -1836,21 +1836,28 @@ static PyObject* yara_set_config(
&
stack_size
,
&
stack_size
,
&
max_strings_per_rule
))
&
max_strings_per_rule
))
{
{
if
(
stack_size
!=
0
)
{
if
(
stack_size
!=
0
)
if
((
error
=
yr_set_configuration
(
YR_CONFIG_STACK_SIZE
,
{
&
stack_size
))
!=
ERROR_SUCCESS
)
{
error
=
yr_set_configuration
(
YR_CONFIG_STACK_SIZE
,
&
stack_size
);
if
(
error
!=
ERROR_SUCCESS
)
return
handle_error
(
error
,
NULL
);
return
handle_error
(
error
,
NULL
);
}
}
}
if
(
max_strings_per_rule
!=
0
)
{
if
(
max_strings_per_rule
!=
0
)
if
((
error
=
yr_set_configuration
(
YR_CONFIG_MAX_STRINGS_PER_RULE
,
{
&
max_strings_per_rule
))
!=
ERROR_SUCCESS
)
{
error
=
yr_set_configuration
(
YR_CONFIG_MAX_STRINGS_PER_RULE
,
&
max_strings_per_rule
);
if
(
error
!=
ERROR_SUCCESS
)
return
handle_error
(
error
,
NULL
);
return
handle_error
(
error
,
NULL
);
}
}
}
}
}
return
Py_BuildValue
(
""
)
;
Py_RETURN_NONE
;
}
}
static
PyObject
*
yara_compile
(
static
PyObject
*
yara_compile
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment