Do this on one place, so we can change it easy and don't duplicate const
@@ -444,6 +444,16 @@ return FALSE;
/*===========================================================================*/
void showhashrecord(hcx_t *hcxrecord, uint8_t showinfo1, uint8_t showinfo2)
{
+ void output(FILE *where, hcx_t *hcxrecord, uint32_t *hash)
+ {
+
+ fprintf(where, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s\n",
+ hash[0], hash[1], hash[2], hash[3],
+ hcxrecord->mac_ap.addr[0], hcxrecord->mac_ap.addr[1], hcxrecord->mac_ap.addr[2], hcxrecord->mac_ap.addr[3], hcxrecord->mac_ap.addr[4], hcxrecord->mac_ap.addr[5],
+ hcxrecord->mac_sta.addr[0], hcxrecord->mac_sta.addr[1], hcxrecord->mac_sta.addr[2], hcxrecord->mac_sta.addr[3], hcxrecord->mac_sta.addr[4], hcxrecord->mac_sta.addr[5],
+ hcxrecord->essid);
+ }
+
int i;
hcxhrc_t hashrec;
uint32_t hash[4];
@@ -559,11 +569,7 @@ md5_64 (block, hash);
if(showinfo1 == TRUE)
{
- printf("%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s\n",
- hash[0], hash[1], hash[2], hash[3],
- hcxrecord->mac_ap.addr[0], hcxrecord->mac_ap.addr[1], hcxrecord->mac_ap.addr[2], hcxrecord->mac_ap.addr[3], hcxrecord->mac_ap.addr[4], hcxrecord->mac_ap.addr[5],
- hcxrecord->mac_sta.addr[0], hcxrecord->mac_sta.addr[1], hcxrecord->mac_sta.addr[2], hcxrecord->mac_sta.addr[3], hcxrecord->mac_sta.addr[4], hcxrecord->mac_sta.addr[5],
- hcxrecord->essid);
+ output(stdout, hcxrecord, hash);
}
if(showinfo2 == TRUE)
@@ -576,13 +582,7 @@ if(showinfo2 == TRUE)
exit(EXIT_FAILURE);
}
}
-
- fprintf(fhshowinfo2, "%08x%08x%08x%08x:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%s\n",
- hash[0], hash[1], hash[2], hash[3],
- hcxrecord->mac_ap.addr[0], hcxrecord->mac_ap.addr[1], hcxrecord->mac_ap.addr[2], hcxrecord->mac_ap.addr[3], hcxrecord->mac_ap.addr[4], hcxrecord->mac_ap.addr[5],
- hcxrecord->mac_sta.addr[0], hcxrecord->mac_sta.addr[1], hcxrecord->mac_sta.addr[2], hcxrecord->mac_sta.addr[3], hcxrecord->mac_sta.addr[4], hcxrecord->mac_sta.addr[5],
- hcxrecord->essid);
- fclose(fhshowinfo2);
+ output(fhshowinfo2, hcxrecord, hash);
}
return;
}
