Remove -z/--analysis option.

It was only used for one special case that is not commonly used by
anyone.
This commit is contained in:
Johanna Amann 2016-08-04 17:42:50 -07:00
parent 30b40b214a
commit b7ab6a5332
5 changed files with 1 additions and 114 deletions

View file

@ -66,9 +66,6 @@ print version and exit
\fB\-x\fR,\ \-\-print\-state <file.bst>
print contents of state file
.TP
\fB\-z\fR,\ \-\-analyze <analysis>
run the specified policy file analysis
.TP
\fB\-C\fR,\ \-\-no\-checksums
ignore checksums
.TP

View file

@ -321,7 +321,6 @@ set(bro_SRCS
RuleAction.cc
RuleCondition.cc
RuleMatcher.cc
ScriptAnaly.cc
SmithWaterman.cc
Scope.cc
SerializationFormat.cc

View file

@ -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<const FieldAssignExpr*>(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<const CallExpr*>(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);
}

View file

@ -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

View file

@ -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<string> params;
@ -182,7 +180,6 @@ void usage()
fprintf(stderr, " -v|--version | print version and exit\n");
fprintf(stderr, " -w|--writefile <writefile> | write to given tcpdump file\n");
fprintf(stderr, " -x|--print-state <file.bst> | print contents of state file\n");
fprintf(stderr, " -z|--analyze <analysis> | run the specified policy file analysis\n");
#ifdef DEBUG
fprintf(stderr, " -B|--debug <dbgstreams> | 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;