如何通过 python 创建 wifi 到以太网适配器?
How to create a wifi to ethernet adapter via python?
我正在尝试使用我的 raspberry pi 3b+ 将 WIFI 转为以太网桥,但是我也想拦截一些网络流量,可能会对流量进行一些检查,并在需要时重定向使用我的 python 脚本。我在此处找到 this article 了解如何将 Wi-Fi 直接连接到以太网网桥,但我将如何使用 python 脚本在两者之间设置网桥?
在我看来,项目应该分为两部分:
使用来自 (wlan) 的重定向在 eth0 上创建一个 dhcp 服务器。使用 dnsmasq 和 iptable 规则等包可以轻松完成此操作。完整教程:https://www.raspberrypi.org/forums/viewtopic.php?t=132674(信息:wlan =wifi,eth0 = 以太网)。
然后,要分析流量,您必须制作自己的 DNS 服务器(因为拦截 https 流量(几乎)是不可能的)。您不会得到请求的内容(也不会得到答案),但会得到请求的 url。
但是,通过安装 pi-hole (https://pi-hole.net) (dns server for raspberry), you can then make python scripts that uses on the pi-hole api (in order to block and redirect requests). Either with command lines directly, or with a library like https://pypi.org/project/PiHole-api/
,制作自己的 dns 似乎很复杂
一切都清楚了吗?
我正在尝试使用我的 raspberry pi 3b+ 将 WIFI 转为以太网桥,但是我也想拦截一些网络流量,可能会对流量进行一些检查,并在需要时重定向使用我的 python 脚本。我在此处找到 this article 了解如何将 Wi-Fi 直接连接到以太网网桥,但我将如何使用 python 脚本在两者之间设置网桥?
在我看来,项目应该分为两部分:
使用来自 (wlan) 的重定向在 eth0 上创建一个 dhcp 服务器。使用 dnsmasq 和 iptable 规则等包可以轻松完成此操作。完整教程:https://www.raspberrypi.org/forums/viewtopic.php?t=132674(信息:wlan =wifi,eth0 = 以太网)。
然后,要分析流量,您必须制作自己的 DNS 服务器(因为拦截 https 流量(几乎)是不可能的)。您不会得到请求的内容(也不会得到答案),但会得到请求的 url。 但是,通过安装 pi-hole (https://pi-hole.net) (dns server for raspberry), you can then make python scripts that uses on the pi-hole api (in order to block and redirect requests). Either with command lines directly, or with a library like https://pypi.org/project/PiHole-api/
,制作自己的 dns 似乎很复杂
一切都清楚了吗?