mac-address

Get a machines MAC address on the local network from its IP in C#

百般思念 提交于 2019-11-28 07:46:48
I am trying write a function that takes a single IP address as a parameter and queries that machine on my local network for it's MAC address . I have seen many examples that get the local machine's own MAC address , however none (I've found) that seem to query a local network machine for it. I know such a task is achievable as this Wake on LAN scanner software scans the local IP range and returns MAC address/Hostname of all on machines. Can anyone tell me where I'd get started trying to write a function to achieve this in C#? Any help would be appreciated. Thanks EDIT: As per Marco Mp's

C# Get Computer's MAC address “OFFLINE”

五迷三道 提交于 2019-11-28 06:05:47
Is there any way to get computer's mac address when there is no internet connection in c#? I'am able to get when I have connection but not able to get when I am offline. But strongly I need the mac address for my work. My online code; var macAddr = (from nic in NetworkInterface.GetAllNetworkInterfaces() where nic.OperationalStatus == OperationalStatus.Up select nic.GetPhysicalAddress().ToString()).FirstOrDefault(); From WMI: public static string GetMACAddress1() { ManagementObjectSearcher objMOS = new ManagementObjectSearcher("Select * FROM Win32_NetworkAdapterConfiguration");

'ManagementClass' does not exist in the namespace 'System.Management'

妖精的绣舞 提交于 2019-11-28 02:46:50
问题 Hi i'm using this method for get the mac address public string GetMACAddress() { System.Management.ManagementClass mc = default(System.Management.ManagementClass); ManagementObject mo = default(ManagementObject); mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); foreach (var mo in moc) { if (mo.Item("IPEnabled") == true) { return mo.Item("MacAddress").ToString(); }else return null; } } but i receive this error Compiler Error

Formatting MAC address in C#

眉间皱痕 提交于 2019-11-27 23:36:43
In my C# application, I want to get my MAC address by using NetworkInterface class as the following: NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces() { mac = nic.GetPhysicalAddress() } But this code returns the MAC without ':' or any other separator. How can I retrieve the MAC in this format: 88:88:88:88:87:88 using the code above ONLY? try mac = string.Join (":", (from z in nic.GetPhysicalAddress().GetAddressBytes() select z.ToString ("X2")).ToArray()); The help for the command shows one way: http://msdn.microsoft.com/en-us/library/system.net.networkinformation

Manage ifaddrs to return MAC addresses as well in Swift

北城以北 提交于 2019-11-27 23:19:55
I've got the following code that successfully retrieves all the IPs connected to my router. But I need to a get the MAC Addresses for each IP. So instead of addresses being returned as an array with [ips] , be returned as a dictionary [ips:0000000, mac: 000000] Is it possible to be achieved with changes to the following code (from How to get Ip address in swift )? func getIFAddresses() -> [String] { print("GET IF ADDRESSSE") var addresses = [String]() // Get list of all interfaces on the local machine: var ifaddr : UnsafeMutablePointer<ifaddrs> = nil if getifaddrs(&ifaddr) == 0 { print(

iOS - Get ARP table

前提是你 提交于 2019-11-27 22:37:11
I am trying to build a network scanner. I know the procedure so I want to ping all available hosts in the network and then get the ARP table so I can map the MAC address for each IP. I Googled for ARP table but I didn't find any guide how to implement this feature. I also found these similar questions on Stack overflow: Link1 Link2 The answer are unclear on how to implement the ARP feature. Is there any official guide for this one? Is Apple approving the ARP table feature? UPDATE AFTER 10.2 Check the library here I finally got it working so I will post the procedure in detail to save some time

Is it possible to get the SSID & MAC Address of Currently connected WiFi Network in an App

一世执手 提交于 2019-11-27 20:18:30
I am looking for a way to get both the MAC Adress and the SSID of the currently connected WiFi Network in my project. I have used Tony Million's Reachability to decide when the user is on a WiFi network or not and was testing Kenial's NICInfo only to find out that it only provides the iPhone's WiFi MAC Address. Although both projects helped greatly in there own way, they do not get the job done. I am wondering if there is a public API (for certain Apple App Approval) or some back door to achieve this. Jai Govindani This involves a few different things: Getting SSID - This is independent of the

Getting the MAC-Address of a client with a browser

自古美人都是妖i 提交于 2019-11-27 18:16:38
问题 I have the following problem: I have a webserver. This webserver is behind a router. The problem is, I need the MAC-Address of a client that opens a website on the server for further purposes. I tried already to get the MAC-Address via an ActiveX-Object, but the client needs WMI installed. Here is the actual code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="vs

Getting Device ID or Mac Address in iOS [duplicate]

纵饮孤独 提交于 2019-11-27 17:21:06
This question already has an answer here: How can I programmatically get the MAC address of an iphone 12 answers I have an application that uses rest to communicate to a server, i would like to obtain the iphones either mac address or device ID for uniqueness validation, how can this be done? Steven Canfield [[UIDevice currentDevice] uniqueIdentifier] is guaranteed to be unique to each device. Alex Terente uniqueIdentifier (Deprecated in iOS 5.0. Instead, create a unique identifier specific to your app.) The docs recommend use of CFUUIDCreate instead of [[UIDevice currentDevice]

how to spoof MAC address via code

ε祈祈猫儿з 提交于 2019-11-27 15:18:57
I'm trying to spoof the MAC address of the computer that executes my program. Right now I'm getting the current MAC address of the machine using the 'getmac' command via cmd, then I want to change it via the 'RegistryKey' class(windows.system32). The issue is that I don't know the string to pass to the OpenSubKey method. For example this is the method to read the current MAC with registry key reading: private string readMAC() { RegistryKey rkey; string MAC; rkey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\0012", true);