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
f7954585
Commit
f7954585
authored
May 22, 2017
by
Victor M. Alvarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable “dotnet” module and features dependant on libcrypto in “pe” module
parent
c441f2fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
appveyor.yml
appveyor.yml
+2
-1
setup.py
setup.py
+20
-17
No files found.
appveyor.yml
View file @
f7954585
...
@@ -148,9 +148,10 @@ clone_script:
...
@@ -148,9 +148,10 @@ clone_script:
build_script
:
build_script
:
# Build the compiled extension
# Build the compiled extension
-
"
%CMD_IN_ENV%
python
setup.py
build_ext
--enable-cuckoo
-
"
%CMD_IN_ENV%
python
setup.py
build_ext
--enable-cuckoo
--enable-dotnet
-L../jansson-%JANSSON_VERSION%/build/lib/Release;../%OPENSSL_LIB%/%OPENSSL_LIB_DIR%
-L../jansson-%JANSSON_VERSION%/build/lib/Release;../%OPENSSL_LIB%/%OPENSSL_LIB_DIR%
-I../jansson-%JANSSON_VERSION%/build/include;../%OPENSSL_LIB%/include
-I../jansson-%JANSSON_VERSION%/build/include;../%OPENSSL_LIB%/include
-D_CRT_SECURE_NO_WARNINGS
-DHASH_MODULE
-DHAVE_LIBCRYPTO
-llibcryptoMT"
-llibcryptoMT"
after_build
:
after_build
:
...
...
setup.py
View file @
f7954585
...
@@ -35,6 +35,7 @@ OPTIONS = [
...
@@ -35,6 +35,7 @@ OPTIONS = [
(
'dynamic-linking'
,
None
,
'link dynamically against libyara'
),
(
'dynamic-linking'
,
None
,
'link dynamically against libyara'
),
(
'enable-cuckoo'
,
None
,
'enable "cuckoo" module'
),
(
'enable-cuckoo'
,
None
,
'enable "cuckoo" module'
),
(
'enable-magic'
,
None
,
'enable "magic" module'
),
(
'enable-magic'
,
None
,
'enable "magic" module'
),
(
'enable-dotnet'
,
None
,
'enable "dotnet" module'
),
(
'enable-profiling'
,
None
,
'enable profiling features'
)]
(
'enable-profiling'
,
None
,
'enable profiling features'
)]
...
@@ -42,6 +43,7 @@ BOOLEAN_OPTIONS = [
...
@@ -42,6 +43,7 @@ BOOLEAN_OPTIONS = [
'dynamic-linking'
,
'dynamic-linking'
,
'enable-cuckoo'
,
'enable-cuckoo'
,
'enable-magic'
,
'enable-magic'
,
'enable-dotnet'
,
'enable-profiling'
]
'enable-profiling'
]
...
@@ -93,6 +95,7 @@ class BuildCommand(build):
...
@@ -93,6 +95,7 @@ class BuildCommand(build):
self
.
dynamic_linking
=
None
self
.
dynamic_linking
=
None
self
.
enable_magic
=
None
self
.
enable_magic
=
None
self
.
enable_cuckoo
=
None
self
.
enable_cuckoo
=
None
self
.
enable_dotnet
=
None
self
.
enable_profiling
=
None
self
.
enable_profiling
=
None
def
finalize_options
(
self
):
def
finalize_options
(
self
):
...
@@ -112,6 +115,7 @@ class BuildExtCommand(build_ext):
...
@@ -112,6 +115,7 @@ class BuildExtCommand(build_ext):
self
.
dynamic_linking
=
None
self
.
dynamic_linking
=
None
self
.
enable_magic
=
None
self
.
enable_magic
=
None
self
.
enable_cuckoo
=
None
self
.
enable_cuckoo
=
None
self
.
enable_dotnet
=
None
self
.
enable_profiling
=
None
self
.
enable_profiling
=
None
def
finalize_options
(
self
):
def
finalize_options
(
self
):
...
@@ -125,6 +129,7 @@ class BuildExtCommand(build_ext):
...
@@ -125,6 +129,7 @@ class BuildExtCommand(build_ext):
(
'dynamic_linking'
,
'dynamic_linking'
),
(
'dynamic_linking'
,
'dynamic_linking'
),
(
'enable_magic'
,
'enable_magic'
),
(
'enable_magic'
,
'enable_magic'
),
(
'enable_cuckoo'
,
'enable_cuckoo'
),
(
'enable_cuckoo'
,
'enable_cuckoo'
),
(
'enable_dotnet'
,
'enable_dotnet'
),
(
'enable_profiling'
,
'enable_profiling'
))
(
'enable_profiling'
,
'enable_profiling'
))
if
self
.
enable_magic
and
self
.
dynamic_linking
:
if
self
.
enable_magic
and
self
.
dynamic_linking
:
...
@@ -133,6 +138,9 @@ class BuildExtCommand(build_ext):
...
@@ -133,6 +138,9 @@ class BuildExtCommand(build_ext):
if
self
.
enable_cuckoo
and
self
.
dynamic_linking
:
if
self
.
enable_cuckoo
and
self
.
dynamic_linking
:
raise
distutils
.
errors
.
DistutilsOptionError
(
raise
distutils
.
errors
.
DistutilsOptionError
(
'--enable-cuckoo can''t be used with --dynamic-linking'
)
'--enable-cuckoo can''t be used with --dynamic-linking'
)
if
self
.
enable_dotnet
and
self
.
dynamic_linking
:
raise
distutils
.
errors
.
DistutilsOptionError
(
'--enable-dotnet can''t be used with --dynamic-linking'
)
def
run
(
self
):
def
run
(
self
):
"""Execute the build command."""
"""Execute the build command."""
...
@@ -147,11 +155,6 @@ class BuildExtCommand(build_ext):
...
@@ -147,11 +155,6 @@ class BuildExtCommand(build_ext):
if
self
.
plat_name
in
(
'win32'
,
'win-amd64'
):
if
self
.
plat_name
in
(
'win32'
,
'win-amd64'
):
building_for_windows
=
True
building_for_windows
=
True
#bits = '64' if self.plat_name == 'win-amd64' else '32'
module
.
define_macros
.
append
((
'_CRT_SECURE_NO_WARNINGS'
,
'1'
))
#module.include_dirs.append('yara/windows/include')
module
.
libraries
.
append
(
'advapi32'
)
module
.
libraries
.
append
(
'user32'
)
else
:
else
:
building_for_windows
=
False
building_for_windows
=
False
...
@@ -177,18 +180,13 @@ class BuildExtCommand(build_ext):
...
@@ -177,18 +180,13 @@ class BuildExtCommand(build_ext):
if
self
.
dynamic_linking
:
if
self
.
dynamic_linking
:
module
.
libraries
.
append
(
'yara'
)
module
.
libraries
.
append
(
'yara'
)
else
:
else
:
#if building_for_windows:
if
not
(
'HASH_MODULE'
,
'1'
)
in
self
.
define
:
# module.library_dirs.append('yara/windows/lib')
if
(
has_function
(
'MD5_Init'
,
libraries
=
[
'crypto'
])
and
has_function
(
'SHA256_Init'
,
libraries
=
[
'crypto'
])):
if
building_for_windows
:
module
.
define_macros
.
append
((
'HASH_MODULE'
,
'1'
))
module
.
define_macros
.
append
((
'HASH_MODULE'
,
'1'
))
module
.
libraries
.
append
(
'crypto'
)
#module.libraries.append('libeay32')
else
:
elif
(
has_function
(
'MD5_Init'
,
libraries
=
[
'crypto'
])
and
exclusions
.
append
(
'yara/libyara/modules/hash.c'
)
has_function
(
'SHA256_Init'
,
libraries
=
[
'crypto'
])):
module
.
define_macros
.
append
((
'HASH_MODULE'
,
'1'
))
module
.
libraries
.
append
(
'crypto'
)
else
:
exclusions
.
append
(
'yara/libyara/modules/hash.c'
)
if
self
.
enable_magic
:
if
self
.
enable_magic
:
module
.
define_macros
.
append
((
'MAGIC_MODULE'
,
'1'
))
module
.
define_macros
.
append
((
'MAGIC_MODULE'
,
'1'
))
...
@@ -201,6 +199,11 @@ class BuildExtCommand(build_ext):
...
@@ -201,6 +199,11 @@ class BuildExtCommand(build_ext):
else
:
else
:
exclusions
.
append
(
'yara/libyara/modules/cuckoo.c'
)
exclusions
.
append
(
'yara/libyara/modules/cuckoo.c'
)
if
self
.
enable_dotnet
:
module
.
define_macros
.
append
((
'DOTNET_MODULE'
,
'1'
))
else
:
exclusions
.
append
(
'yara/libyara/modules/dotnet.c'
)
exclusions
=
[
os
.
path
.
normpath
(
x
)
for
x
in
exclusions
]
exclusions
=
[
os
.
path
.
normpath
(
x
)
for
x
in
exclusions
]
for
directory
,
_
,
files
in
os
.
walk
(
'yara/libyara/'
):
for
directory
,
_
,
files
in
os
.
walk
(
'yara/libyara/'
):
...
...
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