allow hexified ESSIDs on --essid-list option
@@ -1398,13 +1398,15 @@ static int len;
static FILE *fh_essidlistin;
static FILE *fh_pmkideapol;
static struct stat statinfo;
+static char hexpfx[] = { "$HEX[" };
+
static int essidlistincount, essidlistinmax;
static essidlist_t *essidlistin, *zeiger, *essidlistinnew;
static hashlist_t *zeigerhash;
static int i, o;
-static char linein[128];
+static char linein[PMKIDEAPOL_BUFFER_LEN];
essidlistinmax = 1000;
if((essidlistin = (essidlist_t*)calloc(essidlistinmax, ESSIDLIST_SIZE)) == NULL) return;
@@ -1418,11 +1420,20 @@ zeiger = essidlistin;
essidlistincount = 0;
while(1)
{
- if((len = fgetline(fh_essidlistin, 128, linein)) == -1) break;
- if((len < 1) || (len > 32)) continue;
+ if((len = fgetline(fh_essidlistin, PMKIDEAPOL_BUFFER_LEN, linein)) == -1) break;
+ if((len < 1) || (len > 70)) continue;
memset(zeiger->essid, 0, 33);
+ if((len >= 8) && ((len %2) == 0) && (linein[len -1] == ']') && (memcmp(linein, hexpfx, 5) == 0))
+ {
+ linein[len -1] = 0;
+ zeiger->essidlen = getfield(&linein[5], 32, zeiger->essid);
+ }
+ else if(len <= 32)
+ {
zeiger->essidlen = len;
memcpy(zeiger->essid, linein, len);
+ }
+ else continue;
essidlistincount++;
if(essidlistincount >= essidlistinmax)
{
