File: engine.h

package info (click to toggle)
rats 2.1-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,140 kB
  • ctags: 1,316
  • sloc: ansic: 4,892; xml: 3,604; lex: 1,519; sh: 176; makefile: 114
file content (134 lines) | stat: -rw-r--r-- 3,192 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* 
 * Copyright (c) 2001-2002 Secure Software, Inc
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */

#ifndef ENGINE_H
#define ENGINE_H

#include "vuln_db.h"

#define DEPTH_PARENTHESIS       0
#define DEPTH_BRACKET           1
#define DEPTH_BRACE             2
#define DEPTH_COUNT             3

#define INCLUDE_ALL_REFERENCES  0x1
#define INPUT_MODE              0x2
#define RECURSIVE_FILE_SCAN     0x4
#define XML_OUTPUT		0x8
#define HTML_OUTPUT		0x10
#define FOLLOW_SYMLINK		0x20
#define NO_HEADER		0x40
#define NO_STATUS		0x80
#define NO_FOOTER		0x100
#define SHOW_COLUMNS	        0x200
#define SHOW_CONTEXT		0x400
#define ALL_STATIC		0x800



#define LANG_PYTHON		1	
#define LANG_C		 	2	
#define LANG_PERL		3
#define LANG_PHP		4

typedef struct _lexer_t lexer_t;

struct _lexer_t
{
    char **	    yytext;
    FILE *	    yyin;
    int 	    (*yylex)();
    char **	    yycomment;
    int *	    lex_lineno;
    Hash	    langhash;
    int		    lang;
    int *	    lex_column;
};

    
typedef struct _argument_t argument_t;
struct _argument_t
{
    int             is_constant;    /* is the argument a constant string?    */
    int             contains_ps;    /* does the string contain dangerous %s? */
    char *          yytext;         /* token text making up the argument     */
    argument_t *    next;
};

typedef struct _rats_stack_t rats_stack_t;
struct _rats_stack_t
{
    char *          identifier;
    Vuln_t *        data;
    int		    column;
    int             lineno;
    int             argc;
    argument_t *    argv;
    rats_stack_t *  next;
};

typedef struct _argscan_t argscan_t;
struct _argscan_t
{
    argument_t *    tail;
    argument_t *    current;
    int             depths[DEPTH_COUNT];
};

typedef struct _charscan_t charscan_t;
struct _charscan_t
{
    int lineno;
    int last_token;
    int column;
    int initial_type;
    int depth;
    int skip;
};

typedef struct _accumulator_t accumulator_t;
struct _accumulator_t
{
    char **         text;
    int             length;
    accumulator_t * next;
};

typedef struct _toctou_t toctou_t;
struct _toctou_t
{
    int		column;
    int         lineno;
    Vuln_t *    data;
    char *      key;
    int         use;
    toctou_t *  next;
};

typedef int (* processorfn_t)(int, void *);

extern int              flags;
extern Hash             database;
extern Hash	        defaultdb;
extern char *           current_file;
extern rats_stack_t *   current_frame;

extern void process_file(char *, int);

#endif  /* ENGINE_H */