-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative paths in include statements #56
Comments
Are you expecting the file to be found relative to the current working directory of your program? Or are you expecting it to be found relative to the directory in which the including file resides? |
Relative to where the including file resides. Usually I have subfolders with rules divided into files. At the top level there are yar-files that include certain files relative to its own location. Using yarac works fine, but compiler.AddFile panics saying that the relative path cannot be found. |
|
I just created include "b.yar"
include "subdir/c.yar" Both included files exist and are empty. I can compile this using package main
import (
"github.com/hillu/go-yara"
"log"
"os"
)
func main() {
c, _ := yara.NewCompiler()
f, _ := os.Open("a.yar")
log.Printf("Using '%s'…", f.Name())
if err := c.AddFile(f, ""); err != nil {
log.Fatalf("addfile: %v", err)
}
if _, err := c.GetRules(); err != nil {
log.Fatalf("compile: %v", err)
}
log.Print("Done.")
} |
@uggwar The problem you encountered may have to do with your ruleset resulting in multiple errors: When I try to compile
(I am pretty sure that all the "cannot open include file" messages are symptoms of a bug within YARA itself.) Now, when I use my test program to compile this rule, I only get the following message:
This is only the last error reported by YARA. However, all the warnings and errors are stored in |
@uggwar Ping? Do you think that my analysis is correct? |
Sorry for the late reply. Yes, this sounds very plausible, since I've built
yara without most dependencies. I will have a look tomorrow! Thanks for the
help!
Christer
…On Tue, 7 Jan 2020, 19:34 Hilko Bengen, ***@***.***> wrote:
@uggwar <https://github.com/uggwar> Ping? Do you think that my analysis
is correct?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#56?email_source=notifications&email_token=ABJ2H6WEVKTYJO2QREQ76QLQ4TDKBA5CNFSM4JZNLKVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIJ2R5I#issuecomment-571713781>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ2H6VZD6RQEK7Q5W2FUG3Q4TDKBANCNFSM4JZNLKVA>
.
|
Hi!
Can't seem to load files that has include statements like this:
include "subdir/SomeGreatYaraRules.yar"
I load these files with err := compiler.AddFile(f, "ns")
The text was updated successfully, but these errors were encountered: