python - 隐藏python服务器ip
问题描述
我想知道是否有任何方法可以隐藏 python 套接字服务器 ip(使用 tor 或代理)。
我知道您可以通过 tor 发出客户端请求,但我希望能够连接到服务器而不必知道他的真实 IP 地址(以 .onion 地址为例)
该代码将可访问,因此加密 ip 可能不是解决方案。
我现在的服务器代码:
import socket
s = socket.socket()
host = "192.168.1.1"
port = 9999
print(f"server will start on host:{host}")
s.bind((host, port))
print("Server is bond !")
s.listen(1)
client, address = s.accept()
print(address, "connected")
我的客户代码:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '192.168.1.18'# ip address of the server (that I would like to hide)
port = 80
try:
s.connect((host, port))
print("connected !")
except:
print("error !")
解决方案
推荐阅读
- python - 当我们设计一个返回 json 字符串的 API 服务时,我们应该使用 ensure_ascii=False 还是 ensure_ascii=True?
- c# - 如何获取所有属性的列表,包括类文件中嵌套对象中的属性
- laravel - Laravel 连接具有中间关系的表
- python-3.x - 如何创建具有相同键值的嵌套字典
- aws-lambda - AWS lambda 内联编辑器不保存更改
- apache - 清漆 HTC 状态 -1 Magento 2 Apache
- linux-kernel - 使用 bcc/bpf 的最大 uprobe 数
- c# - 许多相对较大的对象的 C# 垃圾回收
- java - 如何打印 LinkedList 的不同数据?
- selenium - Selenium:JavaScript 警告:return 语句后无法访问代码