From b7ab6a5332f15710e67631a6cba98284b84d87aa Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Thu, 4 Aug 2016 17:42:50 -0700 Subject: [PATCH] Remove -z/--analysis option. It was only used for one special case that is not commonly used by anyone. --- man/bro.8 | 3 -- src/CMakeLists.txt | 1 - src/ScriptAnaly.cc | 84 ---------------------------------------------- src/ScriptAnaly.h | 8 ----- src/main.cc | 19 +---------- 5 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 src/ScriptAnaly.cc delete mode 100644 src/ScriptAnaly.h diff --git a/man/bro.8 b/man/bro.8 index 1e9d418e7a..66d0fc4f20 100644 --- a/man/bro.8 +++ b/man/bro.8 @@ -66,9 +66,6 @@ print version and exit \fB\-x\fR,\ \-\-print\-state print contents of state file .TP -\fB\-z\fR,\ \-\-analyze -run the specified policy file analysis -.TP \fB\-C\fR,\ \-\-no\-checksums ignore checksums .TP diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55951a84a1..a564f16b32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -321,7 +321,6 @@ set(bro_SRCS RuleAction.cc RuleCondition.cc RuleMatcher.cc - ScriptAnaly.cc SmithWaterman.cc Scope.cc SerializationFormat.cc diff --git a/src/ScriptAnaly.cc b/src/ScriptAnaly.cc deleted file mode 100644 index bca75cc800..0000000000 --- a/src/ScriptAnaly.cc +++ /dev/null @@ -1,84 +0,0 @@ -// See the file "COPYING" in the main distribution directory for copyright. - -#include "Dict.h" -#include "Expr.h" -#include "Traverse.h" -#include "ScriptAnaly.h" - -typedef const char cchar; -declare(PDict, cchar); - - -class FindNoteCallback : public TraversalCallback { -public: - FindNoteCallback() { note_expr = 0; } - - virtual TraversalCode PreExpr(const Expr* e); - - Expr* note_expr; -}; - -TraversalCode FindNoteCallback::PreExpr(const Expr* e) - { - if ( e->Tag() == EXPR_FIELD_ASSIGN ) - { - const FieldAssignExpr* fae = - dynamic_cast(e); - - if ( ! streq(fae->FieldName(), "note") ) - return TC_CONTINUE; - - note_expr = fae->Op(); - return TC_ABORTALL; - } - - return TC_CONTINUE; - } - - -class NoticeCallback : public TraversalCallback { -public: - virtual TraversalCode PreExpr(const Expr* e); - - PDict(cchar) notices; -}; - -TraversalCode NoticeCallback::PreExpr(const Expr* e) - { - if ( e->Tag() != EXPR_CALL ) - return TC_CONTINUE; - - const CallExpr* ce = dynamic_cast(e); - - if ( ce->Func()->Tag() != EXPR_NAME || - ! streq(((NameExpr*) ce->Func())->Id()->Name(), "NOTICE") ) - return TC_CONTINUE; - - FindNoteCallback fnc; - ce->Traverse(&fnc); - if ( fnc.note_expr ) - { - ODesc d; - fnc.note_expr->Describe(&d); - if ( ! notices.Lookup(d.Description()) ) - { - const char* desc = strdup(d.Description()); - notices.Insert(desc, desc); - } - } - - return TC_CONTINUE; - } - - -void notice_analysis() - { - NoticeCallback cb; - traverse_all(&cb); - - const cchar* notice = 0; - IterCookie* iter = cb.notices.InitForIteration(); - - while ( (notice = cb.notices.NextEntry(iter)) ) - printf("Found NOTICE: %s\n", notice); - } diff --git a/src/ScriptAnaly.h b/src/ScriptAnaly.h deleted file mode 100644 index 0561ecd389..0000000000 --- a/src/ScriptAnaly.h +++ /dev/null @@ -1,8 +0,0 @@ -// See the file "COPYING" in the main distribution directory for copyright. - -#ifndef scriptanaly_h -#define scriptanaly_h - -void notice_analysis(); - -#endif diff --git a/src/main.cc b/src/main.cc index c2052a03b3..4b92d2cca5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -25,7 +25,6 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void); #include "bsd-getopt-long.h" #include "input.h" -#include "ScriptAnaly.h" #include "DNS_Mgr.h" #include "Frame.h" #include "Scope.h" @@ -116,7 +115,6 @@ ProfileLogger* profiling_logger = 0; ProfileLogger* segment_logger = 0; SampleLogger* sample_logger = 0; int signal_val = 0; -int do_notice_analysis = 0; extern char version[]; char* command_line_policy = 0; vector params; @@ -182,7 +180,6 @@ void usage() fprintf(stderr, " -v|--version | print version and exit\n"); fprintf(stderr, " -w|--writefile | write to given tcpdump file\n"); fprintf(stderr, " -x|--print-state | print contents of state file\n"); - fprintf(stderr, " -z|--analyze | run the specified policy file analysis\n"); #ifdef DEBUG fprintf(stderr, " -B|--debug | Enable debugging output for selected streams ('-B help' for help)\n"); #endif @@ -484,7 +481,6 @@ int main(int argc, char** argv) {"writefile", required_argument, 0, 'w'}, {"version", no_argument, 0, 'v'}, {"print-state", required_argument, 0, 'x'}, - {"analyze", required_argument, 0, 'z'}, {"no-checksums", no_argument, 0, 'C'}, {"force-dns", no_argument, 0, 'F'}, {"load-seeds", required_argument, 0, 'G'}, @@ -542,7 +538,7 @@ int main(int argc, char** argv) opterr = 0; char opts[256]; - safe_strncpy(opts, "B:e:f:G:H:I:i:n:p:R:r:s:T:t:U:w:x:X:z:CFNPQSWabdghv", + safe_strncpy(opts, "B:e:f:G:H:I:i:n:p:R:r:s:T:t:U:w:x:X:CFNPQSWabdghv", sizeof(opts)); #ifdef USE_PERFTOOLS_DEBUG @@ -615,16 +611,6 @@ int main(int argc, char** argv) bst_file = optarg; break; - case 'z': - if ( streq(optarg, "notice") ) - do_notice_analysis = 1; - else - { - fprintf(stderr, "Unknown analysis type: %s\n", optarg); - exit(1); - } - break; - case 'B': debug_streams = optarg; break; @@ -1103,9 +1089,6 @@ int main(int argc, char** argv) delete alive_handlers; - if ( do_notice_analysis ) - notice_analysis(); - if ( stmts ) { stmt_flow_type flow;