如何确定IP地址属于哪家公司? [英] How can I determine which company an IP address belongs to?

查看:1031
本文介绍了如何确定IP地址属于哪家公司?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我第一次猜测是这样的:

  string hostname = Dns.GetHostEntry(IPAddress.Parse(ip))。 

但是如果反向DNS设置不正确,这似乎发生了90 %的时间。



然而,一些网站仍然能够成功地确定与特定IP相关联的公司,即使反向DNS失败。例如,在本网站上,ISP提供商字段有时包含有价值的信息(即公司名称),即使主机名未设置。



使用.net实现同样的事情最简单的方法是什么?






注意:




  • 我不需要规范名称。即,MS或Microsoft都可以。

  • 我瞄准大公司,这可能是拥有他们的IP地址范围。

  • 我在Windows上运行,所以unix的whois工具默认情况下不会安装。






关于使用whois的编辑:有时,没有与IP相关联的whois信息

解决方案

您可以安装 whois 从微软窗口的命令行工具



编辑:那么您要查找什么信息?

 > whois bbc.co.uk 
域名:
bb c.co.uk

注册人:
英国广播公司

注册人类型:
英国有限公司,(公司编号:000057)

注册人的地址:
研究&开发
Kingswood Warren
Tadworth
Surrey
KT20 6NP
英国

注册商:
英国广播公司[Tag = BBC ]


I'm trying to programmaticaly determine the company* associated with a given IP address.

My first guess was this :

  string hostname = Dns.GetHostEntry(IPAddress.Parse(ip)).HostName;

but this won't work if the reverse DNS isn't set correctly, which seems to happen 90% of the time.

However some websites are still able to successfully determine the company associated with a specific IP even if the reverse dns fails. For example, on this site, the ISP Provider field sometimes contains valuable information (ie the name of the company) even if the hostname isn't set.

What's the easiest way to achieve the same thing using .net ?


Notes :

  • I don't need a canonical name. ie MS or Microsoft are both ok.
  • I'm targeting big companies, which are likely to "own" their IP address ranges.
  • I'm running on Windows, so unix's whois tools are not installed by default.

Edit regarding the use of whois : Sometimes, there's no whois information associated with an IP

解决方案

You can install the whois command line tool for windows from microsoft

edit: then what information are you looking for ?

>whois bbc.co.uk
Domain name:
    bbc.co.uk

Registrant:
    British Broadcasting Corporation

Registrant type:
    UK Limited Company, (Company number: 000057)

Registrant's address:
    Research & Development
    Kingswood Warren
    Tadworth
    Surrey
    KT20 6NP
    United Kingdom

Registrar:
    British Broadcasting Corporation [Tag = BBC]

这篇关于如何确定IP地址属于哪家公司?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆