#include <include.h>
#include <src/interface.h>
#include <src/crt_io.h>
#include <src/driver.h>
#include <src/wlan-ng.h>
#include <src/cisco.h>
#include <src/atheros.h>
#include <src/prism54g.h>
#include <src/airjack.h>
#include <src/hostap.h>
#include <src/hermes.h>
#include <src/ipw.h>
#include <src/pcap_file.h>
#include <src/madwifi-ng.h>
#include <src/errmsg.h>
Go to the source code of this file.
Functions | |
int | NextChannel (char *devname, unsigned int NumberOfHop) |
void | PrintScaleChannel (int channel) |
int | selectChannel (char *devname, int channel) |
int | shutCard (char *devname) |
int | openCard (char *devname) |
int | openPacket (char *devname) |
void | closePacket (void) |
int | getPacket (p80211_caphdr_t *wlan_header, UINT8 *buf, int maxlen) |
Variables | |
unsigned int | DebugLevel |
WINDOW * | Sum_WND |
WINDOW * | RealTime_WND |
ScanResult_t | Res |
ConfigStruct | config |
pthread_mutex_t | screen_mutex |
MUTEX for lock screen, so only one func write to it at the same time. | |
const UINT8 | ListChannel [13][14] |
static UINT8 | LockedBchan [14] |
const UINT8 | Posit [15] = { 0, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14 } |
const char * | Indic [15] |
int NextChannel | ( | char * | devname, | |
unsigned int | NumberOfHop | |||
) |
Definition at line 76 of file driver.c.
References ALL_CHANNEL_ARE_LOCKED, ErrorsMsg, ListChannel, LockedBchan, selectChannel(), and warning().
Referenced by ChangeChannel_th(), and main().
00077 { 00078 static UINT8 ChannelIndex = 0; 00079 int channel; 00080 int result; 00081 int TestsDone = 0; 00082 00083 do { 00084 if (NumberOfHop <= 7) 00085 channel = ListChannel[NumberOfHop - 1][ChannelIndex]; 00086 else 00087 channel = ListChannel[NumberOfHop - 1][13 - ChannelIndex]; 00088 ChannelIndex++; 00089 ChannelIndex = ChannelIndex % 14; 00090 TestsDone++; 00091 } while ((LockedBchan[channel - 1] != 0) && (TestsDone <= 14)); 00092 00093 if (TestsDone > 14) { 00094 warning("%s\n", ErrorsMsg[ALL_CHANNEL_ARE_LOCKED]); 00095 return ALL_CHANNEL_ARE_LOCKED; 00096 } else { 00097 //debug(3, "selectChannel (%s,%d)\n", devname, channel); 00098 result = selectChannel(devname, channel); 00099 //return result; 00100 return 0; 00101 } 00102 }
void PrintScaleChannel | ( | int | channel | ) |
Definition at line 115 of file driver.c.
References Indic, LockedBchan, Posit, screen_mutex, and Sum_WND.
Referenced by selectChannel(), and selectChannelWLAN().
00116 { 00117 int i; 00118 #ifdef WITH_THREAD 00119 pthread_mutex_lock(&screen_mutex); 00120 #endif 00121 mvwprintw(Sum_WND, 12, 7, "%02d%01X", channel, channel); 00122 mvwprintw(Sum_WND, 13, 2, "|_____________ _|"); 00123 for (i = 0; i < 14; i++) { 00124 if (LockedBchan[i] != 0) 00125 mvwprintw(Sum_WND, 13, 3 + i + ((i >= 13) << 1), "X"); 00126 } 00127 mvwprintw(Sum_WND, 13, 2 + Posit[channel], (char *) Indic[channel]); 00128 //mvwprintw (Sum_WND, 13, 2 + Posit[channel], "+"); 00129 //mvwprintw (Sum_WND, 10, 20, "%02d", channel); 00130 //debug (2, "%02d\n", channel); 00131 wrefresh(Sum_WND); 00132 #ifdef WITH_THREAD 00133 pthread_mutex_unlock(&screen_mutex); 00134 #endif 00135 }
int selectChannel | ( | char * | devname, | |
int | channel | |||
) |
Definition at line 140 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, ERROR_PQT_TYPE_IS_UNKNOWN, fatal(), HOSTAP_CARD, IPW_CARD, LockedBchan, LUCENT_CARD, MADWIFI_NG_CARD, PCAP_VIRTUAL_CARD, PrintScaleChannel(), PRISM54G_CARD, ScanResult_t::SChannel, selectChannelAIRJACK(), selectChannelATHEROS(), selectChannelCISCO(), selectChannelHERMES(), selectChannelHOSTAP(), selectChannelIPW(), selectChannelMADWIFI_NG(), selectChannelPRISM54g(), selectChannelWLAN(), ConfigStruct::TypeOfCard, warning(), WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main(), NextChannel(), and parse_keystring().
00142 { 00143 int ret = 1; // ret == 0 : All is OK 00144 00145 switch (config.TypeOfCard) { 00146 case WLAN_NG_CARD: 00147 case WLAN_NG_CARD_AVS_CFF2: 00148 ret = selectChannelWLAN(devname, channel); 00149 break; 00150 case CISCO_CARD: 00151 case CISCO_CVS_CARD: 00152 ret = selectChannelCISCO(devname, channel); 00153 break; 00154 case LUCENT_CARD: 00155 ret = selectChannelHERMES(devname, channel); 00156 break; 00157 case HOSTAP_CARD: 00158 ret = selectChannelHOSTAP(devname, channel); 00159 break; 00160 case ATHEROS_CARD: 00161 ret = selectChannelATHEROS(devname, channel); 00162 break; 00163 case PRISM54G_CARD: 00164 ret = selectChannelPRISM54g(devname, channel); 00165 break; 00166 case AIRJACK_CARD: 00167 ret = selectChannelAIRJACK(devname, channel); 00168 break; 00169 case IPW_CARD: 00170 ret = selectChannelIPW(devname, channel); 00171 break; 00172 case MADWIFI_NG_CARD: 00173 ret = selectChannelMADWIFI_NG(devname, channel); 00174 break; 00175 case PCAP_VIRTUAL_CARD: 00176 // Nothink to do :-) 00177 // it's a file ! 00178 ret = 0; 00179 break; 00180 default: 00181 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00182 break; 00183 } 00184 00185 if (ret != 0) { 00186 LockedBchan[channel - 1] = 0xFF; 00187 warning 00188 ("This card do not support this Channel: %d, so it's now locked\n", 00189 channel - 1); 00190 } else { 00191 LockedBchan[channel - 1] = 0x00; 00192 Res.SChannel = channel; 00193 } 00194 PrintScaleChannel(channel); 00195 00196 return ret; 00197 }
int shutCard | ( | char * | devname | ) |
Definition at line 199 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, ERROR_PQT_TYPE_IS_UNKNOWN, FALSE, fatal(), HOSTAP_CARD, IPW_CARD, LUCENT_CARD, MADWIFI_NG_CARD, PCAP_VIRTUAL_CARD, PRISM54G_CARD, shutCardAIRJACK(), shutCardATHEROS(), shutCardCISCO(), shutCardHERMES(), shutCardHOSTAP(), shutCardIPW(), shutCardMADWIFI_NG(), shutCardPRISM54g(), shutCardWLAN(), ConfigStruct::TypeOfCard, WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main().
00200 { 00201 int ret = FALSE; 00202 00203 switch (config.TypeOfCard) { 00204 case WLAN_NG_CARD: 00205 case WLAN_NG_CARD_AVS_CFF2: 00206 ret = shutCardWLAN(devname); 00207 break; 00208 case CISCO_CARD: 00209 case CISCO_CVS_CARD: 00210 ret = shutCardCISCO(devname); 00211 break; 00212 case LUCENT_CARD: 00213 ret = shutCardHERMES(devname); 00214 break; 00215 case HOSTAP_CARD: 00216 ret = shutCardHOSTAP(devname); 00217 break; 00218 case ATHEROS_CARD: 00219 ret = shutCardATHEROS(devname); 00220 break; 00221 case PRISM54G_CARD: 00222 ret = shutCardPRISM54g(devname); 00223 break; 00224 case AIRJACK_CARD: 00225 ret = shutCardAIRJACK(devname); 00226 break; 00227 case IPW_CARD: 00228 ret = shutCardIPW(devname); 00229 break; 00230 case MADWIFI_NG_CARD: 00231 ret = shutCardMADWIFI_NG(devname); 00232 break; 00233 case PCAP_VIRTUAL_CARD: 00234 ret = 0; 00235 break; 00236 default: 00237 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00238 break; 00239 } 00240 return ret; 00241 }
int openCard | ( | char * | devname | ) |
Definition at line 243 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, ERROR_PQT_TYPE_IS_UNKNOWN, FALSE, fatal(), HOSTAP_CARD, IPW_CARD, LUCENT_CARD, MADWIFI_NG_CARD, openCardAIRJACK(), openCardATHEROS(), openCardCISCO(), openCardHERMES(), openCardHOSTAP(), openCardIPW(), openCardMADWIFI_NG(), openCardPRISM54g(), openCardWLAN(), PCAP_VIRTUAL_CARD, PRISM54G_CARD, ConfigStruct::TypeOfCard, WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main().
00244 { 00245 int ret = FALSE; 00246 00247 switch (config.TypeOfCard) { 00248 case WLAN_NG_CARD: 00249 case WLAN_NG_CARD_AVS_CFF2: 00250 ret = openCardWLAN(devname); 00251 break; 00252 case CISCO_CARD: 00253 case CISCO_CVS_CARD: 00254 ret = openCardCISCO(devname); 00255 break; 00256 case LUCENT_CARD: 00257 ret = openCardHERMES(devname); 00258 break; 00259 case HOSTAP_CARD: 00260 ret = openCardHOSTAP(devname); 00261 break; 00262 case ATHEROS_CARD: 00263 ret = openCardATHEROS(devname); 00264 break; 00265 case PRISM54G_CARD: 00266 ret = openCardPRISM54g(devname); 00267 break; 00268 case AIRJACK_CARD: 00269 ret = openCardAIRJACK(devname); 00270 break; 00271 case IPW_CARD: 00272 ret = openCardIPW(devname); 00273 break; 00274 case MADWIFI_NG_CARD: 00275 ret = openCardMADWIFI_NG(devname); 00276 break; 00277 case PCAP_VIRTUAL_CARD: 00278 ret = 0; 00279 break; 00280 default: 00281 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00282 break; 00283 } 00284 return ret; 00285 }
int openPacket | ( | char * | devname | ) |
Definition at line 291 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, ERROR_PQT_TYPE_IS_UNKNOWN, fatal(), HOSTAP_CARD, IPW_CARD, LUCENT_CARD, MADWIFI_NG_CARD, openPacketAIRJACK(), openPacketATHEROS(), openPacketCISCO(), openPacketHERMES(), openPacketHOSTAP(), openPacketIPW(), openPacketMADWIFI_NG(), openPacketPCAP(), openPacketPRISM54g(), openPacketWLAN(), PCAP_VIRTUAL_CARD, PRISM54G_CARD, ConfigStruct::TypeOfCard, WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main().
00292 { 00293 int ret = 0; 00294 00295 switch (config.TypeOfCard) { 00296 case WLAN_NG_CARD: 00297 ret = openPacketWLAN(devname); 00298 break; 00299 case WLAN_NG_CARD_AVS_CFF2: 00300 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00301 break; 00302 case CISCO_CARD: 00303 case CISCO_CVS_CARD: 00304 ret = openPacketCISCO(devname); 00305 break; 00306 case LUCENT_CARD: 00307 ret = openPacketHERMES(devname); 00308 break; 00309 case HOSTAP_CARD: 00310 ret = openPacketHOSTAP(devname); 00311 break; 00312 case ATHEROS_CARD: 00313 ret = openPacketATHEROS(devname); 00314 break; 00315 case PRISM54G_CARD: 00316 ret = openPacketPRISM54g(devname); 00317 break; 00318 case AIRJACK_CARD: 00319 ret = openPacketAIRJACK(devname); 00320 break; 00321 case IPW_CARD: 00322 ret = openPacketIPW(devname); 00323 break; 00324 case MADWIFI_NG_CARD: 00325 ret = openPacketMADWIFI_NG(devname); 00326 break; 00327 case PCAP_VIRTUAL_CARD: 00328 ret = openPacketPCAP(devname); 00329 break; 00330 default: 00331 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00332 break; 00333 } 00334 return ret; 00335 }
void closePacket | ( | void | ) |
Definition at line 340 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, closePacketAIRJACK(), closePacketATHEROS(), closePacketCISCO(), closePacketHERMES(), closePacketHOSTAP(), closePacketIPW(), closePacketMADWIFI_NG(), closePacketPCAP(), closePacketPRISM54g(), closePacketWLAN(), ERROR_PQT_TYPE_IS_UNKNOWN, fatal(), HOSTAP_CARD, IPW_CARD, LUCENT_CARD, MADWIFI_NG_CARD, PCAP_VIRTUAL_CARD, PRISM54G_CARD, ConfigStruct::TypeOfCard, WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main().
00341 { 00342 switch (config.TypeOfCard) { 00343 case WLAN_NG_CARD: 00344 closePacketWLAN(); 00345 break; 00346 case WLAN_NG_CARD_AVS_CFF2: 00347 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00348 break; 00349 case CISCO_CARD: 00350 case CISCO_CVS_CARD: 00351 closePacketCISCO(); 00352 break; 00353 case LUCENT_CARD: 00354 closePacketHERMES(); 00355 break; 00356 case HOSTAP_CARD: 00357 closePacketHOSTAP(); 00358 break; 00359 case ATHEROS_CARD: 00360 closePacketATHEROS(); 00361 break; 00362 case PRISM54G_CARD: 00363 closePacketPRISM54g(); 00364 break; 00365 case AIRJACK_CARD: 00366 closePacketAIRJACK(); 00367 break; 00368 case IPW_CARD: 00369 closePacketIPW(); 00370 break; 00371 case MADWIFI_NG_CARD: 00372 closePacketMADWIFI_NG(); 00373 break; 00374 case PCAP_VIRTUAL_CARD: 00375 closePacketPCAP(); 00376 break; 00377 default: 00378 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00379 break; 00380 } 00381 }
int getPacket | ( | p80211_caphdr_t * | wlan_header, | |
UINT8 * | buf, | |||
int | maxlen | |||
) |
Definition at line 384 of file driver.c.
References AIRJACK_CARD, ATHEROS_CARD, CISCO_CARD, CISCO_CVS_CARD, ERROR_PQT_TYPE_IS_UNKNOWN, fatal(), getPacketAIRJACK(), getPacketATHEROS(), getPacketCISCO(), getPacketHERMES(), getPacketHOSTAP(), getPacketIPW(), getPacketMADWIFI_NG(), getPacketPCAP(), getPacketPRISM54g(), getPacketWLAN(), HOSTAP_CARD, IPW_CARD, LUCENT_CARD, MADWIFI_NG_CARD, PCAP_VIRTUAL_CARD, PRISM54G_CARD, ConfigStruct::TypeOfCard, WLAN_NG_CARD, and WLAN_NG_CARD_AVS_CFF2.
Referenced by main().
00385 { 00386 int ret = 0; 00387 00388 switch (config.TypeOfCard) { 00389 case WLAN_NG_CARD: 00390 ret = getPacketWLAN(wlan_header, buf, maxlen); 00391 break; 00392 case WLAN_NG_CARD_AVS_CFF2: 00393 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00394 break; 00395 case CISCO_CARD: 00396 case CISCO_CVS_CARD: 00397 ret = getPacketCISCO(wlan_header, buf, maxlen); 00398 break; 00399 case LUCENT_CARD: 00400 ret = getPacketHERMES(wlan_header, buf, maxlen); 00401 break; 00402 case HOSTAP_CARD: 00403 ret = getPacketHOSTAP(wlan_header, buf, maxlen); 00404 break; 00405 case ATHEROS_CARD: 00406 ret = getPacketATHEROS(wlan_header, buf, maxlen); 00407 break; 00408 case PRISM54G_CARD: 00409 ret = getPacketPRISM54g(wlan_header, buf, maxlen); 00410 break; 00411 case AIRJACK_CARD: 00412 ret = getPacketAIRJACK(wlan_header, buf, maxlen); 00413 break; 00414 case IPW_CARD: 00415 ret = getPacketIPW(wlan_header, buf, maxlen); 00416 break; 00417 case MADWIFI_NG_CARD: 00418 ret = getPacketMADWIFI_NG(wlan_header, buf, maxlen); 00419 break; 00420 case PCAP_VIRTUAL_CARD: 00421 ret = getPacketPCAP(wlan_header, buf, maxlen); 00422 break; 00423 default: 00424 fatal(ERROR_PQT_TYPE_IS_UNKNOWN, ""); 00425 break; 00426 } 00427 return ret; 00428 }
unsigned int DebugLevel |
WINDOW* Sum_WND |
Definition at line 61 of file scanner.c.
Referenced by check_keys_th(), InitScreen(), main(), PrintScaleChannel(), RefreshAllWND(), and WriteSummary().
WINDOW * RealTime_WND |
pthread_mutex_t screen_mutex |
const UINT8 ListChannel[13][14] |
Initial value:
{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, {1, 3, 5, 7, 9, 11, 13, 14, 2, 4, 6, 8, 10, 12}, {1, 4, 7, 10, 13, 2, 5, 8, 11, 14, 3, 6, 9, 12}, {1, 5, 9, 13, 3, 7, 11, 2, 6, 10, 14, 4, 8, 12}, {1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14, 5, 10}, {1, 7, 13, 5, 11, 3, 9, 2, 8, 14, 6, 12, 4, 10}, {1, 8, 2, 9, 3, 10, 4, 11, 5, 12, 6, 13, 7, 14}, {1, 7, 13, 5, 11, 3, 9, 2, 8, 14, 6, 12, 4, 10}, {1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14, 5, 10}, {1, 5, 9, 13, 3, 7, 11, 2, 6, 10, 14, 4, 8, 12}, {1, 4, 7, 10, 13, 2, 5, 8, 11, 14, 3, 6, 9, 12}, {1, 3, 5, 7, 9, 11, 13, 14, 2, 4, 6, 8, 10, 12}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, }
Definition at line 54 of file driver.c.
Referenced by NextChannel().
UINT8 LockedBchan[14] [static] |
Definition at line 70 of file driver.c.
Referenced by NextChannel(), PrintScaleChannel(), and selectChannel().
const char* Indic[15] |
Initial value:
{ "", "^-.", "-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^-.", ".-^" }
Definition at line 109 of file driver.c.
Referenced by PrintScaleChannel().