I did lookup on StackOverflow and Googled, but did not find any code that can help me on this.
Request help here on this please.
We have a network with many computers. I would want to enter the name of a computer and should be able to get back the OSArchitecture, IPAddress and Full Computer Name.
I want to achieve this using VB.net
I tried using the "My.Computer.Name" and related options, but it gives me details of my computer only, I would to query the details of a specific computer on the network.
Note: This is a domain controlled network, not requesting for Home Workgroup
Getting the IP addresses is straight forward:
Dim ips As IPAddress[]
ips = Dns.GetHostAddresses(Dns.GetHostName())
The other information you could get through WMI
Related
When I search something on google.com, I see interaction with the following IP address: 172.217.7.132
But when I attempt to reverse lookup the ip address, I get iad30s08-in-f132.1e100.net. and iad30s08-in-f4.1e100.net., not google.com.
What do I need to do in order to correctly identify that this IP address is resolved by google.com.
EDIT
Clarifying the question: My problem is not specific to google.com. I want to programmatically/logically arrive at google.com because that's what my browser requested for.
Same problem exists in the case of amazon: The IP address it resolves to, on reverseDNS gives me: server-13-32-167-140.sea19.r.cloudfront.net. instead of amazon.com
Code for performing reverse lookup:
In [1]: def reverse_lookup(ip_address):
...: from dns import reversename, resolver
...: domain_address = reversename.from_address(ip_address)
...: return [answer.to_text() for answer in resolver.query(domain_address, "PTR")]
As others have mentioned, 1e100.net does, in fact, belong to google. Their reverse DNS is going to resolve to whatever they want it to resolve to, and there's not much you can do about that.
Depending on your requirements, another alternative may be using a geolocation database to gather more information about an IP. You can find a demo of this here:
https://www.maxmind.com/en/geoip-demo
(enter your example address 172.217.7.132 in the form)
MaxMind has various products (some free, some commercial), so one of them may fit your needs of being able to look up this info programatically.
A different possible solution would be to get access to a WHOIS API, such as:
https://hexillion.com/whois
Example results:
https://hexillion.com/samples/WhoisXML/?query=172.217.7.132&_accept=application%2Fvnd.hexillion.whois-v2%2Bjson
https://support.google.com/faqs/answer/174717
1e100.net is a Google-owned domain name used to identify the servers in our network.
Following standard industry practice, we make sure each IP address has a corresponding hostname. In October 2009, we started using a single domain name to identify our servers across all Google products, rather than use different product domains such as youtube.com, blogger.com, and google.com.
Typically, you will get a 1e100.net result when you do a reverse lookup on one of their IPs. Consider it as good as a google.com result would be - you've verified that the IP is controlled by Google if you see it.
One exception to this is the Googlebot crawler, which may return google.com or googlebot.com results. (I would expect this to eventually get moved over to 1e100.net in the future.)
I am new to programming and I am trying to practice using APIs from third party websites to pull data to my own site. I am trying to use the Glassdoor API but I don't know where I find the required values for UserAgent and the UserIP. This is Glassdoor's explanation:
userip The IP address of the end user to whom the API results will be shown.
useragent The User-Agent (browser) of the end user to whom the API results will be shown. Note that you can can obtain this from the "User-Agent" HTTP request header from the end-user.
Note that for now I just want to pull some data onto a test website on my own computer and simply print the JSONP results onto the page. Where do I find these values? Thanks!
I was having the same trouble and think I can answer your question:
You can find your user IP address by simply Googling "what is my IP address." Google will give you the correct answer in the results or you can use another site like http://www.whatismyip.com/
Your user agent info is basically the info that identifies which browser is being used, what version, and on which operating system. You can also google this and be provided with the string or you can open up your console (right click in the browser window --> inspect elements --> console) and type navigator.userAgent which will give you the info you seek.
Hope this helps!
You can put your IP address lookup in your code rather than googling it. For example, in R:
Require(RCurl)
Require(rjson)
str_info <- getURL('http://ipinfo.io')
data <- fromJSON(str_info)
userip <- paste("userip=",data$ip, sep = "")
In Visual Basic, I'm making a program that will send me an email with the IP address of my laptop (just for fun).
The only way that I can think of getting my external IP address is to look at the source for ipchicken.com
It's easy to pull the text down but how do I isolate my IP address?
Note: The IP Address in the source is around line 36, but that is subject to change. Here's the link for all Chrome users: view-source:http://ipchicken.com/
Use http://icanhazip.com/
It returns just the string with IP.
Maybe you can check what is done over here : http://htmlagilitypack.codeplex.com/
If you want to know how to reach a node inside the HTML, use your favorite browser, right click on the IP adress on the website -> inspect element -> copy CSS path (or XPath path)
Here is a sample you might need http://htmlagilitypack.codeplex.com/SourceControl/latest#Trunk/Samples/GetDocLinks/GetDocLinks.cs
I found the answer to my own question:
You can use this RegEx to look for the pattern of an IP:
\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b
The one above searches for the pattern xxx.xxx.xxx.xxx where "xxx" is a number ranging from 0 to 255.
You can find a tutorial here.
I run this site and I approve access for a section of the site for people. I only want to approve static ips. If i have a bunch of IPs how do I find out if they are static or not? I can do the remaining parts but there is probably some function in the socket library or something that lets me script the part to find if the users are using static or dynamic IP.
thanks !
Php/Js would work too.
There is no way to inherently tell if an IP address is static or dynamically assigned. Based on the hostname that the IPs resolve to, you could probably make a guess as to whether they are static or not, but there is nothing definitive to facilitate this.
You could use the socket module to resolve the IPs to hostnames and flag them as "static" or "dynamic" based on some kind of "best guess" algorithm, but it would be only that: a best guess.
Here is an example using a random Verizon FiOS IP address. This assumes that any IP starting with "pool" is dynamically assigned.
>>> hostname = socket.gethostbyaddr('71.243.222.111')[0]
>>> if 'pool' in hostname:
... print hostname, 'is dynamic'
...
pool-71-243-222-111.lsanca.fios.verizon.net is dynamic
You're going to have a very tough time determining all of the various naming conventions and this would in no way be a complete solution.
You might want to ask yourself what kind of problem you're trying to solve first, and whether filtering access by IP address is providing the kind of verification you need.
I'd use a pragmatic solution: New accounts have a trial phase of a few days. After that they can only log in from the same IP used to sign up. If they still have that same IP it's most likely static.
Well, you don't have a problem, do you? If they ask for access from IP X, you give them access from IP X. If it turns out that it was dynamic and they switch, they no longer have access. In practice, no access from dynamic IPs :)
Seriously though, the authority on IP assignment type is the host from which the user is accessing. Thus, you need to ask the user what it says in his/her config.
What I want to do is use one PC to test an application on another on the same 19.2.168.X.X
I would like to make it seem like SOAP requests are coming from a variety of different PCs, just to make the applciations log file easier to read and I have been told that virtual IP Addresses are the way to go. So, how do I defien a range and then use them one by one in VB? (I guss that this is effectively IP header spooging?)
Not exactly sure what you want to do but I'd suggest first looking at the WMI class Win32_NetworkAdapterConfiguration to see if you can do what you want with it.
If that class does not support it you might have to use INetCfg instead, where I think you can change pretty much any network settings, but it's a bit more difficult to use. Here's a codeproject article for using INetCfg from C# which might at least show you how to get started.
If you just want to create a random IP address, generate 4 random numbers from 0 to 255 and glue some dots between them.