1 Index: iptables-1.3.7/extensions/.CHAOS-test
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ iptables-1.3.7/extensions/.CHAOS-test 2007-06-04 13:21:44.537205984 +0200
7 +[ -f "$KERNEL_DIR/include/linux/netfilter/xt_CHAOS.h" ] && echo "CHAOS";
8 Index: iptables-1.3.7/extensions/.DELUDE-test
9 ===================================================================
10 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
11 +++ iptables-1.3.7/extensions/.DELUDE-test 2007-06-04 13:21:44.537205984 +0200
15 Index: iptables-1.3.7/extensions/libipt_CHAOS.c
16 ===================================================================
17 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
18 +++ iptables-1.3.7/extensions/libipt_CHAOS.c 2007-06-04 13:21:44.537205984 +0200
21 + CHAOS target for iptables
23 + Copyright © Jan Engelhardt <jengelh [at] gmx de>, 2006 - 2007
24 + released under the terms of the GNU General Public
25 + License version 2.x and only versions 2.x.
31 +#include <iptables.h>
32 +#include <linux/netfilter_ipv4/ip_tables.h>
33 +#include <linux/netfilter/xt_CHAOS.h>
35 +static void libipt_chaos_help(void)
38 + "CHAOS target v%s options:\n"
39 + " --delude Enable DELUDE processing for TCP\n"
40 + " --tarpit Enable TARPIT processing for TCP\n",
45 +static int libipt_chaos_parse(int c, char **argv, int invert,
46 + unsigned int *flags, const struct ipt_entry *entry,
47 + struct ipt_entry_target **target)
49 + struct xt_chaos_info *info = (void *)((*target)->data);
52 + info->variant = XTCHAOS_DELUDE;
56 + info->variant = XTCHAOS_TARPIT;
63 +static void libipt_chaos_check(unsigned int flags)
67 + /* If flags == 0x03, both were specified, which should not be. */
68 + exit_error(PARAMETER_PROBLEM,
69 + "CHAOS: only one of --tarpit or --delude may be specified");
73 +static void libipt_chaos_print(const struct ipt_ip *ip,
74 + const struct ipt_entry_target *target, int numeric)
76 + const struct xt_chaos_info *info = (const void *)target->data;
77 + switch(info->variant) {
78 + case XTCHAOS_DELUDE:
81 + case XTCHAOS_TARPIT:
90 +static void libipt_chaos_save(const struct ipt_ip *ip,
91 + const struct ipt_entry_target *target)
93 + const struct xt_chaos_info *info = (const void *)target->data;
94 + switch(info->variant) {
95 + case XTCHAOS_DELUDE:
96 + printf("--delude ");
98 + case XTCHAOS_TARPIT:
99 + printf("--tarpit ");
107 +static struct option libipt_chaos_opts[] = {
108 + {"delude", 0, NULL, 'd'},
109 + {"tarpit", 0, NULL, 't'},
113 +static struct iptables_target libipt_chaos_info = {
115 + .version = IPTABLES_VERSION,
116 + .size = IPT_ALIGN(sizeof(struct xt_chaos_info)),
117 + .userspacesize = IPT_ALIGN(sizeof(struct xt_chaos_info)),
118 + .help = libipt_chaos_help,
119 + .parse = libipt_chaos_parse,
120 + .final_check = libipt_chaos_check,
121 + .print = libipt_chaos_print,
122 + .save = libipt_chaos_save,
123 + .extra_opts = libipt_chaos_opts,
126 +static __attribute__((constructor)) void libipt_chaos_init(void)
128 + register_target(&libipt_chaos_info);
131 Index: iptables-1.3.7/extensions/libipt_DELUDE.c
132 ===================================================================
133 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
134 +++ iptables-1.3.7/extensions/libipt_DELUDE.c 2007-06-04 13:21:44.537205984 +0200
137 + DELUDE target for iptables
139 + Copyright © Jan Engelhardt <jengelh [at] gmx de>, 2006 - 2007
140 + released under the terms of the GNU General Public
141 + License version 2.x and only versions 2.x.
147 +#include <iptables.h>
148 +#include <linux/netfilter_ipv4/ip_tables.h>
150 +static void libipt_delude_help(void)
152 + printf("DELUDE takes no options\n");
156 +static int libipt_delude_parse(int c, char **argv, int invert,
157 + unsigned int *flags, const struct ipt_entry *entry,
158 + struct ipt_entry_target **target)
163 +static void libipt_delude_check(unsigned int flags)
168 +static void libipt_delude_print(const struct ipt_ip *ip,
169 + const struct ipt_entry_target *target, int numeric)
174 +static void libipt_delude_save(const struct ipt_ip *ip,
175 + const struct ipt_entry_target *target)
180 +static struct option libipt_delude_opts[] = {
184 +static struct iptables_target libipt_delude_info = {
186 + .version = IPTABLES_VERSION,
187 + .size = IPT_ALIGN(0),
188 + .userspacesize = IPT_ALIGN(0),
189 + .help = libipt_delude_help,
190 + .parse = libipt_delude_parse,
191 + .final_check = libipt_delude_check,
192 + .print = libipt_delude_print,
193 + .save = libipt_delude_save,
194 + .extra_opts = libipt_delude_opts,
197 +static __attribute__((constructor)) void libipt_delude_init(void)
199 + register_target(&libipt_delude_info);
202 Index: iptables-1.3.7/extensions/libipt_portscan.c
203 ===================================================================
204 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
205 +++ iptables-1.3.7/extensions/libipt_portscan.c 2007-06-04 13:21:44.538205832 +0200
208 + portscan match for iptables
210 + Copyright © Jan Engelhardt <jengelh [at] gmx de>, 2006 - 2007
211 + released under the terms of the GNU General Public
212 + License version 2.x and only versions 2.x.
219 +#include <iptables.h>
220 +#include <linux/netfilter_ipv4/ip_tables.h>
221 +#include <linux/netfilter/xt_portscan.h>
223 +static void libipt_portscan_help(void)
226 + "portscan match v%s options:\n"
227 + "(Combining them will make them match by OR-logic)\n"
228 + " --stealth Match TCP Stealth packets\n"
229 + " --synscan Match TCP SYN scans\n"
230 + " --cnscan Match TCP Connect scans\n"
231 + " --grscan Match Banner Grabbing scans\n",
236 +static void libipt_portscan_mtinit(struct ipt_entry_match *match,
237 + unsigned int *nfcache)
239 + /* Cannot cache this */
240 + *nfcache |= NFC_UNKNOWN;
244 +static int libipt_portscan_parse(int c, char **argv, int invert,
245 + unsigned int *flags, const struct ipt_entry *entry, unsigned int *nfc,
246 + struct ipt_entry_match **match)
248 + struct xt_portscan_info *info = (void *)((*match)->data);
252 + info->match_cn = 1;
255 + info->match_gr = 1;
258 + info->match_syn = 1;
261 + info->match_stealth = 1;
268 +static void libipt_portscan_check(unsigned int flags)
273 +static void libipt_portscan_print(const struct ipt_ip *ip,
274 + const struct ipt_entry_match *match, int numeric)
276 + const struct xt_portscan_info *info = (const void *)(match->data);
277 + const char *s = "";
279 + printf("portscan ");
280 + if(info->match_stealth) {
284 + if(info->match_syn) {
285 + printf("%sSYNSCAN", s);
288 + if(info->match_cn) {
289 + printf("%sCNSCAN", s);
293 + printf("%sGRSCAN", s);
298 +static void libipt_portscan_save(const struct ipt_ip *ip,
299 + const struct ipt_entry_match *match)
301 + const struct xt_portscan_info *info = (const void *)(match->data);
302 + if(info->match_stealth) printf("--stealth ");
303 + if(info->match_syn) printf("--synscan ");
304 + if(info->match_cn) printf("--cnscan ");
305 + if(info->match_gr) printf("--grscan ");
309 +static struct option libipt_portscan_opts[] = {
310 + {"stealth", 0, NULL, 'x'},
311 + {"synscan", 0, NULL, 's'},
312 + {"cnscan", 0, NULL, 'c'},
313 + {"grscan", 0, NULL, 'g'},
317 +static struct iptables_match libipt_portscan_info = {
318 + .name = "portscan",
319 + .version = IPTABLES_VERSION,
320 + .size = IPT_ALIGN(sizeof(struct xt_portscan_info)),
321 + .userspacesize = IPT_ALIGN(sizeof(struct xt_portscan_info)),
322 + .help = libipt_portscan_help,
323 + .init = libipt_portscan_mtinit,
324 + .parse = libipt_portscan_parse,
325 + .final_check = libipt_portscan_check,
326 + .print = libipt_portscan_print,
327 + .save = libipt_portscan_save,
328 + .extra_opts = libipt_portscan_opts,
331 +static __attribute__((constructor)) void libipt_portscan_init(void)
333 + register_match(&libipt_portscan_info);
336 Index: iptables-1.3.7/extensions/.portscan-test
337 ===================================================================
338 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
339 +++ iptables-1.3.7/extensions/.portscan-test 2007-06-04 13:21:44.538205832 +0200
342 +[ -f "$KERNEL_DIR/include/linux/netfilter/xt_portscan.h" ] && echo "portscan";