Skip to content

Commit c7822b2

Browse files
author
=
committed
prepare waterfall display option
1 parent 30e1b00 commit c7822b2

1 file changed

Lines changed: 116 additions & 1 deletion

File tree

hcxdumptool.c

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,10 @@ for(i = 0; i < APLIST_MAX - 1; i++)
12041204
if(((aplist + i)->apdata->tsm2 - (aplist + i)->apdata->tsm1) > TSEAPOL1) break;
12051205
wanteventflag |= exiteapolm3flag;
12061206
(aplist + i)->apdata->m1m2m3 = '+';
1207+
if(rds == 5) fprintf(stdout, "%02x%02x%02x%02x%02x%02x <-> %02x%02x%02x%02x%02x%02x %.*s EAPOL M1M2M3\n",
1208+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->maca[1], (aplist + i)->apdata->maca[2], (aplist + i)->apdata->maca[3], (aplist + i)->apdata->maca[4], (aplist + i)->apdata->maca[5],
1209+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->macc[1], (aplist + i)->apdata->macc[2], (aplist + i)->apdata->macc[3], (aplist + i)->apdata->macc[4], (aplist + i)->apdata->macc[5],
1210+
(aplist + i)->apdata->essidlen, (aplist + i)->apdata->essid);
12071211
writeepb();
12081212
return;
12091213
}
@@ -1230,6 +1234,10 @@ if(replaycountrg == replaycount)
12301234
memcpy((calist + i)->cadata->mic, wpakey->keymic, KEYMIC_MAX);
12311235
(calist + i)->cadata->clientcount -= 1;
12321236
(calist + i)->cadata->m2 = '+';
1237+
if(rds == 5) fprintf(stdout, "%02x%02x%02x%02x%02x%02x <-> %02x%02x%02x%02x%02x%02x %.*s EAPOL M1M2ROGUE\n",
1238+
(calist + i)->cadata->maca[0], (calist + i)->cadata->maca[1], (calist + i)->cadata->maca[2], (calist + i)->cadata->maca[3], (calist + i)->cadata->maca[4], (calist + i)->cadata->maca[5],
1239+
(calist + i)->cadata->maca[0], (calist + i)->cadata->macc[1], (calist + i)->cadata->macc[2], (calist + i)->cadata->macc[3], (calist + i)->cadata->macc[4], (calist + i)->cadata->macc[5],
1240+
(calist + i)->cadata->essidlen, (calist + i)->cadata->essid);
12331241
(calist + i)->cadata->channel = (scanlist + scanlistindex)->channel;
12341242
wanteventflag |= exiteapolm2rgflag;
12351243
if((calist + i)->cadata->akm == RSNPSK) writeepbm1wpa2();
@@ -1253,6 +1261,10 @@ for(i = 0; i < APLIST_MAX - 1; i++)
12531261
if(((aplist + i)->apdata->replaycount1) != (aplist + i)->apdata->replaycount2) break;
12541262
if(((aplist + i)->apdata->tsm2 - (aplist + i)->apdata->tsm1) > TSEAPOL1) break;
12551263
(aplist + i)->apdata->m1m2 = '+';
1264+
if(rds == 5) fprintf(stdout, "%02x%02x%02x%02x%02x%02x <-> %02x%02x%02x%02x%02x%02x %.*s EAPOL M1M2\n",
1265+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->maca[1], (aplist + i)->apdata->maca[2], (aplist + i)->apdata->maca[3], (aplist + i)->apdata->maca[4], (aplist + i)->apdata->maca[5],
1266+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->macc[1], (aplist + i)->apdata->macc[2], (aplist + i)->apdata->macc[3], (aplist + i)->apdata->macc[4], (aplist + i)->apdata->macc[5],
1267+
(aplist + i)->apdata->essidlen, (aplist + i)->apdata->essid);
12561268
wanteventflag |= exiteapolm2flag;
12571269
writeepb();
12581270
return;
@@ -1295,7 +1307,14 @@ for(i = 0; i < APLIST_MAX - 1; i++)
12951307
{
12961308
if(memcmp(zeroed, pmkid->pmkid, PMKID_MAX) != 0)
12971309
{
1298-
if((aplist + i)->apdata->essidlen != 0) (aplist + i)->apdata->pmkid = '+';
1310+
if((aplist + i)->apdata->essidlen != 0)
1311+
{
1312+
(aplist + i)->apdata->pmkid = '+';
1313+
if(rds == 5) fprintf(stdout, "%02x%02x%02x%02x%02x%02x <-> %02x%02x%02x%02x%02x%02x %.*s PMKID\n",
1314+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->maca[1], (aplist + i)->apdata->maca[2], (aplist + i)->apdata->maca[3], (aplist + i)->apdata->maca[4], (aplist + i)->apdata->maca[5],
1315+
(aplist + i)->apdata->maca[0], (aplist + i)->apdata->macc[1], (aplist + i)->apdata->macc[2], (aplist + i)->apdata->macc[3], (aplist + i)->apdata->macc[4], (aplist + i)->apdata->macc[5],
1316+
(aplist + i)->apdata->essidlen, (aplist + i)->apdata->essid);
1317+
}
12991318
memcpy((aplist + i)->apdata->rsnpmkid, pmkid->pmkid, PMKID_MAX);
13001319
wanteventflag |= exiteapolpmkidflag;
13011320
}
@@ -3293,6 +3312,94 @@ while(!wanteventflag)
32933312
return true;
32943313
}
32953314
/*---------------------------------------------------------------------------*/
3315+
static bool nl_scanloop_waterfall(void)
3316+
{
3317+
static ssize_t i;
3318+
static int fd_epoll = 0;
3319+
static int epi = 0;
3320+
static int epret = 0;
3321+
static struct epoll_event ev, events[EPOLL_EVENTS_MAX];
3322+
static size_t packetcountlast = 0;
3323+
static u64 timer1count;
3324+
static struct timespec sleepled;
3325+
3326+
if((fd_epoll= epoll_create(1)) < 0) return false;
3327+
ev.data.fd = fd_socket_rx;
3328+
ev.events = EPOLLIN;
3329+
if(epoll_ctl(fd_epoll, EPOLL_CTL_ADD, fd_socket_rx, &ev) < 0) return false;
3330+
epi++;
3331+
3332+
ev.data.fd = fd_timer1;
3333+
ev.events = EPOLLIN;
3334+
if(epoll_ctl(fd_epoll, EPOLL_CTL_ADD, fd_timer1, &ev) < 0) return false;
3335+
epi++;
3336+
3337+
sleepled.tv_sec = 0;
3338+
sleepled.tv_nsec = GPIO_LED_DELAY;
3339+
if(gpiostatusled > 0)
3340+
{
3341+
GPIO_SET = 1 << gpiostatusled;
3342+
nanosleep(&sleepled, NULL);
3343+
GPIO_CLR = 1 << gpiostatusled;
3344+
}
3345+
if(nl_set_frequency() == false) errorcount++;
3346+
while(!wanteventflag)
3347+
{
3348+
if(errorcount > errorcountmax) wanteventflag |= EXIT_ON_ERROR;
3349+
epret = epoll_pwait(fd_epoll, events, epi, timerwaitnd, NULL);
3350+
if(epret == -1)
3351+
{
3352+
if(errno != EINTR)
3353+
{
3354+
#ifdef HCXDEBUG
3355+
fprintf(fh_debug, "epret failed: %s\n", strerror(errno));
3356+
#endif
3357+
errorcount++;
3358+
}
3359+
continue;
3360+
}
3361+
for(i = 0; i < epret; i++)
3362+
{
3363+
if(events[i].data.fd == fd_socket_rx) process_packet();
3364+
else if(events[i].data.fd == fd_timer1)
3365+
{
3366+
if(read(fd_timer1, &timer1count, sizeof(u64)) == -1) errorcount++;
3367+
lifetime++;
3368+
if((lifetime % timehold) == 0)
3369+
{
3370+
scanlistindex++;
3371+
if(nl_set_frequency() == false) errorcount++;
3372+
}
3373+
if((lifetime % 10) == 0)
3374+
{
3375+
if(gpiostatusled > 0)
3376+
{
3377+
GPIO_SET = 1 << gpiostatusled;
3378+
nanosleep(&sleepled, NULL);
3379+
GPIO_CLR = 1 << gpiostatusled;
3380+
}
3381+
if(gpiobutton > 0)
3382+
{
3383+
if(GET_GPIO(gpiobutton) > 0)
3384+
{
3385+
wanteventflag |= EXIT_ON_GPIOBUTTON;
3386+
if(gpiostatusled > 0) GPIO_SET = 1 << gpiostatusled;
3387+
}
3388+
}
3389+
if(errortxcount > errorcountmax) wanteventflag |= EXIT_ON_ERROR;
3390+
}
3391+
if((tottime > 0) && (lifetime >= tottime)) wanteventflag |= EXIT_ON_TOT;
3392+
if((lifetime % timewatchdog) == 0)
3393+
{
3394+
if(packetcount == packetcountlast) wanteventflag |= EXIT_ON_WATCHDOG;
3395+
packetcountlast = packetcount;
3396+
}
3397+
}
3398+
}
3399+
}
3400+
return true;
3401+
}
3402+
/*---------------------------------------------------------------------------*/
32963403
static bool nl_scanloop_rcascan(void)
32973404
{
32983405
static ssize_t i;
@@ -5790,6 +5897,14 @@ else if(rds == 0)
57905897
fprintf(stderr, "failed to initialize main scan loop\n");
57915898
}
57925899
}
5900+
else if(rds == 5)
5901+
{
5902+
if(nl_scanloop_waterfall() == false)
5903+
{
5904+
errorcount++;
5905+
fprintf(stderr, "failed to initialize main scan loop\n");
5906+
}
5907+
}
57935908
else
57945909
{
57955910
if(nl_scanloop_rds() == false)

0 commit comments

Comments
 (0)