Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WinpcapPacketInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool WinpcapPacketInterface::recPacket (neo::MemoryBlock& buffer, net::InetAddre
packet::IPHeader* ipheader = (packet::IPHeader*)(packetData + sizeof(packet::EthernetHeader));
if (header->destAddr == m_sourceMAC && header->type == ETHERNET_TYPE_IP)
{
if (m_destinationMAC.isHSRP() || header->srcAddr == m_destinationMAC)
if (m_destinationMAC.isHSRP() || header->srcAddr == m_destinationMAC || m_destinationMAC.isAzure() )
{
memcpy(buffer.getBlock(), packetData + sizeof(packet::EthernetHeader), packetHeader->caplen - sizeof(packet::EthernetHeader));
from.setIPAddress(ipheader->sourceIP.get());
Expand Down
20 changes: 20 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "CondensedTraceOutput.h"
#include "tcptrace.h"

#include <tchar.h>

using namespace std;

const char optionCharHelp = '?';
Expand Down Expand Up @@ -175,9 +177,27 @@ BOOL ctrlHandler(DWORD ctrlType)
return TRUE;
}

BOOL LoadNpcapDlls()
{
_TCHAR npcap_dir[512];
UINT len;
len = GetSystemDirectory(npcap_dir, 480);
if (!len) {
fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError());
return FALSE;
}
_tcscat_s(npcap_dir, 512, _T("\\Npcap"));
if (SetDllDirectory(npcap_dir) == 0) {
fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError());
return FALSE;
}
return TRUE;
}

int main(int argc, char* argv[])
{
LoadNpcapDlls();

timeBeginPeriod(1);
SetConsoleCtrlHandler((PHANDLER_ROUTINE) ctrlHandler, TRUE);

Expand Down
12 changes: 12 additions & 0 deletions packet/PacketDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ namespace packet

return 0;
}

// Azure MAC address: 12:34:56:78:9a:bc
bool isAzure()
{
u_char AzrMAC[] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc };
EthernetAddress MACAddr;
std::memcpy(MACAddr.addr, AzrMAC, 6);
if (*this == MACAddr) {
return 1;
}
return 0;
}
};

#define ETHERNET_TYPE_IP 0x800
Expand Down