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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
/*
*
* This is free software. You can redistribute it and/or modify under
* the terms of the GNU General Public License version 2.
*
* Copyright (C) 1998 by kra
*
*/
#include "hunt.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define LINES_O_UNLIMITED 1000000
int lines_o = LINES_O_UNLIMITED;
static void list_conn_properties(void)
{
int c;
int mac, seq;
c = menu_choose_char("print MAC y/n", "ny", conn_list_mac ? 'y' : 'n');
switch (c) {
case 'n':
mac = 0;
break;
case 'y':
mac = 1;
break;
default:
return;
}
c = menu_choose_char("print SEQ y/n", "ny", conn_list_seq ? 'y' : 'n');
switch (c) {
case 'n':
seq = 0;
break;
case 'y':
seq = 1;
break;
default:
return;
}
conn_list_mac = mac;
conn_list_seq = seq;
}
static void suggest_mac_setup(void)
{
char buf[128];
unsigned char buf_mac[ETH_ALEN];
sprintf_eth_mac(buf, __suggest_mac);
if (menu_choose_mac("suggest MAC base", buf_mac, buf) < 0)
return;
memcpy(__suggest_mac, buf_mac, sizeof(buf_mac));
}
static void print_host_properties(void)
{
switch (menu_choose_char("Resolve host names", "yn",
hl_mode == HL_MODE_NR ? 'n' : 'y')) {
case 'y':
hl_mode = HL_MODE_DEFERRED;
break;
case 'n':
hl_mode = HL_MODE_NR;
break;
default:
break;
}
}
static void mac_learn_from_ip_opt(void)
{
switch (menu_choose_char("Learn MAC from IP traffic", "yn",
mac_learn_from_ip == 0 ? 'n' : 'y')) {
case 'y':
mac_learn_from_ip = 1;
break;
case 'n':
mac_learn_from_ip = 0;
break;
default:
break;
}
}
static void storm_reset_sec_setup(void)
{
int sec;
if ((sec = menu_choose_unr("ACK storm reset sec", 0, 10000, storm_reset_sec)) < 0)
return;
storm_reset_sec = sec;
}
static void stormack_hijack_wait_sec_setup(void)
{
int sec;
if ((sec = menu_choose_unr("Sec to wait for next cmd with simple hijack", 0, 10000,
stormack_hijack_wait_sec)) < 0)
return;
stormack_hijack_wait_sec = sec;
}
static void arp_rr_count_setup(void)
{
int n;
if ((n = menu_choose_unr("Number of ARP request/reply packets hunt will send", 1, 32, arp_rr_count)) < 0)
return;
arp_rr_count = n;
}
static void arp_request_spoof_through_request_setup(void)
{
switch (menu_choose_char("arp request spoof through request", "yn",
arp_request_spoof_through_request ? 'y' : 'n')) {
case 'y':
arp_request_spoof_through_request = 1;
break;
case 'n':
arp_request_spoof_through_request = 0;
break;
default:
break;
}
}
static void arp_spoof_switch_setup(void)
{
switch (menu_choose_char("switched environment", "yn",
arp_spoof_switch ? 'y' : 'n')) {
case 'y':
arp_spoof_switch = 1;
break;
case 'n':
arp_spoof_switch = 0;
break;
default:
break;
}
}
static void arp_spoof_with_my_mac_setup(void)
{
switch (menu_choose_char("use my mac in ARP spoofing", "yn",
arp_spoof_with_my_mac ? 'y' : 'n')) {
case 'y':
arp_spoof_with_my_mac = 1;
break;
case 'n':
arp_spoof_with_my_mac = 0;
break;
default:
break;
}
}
static void printed_lines_per_page(void)
{
int n;
n = lines_o;
if (n == LINES_O_UNLIMITED)
n = 0;
if ((n = menu_choose_unr("Number of printed lines per page in listenings", 0, 10000, n)) < 0)
return;
if (n == 0)
lines_o = LINES_O_UNLIMITED;
else
lines_o = n;
}
int print_cntrl_chars = 1;
static void print_cntrl_chars_setup(void)
{
switch (menu_choose_char("print cntrl chars", "yn", 'y')) {
case 'y':
print_cntrl_chars = 1;
break;
case 'n':
print_cntrl_chars = 0;
break;
default:
break;
}
}
static void verbose_setup(void)
{
switch (menu_choose_char("verbose", "yn",
verbose ? 'y' : 'n')) {
case 'y':
verbose = 1;
break;
case 'n':
verbose = 0;
break;
default:
break;
}
}
void lines_o_press_key(void)
{
press_key("press key");
}
void options_menu(void)
{
char buf_menu[2048];
char buf_mac[128];
char *o_keys = "lamdcghrsqtwyepvix";
int run_it;
run_it = 1;
while (run_it) {
sprintf_eth_mac(buf_mac, __suggest_mac);
sprintf(buf_menu,
"l) list add conn policy \n"
"a/m/d) add/mod/del conn policy entry \n"
"c) conn list properties mac %c, seq %c\n"
"g) suggest mac base %s\n"
"h) host resolving %c " " t) arp req spoof through req %c\n"
"r) reset ACK storm timeout %3ds" " w) switched environment %c\n"
"s) simple hijack cmd timeout %3ds" " y) arp spoof with my mac %c\n"
"q) arp req/rep packets %3d " " e) learn MAC from IP traffic %c\n"
"p) number of lines per page %3d " " v) verbose %c\n"
"i) print cntrl chars %c\n"
"x) return\n",
conn_list_mac ? 'y' : 'n', conn_list_seq ? 'y' : 'n',
buf_mac,
hl_mode == HL_MODE_NR ? 'n' : 'y', arp_request_spoof_through_request ? 'y' : 'n',
storm_reset_sec, arp_spoof_switch ? 'y' : 'n',
stormack_hijack_wait_sec, arp_spoof_with_my_mac ? 'y' : 'n',
arp_rr_count, mac_learn_from_ip ? 'y' : 'n',
lines_o == LINES_O_UNLIMITED ? 0 : lines_o, verbose ? 'y' : 'n',
print_cntrl_chars ? 'y' : 'n');
switch (menu("options", buf_menu, "opt", o_keys, 0)) {
case 'l':
addpolicy_list_items();
break;
case 'a':
addpolicy_add_item();
break;
case 'd':
addpolicy_del_item();
break;
case 'm':
addpolicy_mod_item();
break;
case 'c':
list_conn_properties();
break;
case 'g':
suggest_mac_setup();
break;
case 'h':
print_host_properties();
break;
case 'r':
storm_reset_sec_setup();
break;
case 's':
stormack_hijack_wait_sec_setup();
break;
case 'e':
mac_learn_from_ip_opt();
break;
case 't':
arp_request_spoof_through_request_setup();
break;
case 'w':
arp_spoof_switch_setup();
break;
case 'y':
arp_spoof_with_my_mac_setup();
break;
case 'q':
arp_rr_count_setup();
break;
case 'p':
printed_lines_per_page();
break;
case 'v':
verbose_setup();
break;
case 'i':
print_cntrl_chars_setup();
break;
case 'x':
run_it = 0;
break;
}
}
}
|