1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-14 17:37:27 +01:00

Land #157, use RAW rather than string for binary hashes

This commit is contained in:
Brent Cook 2015-05-15 11:59:14 -05:00
commit 807005a39f
2 changed files with 5 additions and 4 deletions

View File

@ -325,7 +325,7 @@ DWORD request_fs_md5(Remote *remote, Packet *packet)
FILE *fd; FILE *fd;
size_t ret; size_t ret;
unsigned char buff[16384]; unsigned char buff[16384];
unsigned char hash[MD5_DIGEST_LENGTH + 1] = {0}; unsigned char hash[MD5_DIGEST_LENGTH];
filePath = packet_get_tlv_value_string(packet, TLV_TYPE_FILE_PATH); filePath = packet_get_tlv_value_string(packet, TLV_TYPE_FILE_PATH);
@ -340,7 +340,7 @@ DWORD request_fs_md5(Remote *remote, Packet *packet)
MD5_Final(hash, &context); MD5_Final(hash, &context);
packet_add_tlv_raw(response, TLV_TYPE_FILE_NAME, hash, sizeof(hash)); packet_add_tlv_raw(response, TLV_TYPE_FILE_HASH, hash, sizeof(hash));
fclose(fd); fclose(fd);
} }
@ -365,7 +365,7 @@ DWORD request_fs_sha1(Remote *remote, Packet *packet)
FILE *fd; FILE *fd;
size_t ret; size_t ret;
unsigned char buff[16384]; unsigned char buff[16384];
unsigned char hash[SHA_DIGEST_LENGTH + 1] = {0}; unsigned char hash[SHA_DIGEST_LENGTH];
filePath = packet_get_tlv_value_string(packet, TLV_TYPE_FILE_PATH); filePath = packet_get_tlv_value_string(packet, TLV_TYPE_FILE_PATH);
@ -380,7 +380,7 @@ DWORD request_fs_sha1(Remote *remote, Packet *packet)
fclose(fd); fclose(fd);
SHA1_Final(hash, &context); SHA1_Final(hash, &context);
packet_add_tlv_raw(response, TLV_TYPE_FILE_NAME, hash, sizeof(hash)); packet_add_tlv_raw(response, TLV_TYPE_FILE_HASH, hash, sizeof(hash));
} }
packet_add_tlv_uint(response, TLV_TYPE_RESULT, result); packet_add_tlv_uint(response, TLV_TYPE_RESULT, result);

View File

@ -24,6 +24,7 @@
#define TLV_TYPE_FILE_MODE MAKE_CUSTOM_TLV( TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_STDAPI, 1203 ) #define TLV_TYPE_FILE_MODE MAKE_CUSTOM_TLV( TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_STDAPI, 1203 )
#define TLV_TYPE_FILE_SIZE MAKE_CUSTOM_TLV( TLV_META_TYPE_UINT, TLV_TYPE_EXTENSION_STDAPI, 1204 ) #define TLV_TYPE_FILE_SIZE MAKE_CUSTOM_TLV( TLV_META_TYPE_UINT, TLV_TYPE_EXTENSION_STDAPI, 1204 )
#define TLV_TYPE_FILE_SHORT_NAME MAKE_CUSTOM_TLV( TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_STDAPI, 1205 ) #define TLV_TYPE_FILE_SHORT_NAME MAKE_CUSTOM_TLV( TLV_META_TYPE_STRING, TLV_TYPE_EXTENSION_STDAPI, 1205 )
#define TLV_TYPE_FILE_HASH MAKE_CUSTOM_TLV( TLV_META_TYPE_RAW, TLV_TYPE_EXTENSION_STDAPI, 1206 )
#define TLV_TYPE_STAT_BUF MAKE_CUSTOM_TLV( TLV_META_TYPE_COMPLEX, TLV_TYPE_EXTENSION_STDAPI, 1220 ) #define TLV_TYPE_STAT_BUF MAKE_CUSTOM_TLV( TLV_META_TYPE_COMPLEX, TLV_TYPE_EXTENSION_STDAPI, 1220 )