Fix IPv4 parsing from windows state tables
This commit is contained in:
@@ -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 {
|
func convertIPv4(input [4]uint32) net.IP {
|
||||||
addressBuf := make([]byte, 4)
|
addressBuf := make([]byte, 4)
|
||||||
binary.BigEndian.PutUint32(addressBuf, input[0])
|
binary.BigEndian.PutUint32(addressBuf, input[0])
|
||||||
|
|||||||
@@ -297,8 +297,9 @@ func (ipHelper *IPHelper) getTable(ipVersion, protocol uint8) (connections []*so
|
|||||||
return connections, binds, nil
|
return connections, binds, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convertIPv4 as needed for iphlpapi.dll
|
||||||
func convertIPv4(input uint32) net.IP {
|
func convertIPv4(input uint32) net.IP {
|
||||||
addressBuf := make([]byte, 4)
|
addressBuf := make([]byte, 4)
|
||||||
binary.BigEndian.PutUint32(addressBuf, input)
|
binary.LittleEndian.PutUint32(addressBuf, input)
|
||||||
return net.IP(addressBuf)
|
return net.IP(addressBuf)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user