1 //--------------------------------------------------------------------------
2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 //
4 // This program is free software; you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License Version 2 as published
6 // by the Free Software Foundation.  You may not use, modify or distribute
7 // this program under any other version of the GNU General Public License.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //--------------------------------------------------------------------------
18 // ips_options.cc author Russ Combs <rucombs@cisco.com>
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include "ips_options.h"
25 
26 #include "managers/plugin_manager.h"
27 
28 using namespace snort;
29 
30 extern const BaseApi* ips_classtype;
31 extern const BaseApi* ips_content;
32 extern const BaseApi* ips_detection_filter;
33 extern const BaseApi* ips_dsize;
34 extern const BaseApi* ips_file_data;
35 extern const BaseApi* ips_flow;
36 extern const BaseApi* ips_flowbits;
37 extern const BaseApi* ips_md5;
38 extern const BaseApi* ips_metadata;
39 extern const BaseApi* ips_pkt_data;
40 extern const BaseApi* ips_reference;
41 extern const BaseApi* ips_replace;
42 extern const BaseApi* ips_service;
43 extern const BaseApi* ips_sha256;
44 extern const BaseApi* ips_sha512;
45 extern const BaseApi* ips_so;
46 extern const BaseApi* ips_vba_data;
47 
48 #ifdef STATIC_IPS_OPTIONS
49 extern const BaseApi* ips_ack[];
50 extern const BaseApi* ips_asn1[];
51 extern const BaseApi* ips_base64[];
52 extern const BaseApi* ips_ber_data[];
53 extern const BaseApi* ips_ber_skip[];
54 extern const BaseApi* ips_byte_extract[];
55 extern const BaseApi* ips_byte_jump[];
56 extern const BaseApi* ips_byte_math[];
57 extern const BaseApi* ips_byte_test[];
58 extern const BaseApi* ips_cvs[];
59 extern const BaseApi* ips_enable[];
60 extern const BaseApi* ips_file_type[];
61 extern const BaseApi* ips_flags[];
62 extern const BaseApi* ips_fragbits[];
63 extern const BaseApi* ips_fragoffset[];
64 extern const BaseApi* ips_gid[];
65 extern const BaseApi* ips_icmp_id[];
66 extern const BaseApi* ips_icmp_seq[];
67 extern const BaseApi* ips_icode[];
68 extern const BaseApi* ips_id[];
69 extern const BaseApi* ips_ipopts[];
70 extern const BaseApi* ips_ip_proto[];
71 extern const BaseApi* ips_isdataat[];
72 extern const BaseApi* ips_itype[];
73 extern const BaseApi* ips_msg[];
74 extern const BaseApi* ips_pcre[];
75 extern const BaseApi* ips_priority[];
76 extern const BaseApi* ips_raw_data[];
77 extern const BaseApi* ips_rem[];
78 extern const BaseApi* ips_rev[];
79 extern const BaseApi* ips_rpc[];
80 extern const BaseApi* ips_seq[];
81 extern const BaseApi* ips_sid[];
82 extern const BaseApi* ips_soid[];
83 extern const BaseApi* ips_target[];
84 extern const BaseApi* ips_tag[];
85 extern const BaseApi* ips_tos[];
86 extern const BaseApi* ips_ttl[];
87 extern const BaseApi* ips_bufferlen[];
88 extern const BaseApi* ips_window[];
89 #ifdef HAVE_HYPERSCAN
90 extern const BaseApi* ips_regex[];
91 extern const BaseApi* ips_sd_pattern[];
92 #endif
93 #endif
94 
95 static const BaseApi* ips_options[] =
96 {
97     ips_classtype,
98     ips_content,
99     ips_detection_filter,
100     ips_dsize,
101     ips_file_data,
102     ips_flow,
103     ips_flowbits,
104     ips_md5,
105     ips_metadata,
106     ips_pkt_data,
107     ips_reference,
108     ips_replace,
109     ips_service,
110     ips_sha256,
111     ips_sha512,
112     ips_so,
113     ips_vba_data,
114     nullptr
115 };
116 
load_ips_options()117 void load_ips_options()
118 {
119     PluginManager::load_plugins(ips_options);
120 
121 #ifdef STATIC_IPS_OPTIONS
122     PluginManager::load_plugins(ips_ack);
123     PluginManager::load_plugins(ips_asn1);
124     PluginManager::load_plugins(ips_base64);
125     PluginManager::load_plugins(ips_ber_data);
126     PluginManager::load_plugins(ips_ber_skip);
127     PluginManager::load_plugins(ips_byte_extract);
128     PluginManager::load_plugins(ips_byte_jump);
129     PluginManager::load_plugins(ips_byte_math);
130     PluginManager::load_plugins(ips_byte_test);
131     PluginManager::load_plugins(ips_cvs);
132     PluginManager::load_plugins(ips_enable);
133     PluginManager::load_plugins(ips_file_type);
134     PluginManager::load_plugins(ips_flags);
135     PluginManager::load_plugins(ips_fragbits);
136     PluginManager::load_plugins(ips_fragoffset);
137     PluginManager::load_plugins(ips_gid);
138     PluginManager::load_plugins(ips_icmp_id);
139     PluginManager::load_plugins(ips_icmp_seq);
140     PluginManager::load_plugins(ips_icode);
141     PluginManager::load_plugins(ips_id);
142     PluginManager::load_plugins(ips_ipopts);
143     PluginManager::load_plugins(ips_ip_proto);
144     PluginManager::load_plugins(ips_isdataat);
145     PluginManager::load_plugins(ips_itype);
146     PluginManager::load_plugins(ips_msg);
147     PluginManager::load_plugins(ips_pcre);
148     PluginManager::load_plugins(ips_priority);
149     PluginManager::load_plugins(ips_raw_data);
150     PluginManager::load_plugins(ips_rem);
151     PluginManager::load_plugins(ips_rev);
152     PluginManager::load_plugins(ips_rpc);
153     PluginManager::load_plugins(ips_seq);
154     PluginManager::load_plugins(ips_sid);
155     PluginManager::load_plugins(ips_soid);
156     PluginManager::load_plugins(ips_target);
157     PluginManager::load_plugins(ips_tag);
158     PluginManager::load_plugins(ips_tos);
159     PluginManager::load_plugins(ips_ttl);
160     PluginManager::load_plugins(ips_bufferlen);
161     PluginManager::load_plugins(ips_window);
162 #ifdef HAVE_HYPERSCAN
163     PluginManager::load_plugins(ips_regex);
164     PluginManager::load_plugins(ips_sd_pattern);
165 #endif
166 #endif
167 }
168 
169