|
|
|
@ -58,7 +58,7 @@ typedef struct pbkdf2_sha1_tmp
|
|
|
|
|
|
|
|
|
|
typedef struct pbkdf2_sha1
|
|
|
|
|
{
|
|
|
|
|
u32 salt_buf[5];
|
|
|
|
|
u32 salt_buf[64];
|
|
|
|
|
|
|
|
|
|
} pbkdf2_sha1_t;
|
|
|
|
|
|
|
|
|
@ -140,7 +140,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
|
|
|
|
|
|
|
|
|
// salt
|
|
|
|
|
|
|
|
|
|
const u8 *salt_pos = token.buf[1];
|
|
|
|
|
const char *salt_pos = (char *) token.buf[1];
|
|
|
|
|
|
|
|
|
|
int salt_len = token.len[1];
|
|
|
|
|
|
|
|
|
@ -148,14 +148,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
|
|
|
|
|
|
|
|
|
memset (custom_salt, 0, sizeof (custom_salt));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < salt_len; i++, salt_pos++)
|
|
|
|
|
{
|
|
|
|
|
if (*salt_pos >= 'A' && *salt_pos <= 'Z') {
|
|
|
|
|
custom_salt[i] = *salt_pos + 32;
|
|
|
|
|
} else {
|
|
|
|
|
custom_salt[i] = *salt_pos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
strncpy (custom_salt, salt_pos, salt_len);
|
|
|
|
|
|
|
|
|
|
lowercase ((u8 *) custom_salt, salt_len);
|
|
|
|
|
|
|
|
|
|
if (salt_len < 8)
|
|
|
|
|
{
|
|
|
|
@ -163,7 +158,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
|
|
|
|
salt_len = 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy (pbkdf2_sha1->salt_buf, custom_salt, salt_len);
|
|
|
|
|
memcpy ((char *) pbkdf2_sha1->salt_buf, custom_salt, salt_len);
|
|
|
|
|
memcpy (salt->salt_buf, custom_salt, salt_len);
|
|
|
|
|
|
|
|
|
|
salt->salt_len = salt_len;
|
|
|
|
|
|
|
|
|
@ -196,32 +192,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
|
|
|
|
|
|
|
|
|
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
|
|
|
|
{
|
|
|
|
|
const u64 *digest = (u64 *) digest_buf;
|
|
|
|
|
|
|
|
|
|
const pbkdf2_sha1_t *pbkdf2_sha1 = (const pbkdf2_sha1_t *) esalt_buf;
|
|
|
|
|
|
|
|
|
|
// hash
|
|
|
|
|
|
|
|
|
|
u64 tmp[9];
|
|
|
|
|
|
|
|
|
|
tmp[0] = byte_swap_64 (digest[0]);
|
|
|
|
|
tmp[1] = byte_swap_64 (digest[1]);
|
|
|
|
|
tmp[2] = byte_swap_64 (digest[2]);
|
|
|
|
|
tmp[3] = byte_swap_64 (digest[3]);
|
|
|
|
|
tmp[4] = byte_swap_64 (digest[4]);
|
|
|
|
|
tmp[5] = byte_swap_64 (digest[5]);
|
|
|
|
|
tmp[6] = byte_swap_64 (digest[6]);
|
|
|
|
|
tmp[7] = byte_swap_64 (digest[7]);
|
|
|
|
|
tmp[8] = 0;
|
|
|
|
|
|
|
|
|
|
char hash_enc[256] = { 0 };
|
|
|
|
|
|
|
|
|
|
base64_encode (int_to_base64, (const u8 *) tmp, 64, (u8 *) hash_enc);
|
|
|
|
|
|
|
|
|
|
// output
|
|
|
|
|
const int line_len = snprintf (line_buf, line_size, "%s%s$%s", SIGNATURE_SOLARWINDS_ORION, (const u8 *) pbkdf2_sha1->salt_buf, hash_enc);
|
|
|
|
|
|
|
|
|
|
return line_len;
|
|
|
|
|
return snprintf (line_buf, line_size, "%s", hash_info->orighash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void module_init (module_ctx_t *module_ctx)
|
|
|
|
|