如何识别内网计算机?

发布于 2025-01-08 01:19:25 字数 145 浏览 4 评论 0原文

我们如何识别内联网上不同的计算机/设备? 使用 cookie 可以实现这一点,但这并非万无一失。 我期待一些关于查找本地 IP 地址的事情。 如果您提到将其与 Intranet 应用程序集成所需的一些工具(库),那就太好了。该应用程序是用Python(Django)设计的。

How can we identify distinct computers/devices on an intranet?
This is possible using cookies but that is not foolproof.
I am expecting something on the lines of finding local ip address.
It would be great if you mention some tools(libraries) required to integrate it with an intranet application. The application is designed in Python(Django).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心的憧憬 2025-01-15 01:19:25

您可以从 HttpRequest 对象获取客户端(连接到 Web 服务器的计算机)IP 地址。如果您的 Django 视图是 def MyView(request):,您可以从 request.META.get('REMOTE_ADDR') 获取 IP。这就是您要找的吗?

You can get the client (computer connecting to your web server) IP address from the HttpRequest object. If your Django view is def MyView(request): you can get the IP from request.META.get('REMOTE_ADDR'). Is that what you're looking for?

哀由 2025-01-15 01:19:25

您可以查看 Django 上的 HttpRequest 文档:https://docs。 djangoproject.com/en/dev/ref/request-response/

在那里你会发现你可以使用视图或中间件上的请求对象了解用户的远程IP地址request.META["REMOTE_ADDR"]

我在多宿主服务器中使用它,其中内部 LAN 的请求发送到本地 IP 地址,公共请求发送到公共 IP 地址,将 REMOTE_ADDR 与我的内部 LAN 的开头进行比较地址我可以知道这是否是内部请求。

You could take a look at the HttpRequest documentation on Django: https://docs.djangoproject.com/en/dev/ref/request-response/

There you'll find that you can know the remote IP address of the user with the request object on your view or middleware using request.META["REMOTE_ADDR"]

I use this in a multihomed server where the requests for the internal LAN come to a local IP Address and the public requests goes to a public IP Address, there comparing the REMOTE_ADDR to the beginning of my internal LAN address i can know if it is an internal request or not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文