1 diff -urN kismet-2005-04-R1.old/kismet_drone.cc kismet-2005-04-R1.dev/kismet_drone.cc
2 --- kismet-2005-04-R1.old/kismet_drone.cc 2005-04-03 07:33:42.000000000 +0200
3 +++ kismet-2005-04-R1.dev/kismet_drone.cc 2005-04-27 17:10:22.000000000 +0200
7 #include "packetsource.h"
8 -#include "prism2source.h"
9 #include "pcapsource.h"
10 #include "wtapfilesource.h"
11 -#include "wsp100source.h"
12 -#include "vihasource.h"
13 #include "dronesource.h"
14 #include "packetsourcetracker.h"
15 #include "kis_packsources.h"
16 diff -urN kismet-2005-04-R1.old/kismet_server.cc kismet-2005-04-R1.dev/kismet_server.cc
17 --- kismet-2005-04-R1.old/kismet_server.cc 2005-04-03 07:33:42.000000000 +0200
18 +++ kismet-2005-04-R1.dev/kismet_server.cc 2005-04-27 17:10:35.000000000 +0200
22 #include "packetsource.h"
23 -#include "prism2source.h"
24 #include "pcapsource.h"
25 #include "wtapfilesource.h"
26 -#include "wsp100source.h"
27 -#include "vihasource.h"
28 #include "dronesource.h"
29 #include "packetsourcetracker.h"
30 #include "kis_packsources.h"
31 diff -urN kismet-2005-04-R1.old/kis_packsources.cc kismet-2005-04-R1.dev/kis_packsources.cc
32 --- kismet-2005-04-R1.old/kis_packsources.cc 2005-04-03 07:33:42.000000000 +0200
33 +++ kismet-2005-04-R1.dev/kis_packsources.cc 2005-04-27 17:11:22.000000000 +0200
35 REG_EMPTY_CARD(sourcetracker, "pcapfile");
38 + REG_EMPTY_CARD(sourcetracker, "cisco");
39 + REG_EMPTY_CARD(sourcetracker, "cisco_wifix");
40 #if defined(HAVE_LIBPCAP) && defined(HAVE_LINUX_WIRELESS)
41 // Linux wext-driven cards
42 - sourcetracker->RegisterPacketsource("cisco", 1, "IEEE80211b", 6,
43 - pcapsource_wext_registrant,
44 - monitor_cisco, unmonitor_cisco,
45 - chancontrol_wext, 1);
46 - sourcetracker->RegisterPacketsource("cisco_wifix", 1, "IEEE80211b", 6,
47 - pcapsource_ciscowifix_registrant,
48 - monitor_cisco_wifix, NULL, NULL, 1);
49 sourcetracker->RegisterPacketsource("hostap", 1, "IEEE80211b", 6,
50 pcapsource_wext_registrant,
51 monitor_hostap, unmonitor_hostap,
55 // Register the linuxwireless pcap stuff as null
56 - REG_EMPTY_CARD(sourcetracker, "cisco");
57 - REG_EMPTY_CARD(sourcetracker, "cisco_wifix");
58 REG_EMPTY_CARD(sourcetracker, "hostap");
59 REG_EMPTY_CARD(sourcetracker, "orinoco");
60 REG_EMPTY_CARD(sourcetracker, "acx100");
62 REG_EMPTY_CARD(sourcetracker, "wrt54g");
65 -#if defined(SYS_LINUX) && defined(HAVE_LINUX_NETLINK)
66 - sourcetracker->RegisterPacketsource("wlanng_legacy", 1, "IEEE80211b", 6,
67 - prism2source_registrant,
68 - monitor_wlanng_legacy, NULL,
69 - chancontrol_wlanng_legacy, 1);
71 REG_EMPTY_CARD(sourcetracker, "wlanng_legacy");
74 #if defined(HAVE_LIBPCAP) && defined(SYS_OPENBSD)
75 sourcetracker->RegisterPacketsource("cisco_openbsd", 1, "IEEE80211b", 6,
77 REG_EMPTY_CARD(sourcetracker, "wtapfile");
80 -#if defined(HAVE_WSP100)
81 - sourcetracker->RegisterPacketsource("wsp100", 0, "IEEE80211b", 6,
82 - wsp100source_registrant,
83 - monitor_wsp100, NULL, chancontrol_wsp100, 0);
85 REG_EMPTY_CARD(sourcetracker, "wsp100");
88 -#if defined(HAVE_VIHAHEADERS)
89 - sourcetracker->RegisterPacketsource("viha", 1, "IEEE80211b", 6,
90 - vihasource_registrant,
91 - NULL, NULL, chancontrol_viha, 0);
93 REG_EMPTY_CARD(sourcetracker, "viha");
98 diff -urN kismet-2005-04-R1.old/kis_packsources.h kismet-2005-04-R1.dev/kis_packsources.h
99 --- kismet-2005-04-R1.old/kis_packsources.h 2005-04-03 07:33:42.000000000 +0200
100 +++ kismet-2005-04-R1.dev/kis_packsources.h 2005-04-27 17:10:43.000000000 +0200
104 #include "packetsource.h"
105 -#include "prism2source.h"
106 #include "pcapsource.h"
107 #include "wtapfilesource.h"
108 -#include "wsp100source.h"
109 -#include "vihasource.h"
110 #include "dronesource.h"
111 #include "packetsourcetracker.h"
113 diff -urN kismet-2005-04-R1.old/Makefile.in kismet-2005-04-R1.dev/Makefile.in
114 --- kismet-2005-04-R1.old/Makefile.in 2005-04-03 07:33:42.000000000 +0200
115 +++ kismet-2005-04-R1.dev/Makefile.in 2005-04-27 17:10:09.000000000 +0200
119 PSO = util.o ringbuf.o configfile.o speech.o ifcontrol.o iwcontrol.o packet.o \
120 - pcapsource.o prism2source.o wtapfilesource.o wsp100source.o \
121 - dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
122 + pcapsource.o wtapfilesource.o \
123 + dronesource.o packetsourcetracker.o kis_packsources.o \
124 wtapdump.o wtaplocaldump.o gpsdump.o airsnortdump.o fifodump.o \
126 packetracker.o timetracker.o alertracker.o finitestate.o \
130 DRONEO = util.o ringbuf.o configfile.o getopt.o ifcontrol.o iwcontrol.o packet.o \
131 - tcpstreamer.o prism2source.o pcapsource.o wtapfilesource.o wsp100source.o \
132 - dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
133 + tcpstreamer.o pcapsource.o wtapfilesource.o \
134 + dronesource.o packetsourcetracker.o kis_packsources.o \
135 timetracker.o gpsd.o server_globals.o kismet_drone.o
138 diff -urN kismet-2005-04-R1.old/pcapsource.cc kismet-2005-04-R1.dev/pcapsource.cc
139 --- kismet-2005-04-R1.old/pcapsource.cc 2005-04-03 07:33:42.000000000 +0200
140 +++ kismet-2005-04-R1.dev/pcapsource.cc 2005-04-27 16:58:10.000000000 +0200
143 if (datalink_type == DLT_PRISM_HEADER) {
144 ret = Prism2KisPack(packet, data, moddata);
145 - } else if (datalink_type == KDLT_BSD802_11) {
146 - ret = BSD2KisPack(packet, data, moddata);
148 } else if (datalink_type == DLT_IEEE802_11_RADIO) {
149 ret = Radiotap2KisPack(packet, data, moddata);
154 -int PcapSource::BSD2KisPack(kis_packet *packet, uint8_t *data, uint8_t *moddata) {
155 - int callback_offset = 0;
157 - // Process our hacked in BSD type
158 - if (callback_header.caplen < sizeof(bsd_80211_header)) {
159 - snprintf(errstr, 1024, "pcap bsd converter saw undersized capture frame for bsd header.");
161 - packet->caplen = 0;
165 - packet->caplen = kismin(callback_header.caplen - sizeof(bsd_80211_header),
166 - (uint32_t) MAX_PACKET_LEN);
167 - packet->len = packet->caplen;
169 - bsd_80211_header *bsdhead = (bsd_80211_header *) callback_data;
171 - packet->signal = bsdhead->wi_signal;
172 - packet->noise = bsdhead->wi_silence;
175 - callback_offset = sizeof(bsd_80211_header);
176 - memcpy(packet->data, callback_data + callback_offset, 24);
178 - // Adjust for driver appended headers
179 - if (packet->data[0] > 0x08) {
181 - packet->caplen -= 22;
182 - memcpy(packet->data + 24, callback_data + callback_offset + 46,
183 - packet->caplen - 2);
186 - packet->caplen -= 30;
187 - memcpy(packet->data + 24, callback_data + callback_offset + 46,
188 - packet->caplen - 2);
196 * Convert MHz frequency to IEEE channel number.
198 return new PcapSourceWextFCS(in_name, in_device);
201 -KisPacketSource *pcapsource_ciscowifix_registrant(string in_name, string in_device, char *in_err) {
202 - vector<string> devbits = StrTokenize(in_device, ":");
204 - if (devbits.size() < 2) {
205 - snprintf(in_err, STATUS_MAX, "Invalid device pair '%s'", in_device.c_str());
209 - return new PcapSourceWext(in_name, devbits[1]);
212 KisPacketSource *pcapsource_11g_registrant(string in_name, string in_device,
214 return new PcapSource11G(in_name, in_device);
215 @@ -1004,132 +951,6 @@
218 #ifdef HAVE_LINUX_WIRELESS
219 -// Cisco uses its own config file in /proc to control modes
220 -int monitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
221 - FILE *cisco_config;
222 - char cisco_path[128];
224 - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
227 - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
231 - if (Iwconfig_Get_SSID(in_dev, in_err, ifparm->essid) < 0)
234 - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
237 - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
240 - if (Ifconfig_Delta_Flags(in_dev, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
244 - if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 1, 0, in_err) >= 0) {
248 - // Zero the ssid - nonfatal
249 - Iwconfig_Set_SSID(in_dev, in_err, NULL);
251 - // Build the proc control path
252 - snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", in_dev);
254 - if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
255 - snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
256 - cisco_path, errno, strerror(errno));
260 - fprintf(cisco_config, "Mode: r\n");
261 - fprintf(cisco_config, "Mode: y\n");
262 - fprintf(cisco_config, "XmitPower: 1\n");
264 - fclose(cisco_config);
266 - // Channel can't be set on cisco with these drivers.
271 -int unmonitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
272 - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
276 - if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 0, 0, in_err) >= 0) {
277 - // If we're the new drivers, unmonitor
278 - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
282 - // Reset the SSID since monitor mode nukes it
283 - if (Iwconfig_Set_SSID(in_dev, in_err, ifparm->essid) < 0)
286 - if (ifparm->channel > 0) {
287 - if (Iwconfig_Set_Channel(in_dev, ifparm->channel, in_err) < 0)
299 -// Cisco uses its own config file in /proc to control modes
301 -// I was doing this with ioctls but that seems to cause lockups while
302 -// this method doesn't. I don't think I like these drivers.
303 -int monitor_cisco_wifix(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
304 - FILE *cisco_config;
305 - char cisco_path[128];
306 - vector<string> devbits = StrTokenize(in_dev, ":");
308 - if (devbits.size() < 2) {
309 - snprintf(in_err, STATUS_MAX, "Invalid device pair '%s'", in_dev);
313 - // Bring the device up, zero its ip, and set promisc
314 - if (Ifconfig_Delta_Flags(devbits[0].c_str(), in_err,
315 - IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
317 - if (Ifconfig_Delta_Flags(devbits[1].c_str(), in_err,
318 - IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
321 - // Zero the ssid, nonfatally
322 - Iwconfig_Set_SSID(devbits[0].c_str(), in_err, NULL);
323 - Iwconfig_Set_SSID(devbits[1].c_str(), in_err, NULL);
325 - // Build the proc control path
326 - snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", devbits[0].c_str());
328 - if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
329 - snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
330 - cisco_path, errno, strerror(errno));
334 - fprintf(cisco_config, "Mode: r\n");
335 - fprintf(cisco_config, "Mode: y\n");
336 - fprintf(cisco_config, "XmitPower: 1\n");
338 - fclose(cisco_config);
340 - // Channel can't be set on cisco with these drivers.
345 // Hostap uses iwpriv and iwcontrol settings to control monitor mode
346 int monitor_hostap(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {