What is the most efficient way to get all of the external ip address of a machine with multiple nics, using python? I understand that an external server is neeeded (I have o
Required: WMI / PyWin32 (https://sourceforge.net/projects/pywin32/)
Use the following snippet to get the IP of the network card(s) on Windows.
import wmi
c = wmi.WMI()
for interface in c.Win32_NetworkAdapterConfiguration(IPEnabled=1):
print("Description: " + interface.Description)
print("IP: " + str(interface.IPAddress[0]))
print("MAC: " + str(interface.IPAddress[1]))
For more information on what parameters you can provide Win32_NetworkAdapterConfiguration
with visit: https://msdn.microsoft.com/en-us/library/aa394217(v=vs.85).aspx