ip-address

How to get device type from MAC or IP address?

可紊 提交于 2019-12-06 03:07:12
I am making a Device Discovery windows application in C#. Is this possible to know the device type if I have MAC address or IP address? device type means either it is computer or router or mobile or any other device? Note: HostName entry is not useful for it because Host Name is defined by User. for example i may assign "Nokia N70" name to my computer. Thanks in anticipation. You can get the manufacturer from the MAC address. In order to get any more information you'd need to do a port scan to do a 'fingerprint' of the device in question. Application such as NMAP use this approach. Non-spoofed

Java Getting IPv4 Address

雨燕双飞 提交于 2019-12-06 02:19:36
问题 Regarding this link where using the codes provided to produce the IP addresses. String ip; try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface iface = interfaces.nextElement(); // filters out 127.0.0.1 and inactive interfaces if (iface.isLoopback() || !iface.isUp()) continue; Enumeration<InetAddress> addresses = iface.getInetAddresses(); while(addresses.hasMoreElements()) { InetAddress addr =

How to store IP address list in C# List to make it searchable for subnets too?

↘锁芯ラ 提交于 2019-12-06 01:52:29
问题 how should I correctly store IP address list with addresses which are subnets to make it searchable? There are two examples: I have IP address 1.2.3.4 and in my C# List there is 1.2.3.4 entry so here we have no problems. I have IP address 3.4.5.6 and in my C# List I have subnet 3.4.0.0/24. Here is my problem. How to store IP subnet in List to cover second example? Thanks 回答1: At the end of this answer you will find a complete implementation of a structure to represent a IPV4 address. Here is

Can I use EnableStatic for configuring an IPv6 addres (using WMI)?

心已入冬 提交于 2019-12-06 01:29:36
I would like to use WMI (in C++) to configure a static IPv6 address. Configuring a static IPv4 address is working fine using EnableStatic , which is part of a WMI class named Win32_NetworkAdapterConfiguration . Can anyone help me configure an IPv6 address using WMI? I have been looking for example code, but have not found any. No. According to the Win32_NetworkAdapterConfiguration documentation on the MSDN web site , this API supports limited IPv6 functionality (looks like it's limited to just reading addresses on an interface) starting in Windows Vista. You might also want to look at this

How to get ip address, referer, and user agent in ruby?

此生再无相见时 提交于 2019-12-06 01:24:10
问题 I want to log user's ip address, referer, and user agent. In PHP, I can get them from the following variables: $_SERVER['REMOTE_ADDR'] $_SERVER['HTTP_REFERER'] $_SERVER['HTTP_USER_AGENT'] How to get them in ruby? 回答1: You need the array request.env request.env['REMOTE_ADDR']: 回答2: PHP is embedded in a web server. Ruby is a general-purpose language: if you need a web server context, you'll have to install it yourself. Fortunately, it's easy. One of the easiest ways to get started is with

How do I increment an IP address represented as a string?

﹥>﹥吖頭↗ 提交于 2019-12-06 01:18:05
问题 I have an IP address in char type Like char ip = "192.123.34.134" I want increment the last value (134). Does anyone how should i do it? I think, i should convert it to an integer, and then back, but unfortunately i don't know how? :( I'm using C++. Please help me! Thanks, kampi 回答1: You can convert the IP address from a string to an integer using inet_addr , then, after manipulating it, convert it back to a string with inet_ntoa . See the documentation for these functions for more info on

Determine if net mask is valid in Java

旧街凉风 提交于 2019-12-06 01:03:06
What is the easiest way in Java 6 to determine whether a given address is a valid net mask? I have found one solution which basically creates an array of valid IPs to use in a comparison (i.e. "255.255.255.255", "255.255.255.254", "255.255.255.252", etc...). Is there an easier way or is this the best way? If you're happy to include an external dependency, then Apache's commons.net may have what you're looking for. Have a look at SubnetUtils and its SubnetInfo nested class. You can construct a SubnetUtils with an IP address and a mask. The constructor throws an exception if your mask is invalid

Get the IPaddress of the computer in an Android project using java

独自空忆成欢 提交于 2019-12-06 00:24:13
问题 I am using ksoap2-android and i need to get the IP address using java so that I don't have to type it manually everytime. What i mean by IP address is , for example if I do ipconfig using the command shell: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : f0::ed2:e3bf:8206:44%13 IPv4 Address. . . . . . . . . . . : 192.168.1.107 <--THIS ONE Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 The thing is am developing an

What is the Windows XP equivalent of inet_pton or InetPton?

丶灬走出姿态 提交于 2019-12-05 23:27:44
问题 I need to determine whether a particular string is a valid IPv4 or IPv6 address literal. If I understand correctly, the correct way to do this on POSIX systems is to use inet_pton to convert it into a network address structure and see if it succeeds. Windows Vista and later have InetPton which does essentially the same thing. But as far as I can tell, Windows XP doesn't declare either of those, and I need to be able to do this correctly on XP. So, the question is what system function to use

ip address of request from httpheader

倾然丶 夕夏残阳落幕 提交于 2019-12-05 22:10:05
问题 I am trying to get the IP address of the request coming in from the httpheader. If value is x do something, if not do somthing else. Can anyone help me out? 回答1: You might want to look here. The HTTP standards do not define the source address as part of the protocol. Infact HTTP does not directly relate to IPv4 /IPv6 at all. Generally, a webserver will easily be able to tell the network address of the other end of the socket ( the end where the web browser is ). It does not use HTTP to do