tests: added support for .hccapx to the tests

pull/1030/head
philsmd 7 years ago
parent 9005b66626
commit 7466ea941a
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF

@ -4857,7 +4857,7 @@ sub gen_hash
}
elsif ($mode == 2500)
{
my ($bssid, $stmac, $snonce, $anonce, $eapol, $keyver, $eapol_size);
my ($bssid, $stmac, $snonce, $anonce, $eapol, $keyver, $eapol_len, $essid_len);
if (! defined ($additional_param))
{
@ -4886,7 +4886,7 @@ sub gen_hash
$eapol = $additional_param6;
}
$eapol_size = length ($eapol);
$eapol_len = length ($eapol);
# constants
@ -4927,45 +4927,54 @@ sub gen_hash
$mic = substr ($mic, 0, 16);
#
# format the binary output
# format the binary output (.hccapx version 3)
#
$hash_buf = "";
my $HCCAPX_VERSION = 3;
# first the essid (NULL-padded up to the first 36 bytes)
# signature
$hash_buf = "HCPX";
$hash_buf .= $salt_buf;
$hash_buf .= "\x00" x (36 - length ($salt_buf));
# format version
$hash_buf .= pack ("L<", $HCCAPX_VERSION);
# the 2 MAC addresses
# authenticated
$hash_buf .= pack ("C", 1);
$hash_buf .= $bssid;
$hash_buf .= $stmac;
# essid length
$essid_len = length ($salt_buf);
$hash_buf .= pack ("C", $essid_len);
# nonces
$hash_buf .= $snonce;
$hash_buf .= $anonce;
# essid (NULL-padded up to the first 32 bytes)
$hash_buf .= $salt_buf;
$hash_buf .= "\x00" x (32 - $essid_len);
# eapol
# key version
$hash_buf .= pack ("C", $keyver);
$hash_buf .= $eapol;
$hash_buf .= "\x00" x (256 - $eapol_size);
# key mic
$hash_buf .= $mic;
# eapol size
# access point MAC
$hash_buf .= $bssid;
$hash_buf .= pack ("L*", $eapol_size);
# access point nonce
$hash_buf .= $snonce;
# key version
# client MAC
$hash_buf .= $stmac;
$hash_buf .= pack ("L*", $keyver);
# client nonce
$hash_buf .= $anonce;
# and finally: the key mic
# eapol length
$hash_buf .= pack ("S<", $eapol_len);
$hash_buf .= $mic;
# eapol
$hash_buf .= $eapol;
$hash_buf .= "\x00" x (256 - $eapol_len);
# base64 encode the output
$tmp_hash = encode_base64 ($hash_buf, '');
}
elsif ($mode == 2600)

Loading…
Cancel
Save