From 886d30278f3f682ba4022552721382ef4eb0ea61 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 16 May 2020 22:43:42 +0200 Subject: [PATCH] Fix IPv4 parsing from windows state tables --- firewall/interception/windowskext/handler.go | 1 + network/iphelper/tables.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/firewall/interception/windowskext/handler.go b/firewall/interception/windowskext/handler.go index 254c046b..857a5bcb 100644 --- a/firewall/interception/windowskext/handler.go +++ b/firewall/interception/windowskext/handler.go @@ -113,6 +113,7 @@ func Handler(packets chan packet.Packet) { } } +// convertIPv4 as needed for data from the kernel func convertIPv4(input [4]uint32) net.IP { addressBuf := make([]byte, 4) binary.BigEndian.PutUint32(addressBuf, input[0]) diff --git a/network/iphelper/tables.go b/network/iphelper/tables.go index b2ea8286..2dcaf5c1 100644 --- a/network/iphelper/tables.go +++ b/network/iphelper/tables.go @@ -297,8 +297,9 @@ func (ipHelper *IPHelper) getTable(ipVersion, protocol uint8) (connections []*so return connections, binds, nil } +// convertIPv4 as needed for iphlpapi.dll func convertIPv4(input uint32) net.IP { addressBuf := make([]byte, 4) - binary.BigEndian.PutUint32(addressBuf, input) + binary.LittleEndian.PutUint32(addressBuf, input) return net.IP(addressBuf) }