简体   繁体   English

我如何知道数据包将在python中到达或来自哪个url

[英]How do i know which url a packet is going to or coming from in python

Below is an example of the packets I'm getting:- 以下是我收到的数据包的示例:-

---------------------------------Packet----------------------------------------
Destination MAC : 88:ae:1d:ab:11:95 Source MAC : d0:d0:fd:f5:74:46 Protocol : 8
Version : 4 IP Header Length : 5 TTL : 53 Protocol : 6 Source Address : 196.45.51.39 Destination Address : 10.0.9.137
Source Port : 3128 Dest Port : 52662 Sequence Number : 623854838 Acknowledgement : 396375922 TCP header length : 5

--------------------------------------------------------------------------------

In theory you can try a reverse DNS lookup: 从理论上讲,您可以尝试反向DNS查找:

import socket
socket.gethostbyaddr(<IP_ADDRESS>)

You have to replace IP_ADDRESS. 您必须替换IP_ADDRESS。

But I am not sure if it works, if your provider use NATs. 但是,如果您的提供商使用NAT,我不确定是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何知道哪个URL负责在Python Flask中调用路由函数 - How do I know which URL is responsible for the call to a route function from inside of it in Python Flask 如何知道属性来自哪个类 - How to know from which class an attribute is coming 如果我确切知道它将有多大,如何将数组/列表传递给 python? - How do I pass a array/list to python if I know exactly how big it is going to be? 您应该如何知道实际要执行的pyTZ? - How are you supposed to know which pyTZ is actually going to do as expected? GCM,我怎么知道XMPP数据包的结尾? - GCM, how do I know end of XMPP packet? 我如何知道哪个参数在Python(使用OpenCV)中引发异常? - How do I know which argument throws an exception in Python (with OpenCV)? 我如何知道在Python中捕获哪些异常 - How do I know which exceptions to catch in Python 我如何知道 taskmgr 中正在运行哪个 python 脚本? - How do I know which python script is running in taskmgr? 如何在 Python 中接收来自 IBs API 的数据? - How do I receive the data coming from IBs API in Python? 我在python中的返回字符串后面有一个空格,我不知道如何摆脱或它来自哪里 - I have a space after a return string in python that I don't know how to get rid of or where it's coming from
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM