Changeset 591

Show
Ignore:
Timestamp:
07/21/06 22:00:24 (2 years ago)
Author:
common
Message:

nepenthes

  • shellcode-signatures
    • use autotools to create the lex and yacc files
    • removes namespacing

i hope it works

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/modules/shellcode-signatures/Makefile.am

    r556 r591  
    1010AM_LDFLAGS = $(LIB_PCRE) 
    1111 
     12YACC += -d 
     13LEX  += -d 
     14 
    1215pkglib_LTLIBRARIES = shellcodesignatures.la 
    1316 
    1417 
    1518shellcodesignatures_la_SOURCES = shellcode-signatures.sc  
    16 shellcodesignatures_la_SOURCES += y.tab.c lex.nepenthes_shellcodesignatures_yy.c y.tab.h 
     19shellcodesignatures_la_SOURCES += signature_parser.y signature_scanner.l   
    1720shellcodesignatures_la_SOURCES += parser.hpp parser.h 
    1821shellcodesignatures_la_SOURCES += shellcode-signatures.cpp shellcode-signatures.hpp  
     
    3033shellcodesignatures_la_SOURCES += sch_namespace_konstanzxor.cpp sch_namespace_konstanzxor.hpp 
    3134shellcodesignatures_la_SOURCES += sch_namespace_alphanumericxor.cpp sch_namespace_alphanumericxor.hpp 
    32 shellcodesignatures_la_LDFLAGS = -module -no-undefined -avoid-version 
    3335 
     36shellcodesignatures_la_LDFLAGS = @LEXLIB@ -module -no-undefined -avoid-version 
     37 
  • nepenthes/trunk/modules/shellcode-signatures/signature_parser.y

    r529 r591  
    1515        inline int string_get_len(); 
    1616 
    17         extern char *nepenthes_shellcodesignatures_yytext; 
    18         extern int nepenthes_shellcodesignatures_yyleng; 
    19         extern FILE *nepenthes_shellcodesignatures_yyin; 
     17        extern char *yytext; 
     18        extern int yyleng; 
     19        extern FILE *yyin; 
    2020 
    2121        static struct sc_shellcode *shellcodes = NULL; 
     
    383383 
    384384 
    385 int nepenthes_shellcodesignatures_yyerror(char* s) 
     385int yyerror(char* s) 
    386386{ 
    387387        snprintf(error_buffer, sizeof(error_buffer), 
    388                          "%s at '%s' on line %d", s, nepenthes_shellcodesignatures_yytext, line_number); 
     388                         "%s at '%s' on line %d", s, yytext, line_number); 
    389389        return 0; 
    390390} 
    391391 
    392392 
    393 int nepenthes_shellcodesignatures_yywrap() 
     393int yywrap() 
    394394{ 
    395395        return 1; 
     
    398398struct sc_shellcode *sc_parse_file(const char *filename) 
    399399{ 
    400         nepenthes_shellcodesignatures_yyin = fopen(filename, "r"); 
    401  
    402         if ( nepenthes_shellcodesignatures_yyin == NULL ) 
     400        yyin = fopen(filename, "r"); 
     401 
     402        if ( yyin == NULL ) 
    403403        { 
    404404                snprintf(error_buffer, sizeof(error_buffer), "%s", strerror(errno)); 
     
    407407 
    408408        init_shellcode(); 
    409         if ( nepenthes_shellcodesignatures_yyparse() != 0 ) 
    410         { 
    411                 fclose(nepenthes_shellcodesignatures_yyin); 
     409        if ( yyparse() != 0 ) 
     410        { 
     411                fclose(yyin); 
    412412                /* TODO free partially alloc'd shellcodes */ 
    413413                return NULL; 
    414414        } 
    415         fclose(nepenthes_shellcodesignatures_yyin); 
     415        fclose(yyin); 
    416416// taken from shellcode-generic/sch_generic_stuttgart.cpp 
    417417        return shellcodes; 
  • nepenthes/trunk/modules/shellcode-signatures/signature_scanner.l

    r520 r591  
    22%{ 
    33#include <string.h> 
    4 #include "y.tab.h" 
     4#include "signature_parser.h" 
    55 
    66inline void string_reset();