Hello, I'm currently trying to code a semantic grep using coccinelle (By the way, if there is one tell me;). I did not find better than making a python script calling spatch...
If the grep code like is easy to build with coccinelle, I've got some
difficulty to call coccinelle with python using for example "call"
function of the subprocess module:
# launch spatch
cmd = ["spatch", "-sp_file", tmp_cocci_file.name, file_name]
print "running: %s." % " ".join(cmd)
output = call(cmd)
Running the script does:
eric@tiger:~/git/coccigrep (master) $ python ./coccigrep.py
running: spatch -sp_file /tmp/tmpoiump0.cocci
/home/eric/git/oisf/src/detect-noalert.c.
init_defs_builtins: /usr/share/coccinelle/standard.h
Fatal error: exception Failure("unexpected code before the first rule
")
2
Running the command is ok:
eric@tiger:~/git/coccigrep (master) $ spatch
-sp_file /tmp/tmpoiump0.cocci /home/eric/git/oisf/src/detect-noalert.c
init_defs_builtins: /usr/share/coccinelle/standard.h
HANDLING: /home/eric/git/oisf/src/detect-noalert.c
/home/eric/git/oisf/src/detect-noalert.c:49:
SCLogError(SC_ERR_INVALID_VALUE, "nocase has no value");
return -1;
}
s->flags |= SIG_FLAG_NOALERT;
return 0;
}
If I use Popen without argument, everything is fine.
Any idea ?
BR,
--
Eric Leblond
Blog: http://home.regit.org/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
