1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-04-24 10:09:49 +02:00

Update c/meterpreter/source/extensions/stdapi/server/net/config/arp.c

Co-authored-by: Spencer McIntyre <58950994+smcintyre-r7@users.noreply.github.com>
This commit is contained in:
Alex Romero 2023-03-07 21:32:37 +03:30 committed by GitHub
parent 5df4982d73
commit 885d63d568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,28 +45,20 @@ DWORD get_arp_table(Remote *remote, Packet *response)
arp[1].buffer = (PUCHAR)pIpNetTable->table[i].bPhysAddr; arp[1].buffer = (PUCHAR)pIpNetTable->table[i].bPhysAddr;
arp[2].header.type = TLV_TYPE_MAC_NAME; arp[2].header.type = TLV_TYPE_MAC_NAME;
MIB_IFROW iface = { .dwIndex = pIpNetTable->table[i].dwIndex };
BOOL has_description = FALSE;
MIB_IFROW iface;
iface.dwIndex = pIpNetTable->table[i].dwIndex;
result = GetIfEntry(&iface); result = GetIfEntry(&iface);
if (result == NO_ERROR) if ((result == NO_ERROR) && (iface.bDescr)) {
{ arp[2].header.length = (DWORD)strlen(iface.bDescr) + 1;
if (iface.bDescr) arp[2].buffer = (PUCHAR)iface.bDescr;
{
arp[2].header.length = (DWORD)strlen(iface.bDescr) + 1;
arp[2].buffer = (PUCHAR)iface.bDescr;
has_description = TRUE;
}
} }
else {
if (!has_description) {
char interface_index[10]; char interface_index[10];
sprintf_s(interface_index, sizeof(interface_index), "%d", pIpNetTable->table[i].dwIndex); sprintf_s(interface_index, sizeof(interface_index), "%d", pIpNetTable->table[i].dwIndex);
arp[2].header.length = (DWORD)strlen(interface_index) + 1; arp[2].header.length = (DWORD)strlen(interface_index) + 1;
arp[2].buffer = (PUCHAR)interface_index; arp[2].buffer = (PUCHAR)interface_index;
} }
met_api->packet.add_tlv_group(response, TLV_TYPE_ARP_ENTRY, arp, 3); met_api->packet.add_tlv_group(response, TLV_TYPE_ARP_ENTRY, arp, 3);
} }
} }