Skip to content

Commit ad349b9

Browse files
author
Graa
committed
Added option to only log wpa handshake data
1 parent 933b5d0 commit ad349b9

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

src/airodump-ng.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ static char *
143143
get_manufacturer(unsigned char mac0, unsigned char mac1, unsigned char mac2);
144144
int is_filtered_essid(const uint8_t * essid);
145145

146+
bool log_handshake_flip;
147+
146148
/* bunch of global stuff */
147149
struct communication_options opt;
148150
static struct local_options
@@ -283,6 +285,9 @@ static struct local_options
283285
unsigned long min_pkts;
284286

285287
int relative_time; /* read PCAP in psuedo-real-time */
288+
289+
bool log_handshake_only; /* only save packets required for WPA cracking */
290+
286291
} lopt;
287292

288293
static void resetSelection(void)
@@ -1248,6 +1253,8 @@ static int dump_add_packet(unsigned char * h80211,
12481253
struct ST_info * st_prv = NULL;
12491254
struct NA_info * na_prv = NULL;
12501255

1256+
if (lopt.log_handshake_only == 1) log_handshake_flip = false;
1257+
12511258
/* skip all non probe response frames in active scanning simulation mode */
12521259
if (lopt.active_scan_sim > 0 && h80211[0] != 0x50) return (0);
12531260

@@ -2326,6 +2333,8 @@ static int dump_add_packet(unsigned char * h80211,
23262333
{
23272334
p = h80211 + 28;
23282335

2336+
if (lopt.log_handshake_only == 1) log_handshake_flip = 1;
2337+
23292338
while (p < h80211 + caplen)
23302339
{
23312340
if (p + 2 + p[1] > h80211 + caplen) break;
@@ -2664,6 +2673,8 @@ static int dump_add_packet(unsigned char * h80211,
26642673
{
26652674
ap_cur->EAP_detected = 1;
26662675

2676+
if (lopt.log_handshake_only == 1) log_handshake_flip = 1;
2677+
26672678
z += 2; // skip ethertype
26682679

26692680
if (st_cur == NULL) goto write_packet;
@@ -3034,6 +3045,11 @@ static int dump_add_packet(unsigned char * h80211,
30343045

30353046
if (opt.f_cap != NULL && caplen >= 10)
30363047
{
3048+
if (lopt.log_handshake_only == 1 && log_handshake_flip == 0)
3049+
{
3050+
return (0);
3051+
}
3052+
30373053
pkh.len = pkh.caplen = (uint32_t) caplen;
30383054

30393055
gettimeofday(&tv, NULL);
@@ -5843,6 +5859,7 @@ int main(int argc, char * argv[])
58435859
{"background", 1, 0, 'K'},
58445860
{"min-packets", 1, 0, 'n'},
58455861
{"real-time", 0, 0, 'T'},
5862+
{"handshake_only", 0, 0, 'O'},
58465863
{0, 0, 0, 0}};
58475864

58485865
pid_t main_pid = getpid();
@@ -6039,7 +6056,7 @@ int main(int argc, char * argv[])
60396056
option
60406057
= getopt_long(argc,
60416058
argv,
6042-
"b:c:egiw:s:t:u:m:d:N:R:aHDB:Ahf:r:EC:o:x:MUI:WK:n:T",
6059+
"b:c:egiw:s:t:u:m:d:N:R:aHDB:Ahf:r:EC:o:x:MUI:WK:n:TO",
60436060
long_options,
60446061
&option_index);
60456062

@@ -6567,6 +6584,20 @@ int main(int argc, char * argv[])
65676584
#endif
65686585
break;
65696586

6587+
case 'O':
6588+
// Only log handshakes
6589+
opt.output_format_pcap = 1;
6590+
lopt.log_handshake_only = 1;
6591+
6592+
opt.output_format_csv = 0;
6593+
opt.output_format_kismet_csv = 0;
6594+
opt.output_format_kismet_netxml = 0;
6595+
opt.output_format_log_csv = 0;
6596+
opt.usegpsd = 0;
6597+
ivs_only = 0;
6598+
6599+
break;
6600+
65706601
default:
65716602
airodump_usage();
65726603
return (EXIT_FAILURE);

0 commit comments

Comments
 (0)