如何在 Windows 上模拟通过端口 80 阻止 RTMP?

发布于 2024-09-02 09:05:35 字数 1294 浏览 5 评论 0原文

我有一个连接到 Flash Media Server 的简单 Flash 客户端,我希望能够模拟客户端执行以下操作:

  • 尝试连接到端口 1935 上的 RTMP 流并失败,
  • 回退到端口上的 RTMP 443 并失败,
  • 回退到端口 80 上的 RTMP 并失败,最终
  • 回退到端口 80 上的 RTMPT (HTTP) 并成功。

这应该是 Flash 播放器的默认行为,例如如此处所述

在许多情况下,这就是您所需要的 甚至无需通过许多防火墙 使用 HTTP 隧道。这有效 因为内置的一个功能 网络连接对象。当你不这样做时 指定 RTMP 中的端口号 地址,Macromedia Flash 将尝试 连接到端口 1935。 如果失败 然后它会尝试连接到端口 443;如果失败,它将尝试端口 80。因此,如果您这样做,则无需编码即可访问端口 1935、443 或端口 80 未在 RTMP 中指定端口 地址。

这里

连接到 FMS 时,您将使用 客户端上的 netConnection 对象 侧,在参数范围内 connect方法可以设置什么 您要使用的协议: nc.connect(“rtmp://什么”)。如果你 这样做应该指出的是 Flash 播放器将循环播放 尝试不同的端口和协议 自动连接。当然 您可以设置您想要的协议 通过更改rtmp部分来使用。 的 Flash 播放器将尝试连接到 rtmp 通过端口 1935,然后是端口 80, 然后它会尝试 rtmpt (下面介绍) 通过端口 80

我使用的是 Windows 7 计算机,本质上我正在寻找有关如何模拟 Flash 无法连接到任何端口上的 RTMP 流并回退到 RTMPT 的环境的提示。 Windows防火墙似乎允许设置“协议号”(除了通常的端口号之外——例如,TCP是6,UDP 17等),但我似乎找不到RTMP的协议号。

如果有人对我如何简单地模拟这种行为有任何建议,我将非常感激。非常感谢。

I've got a simple Flash client connecting to a Flash Media Server, and I'd like to be able to simulate the client doing the following:

  • Attempting to connect to an RTMP stream on port 1935 and failing,
  • Falling back to RTMP on port 443 and failing,
  • Falling back to RTMP on port 80 and failing, and ultimately
  • Falling back to RTMPT (HTTP) over port 80 and succeeding.

This is supposed to be the default behavior of the Flash player, for example as described here:

In many cases, this is all you need to
get past many firewalls without even
using HTTP tunneling. This works
because of a feature built into the
NetConnection object. When you do not
specify a port number in an RTMP
address, Macromedia Flash will attempt
to connect to port 1935. If it fails
it will then try to connect to port
443; if that fails, it will try port
80.
So no coding is required to access ports 1935, 443, or port 80 if you do
not specify a port in the RTMP
address.

And here:

When connecting to FMS you'll use a
netConnection object on the client
side, within the parameters of the
connect method you can set what
protocol you want to use:
nc.connect("rtmp://whatever"). If you
do that it should be noted that the
flash player will cycle through
different ports and protocols trying
to connect up automatically. Of course
you can set which protocol you want to
use by changing the rtmp part. The
Flash player will try connecting to
rtmp over port 1935, then port 80,
then it'll try rtmpt (covered below)
over port 80
.

I'm on a Windows 7 machine, and essentially I'm looking for tips as to how I can simulate an environment in which Flash fails to connect to an RTMP stream on any port and falls back to RTMPT. Windows Firewall seems to allow for setting a "protocol number" (in addition to the usual port number -- e.g., TCP is 6, UDP 17, etc.), but I can't seem to find a protocol number for RTMP.

If anyone has any suggestions as to how I can simulate this behavior simply, I'd hugely appreciate it. Many thanks in advance.

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

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

发布评论

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

评论(3

怪我入戏太深 2024-09-09 09:05:35

我能够在 Windows 7 上使用 Firefox 并在本地计算机 (localhost) 上运行代理服务器来完成这项工作。我使用 Windows 防火墙阻止到进程“plugin-container.exe”的特定目标 IP 地址的端口 1935、443 和 80 的出站连接。 (相信Firefox 3.6及更高版本使用“plugin-container.exe”来运行Flash插件。)然后我设置Windows系统代理设置(通过IE,工具->Internet选项->连接->LAN设置)使用我的本地 http 代理服务器。有趣的是,即使在 Firefox 中运行,Flash 显然也使用 Windows 代理设置,而不是 Firefox 的代理设置。

I was able to make this work using Firefox on Windows 7 with a proxy server running on the local machine (localhost). I used Windows Firewall to block outbound connections to ports 1935, 443 and 80 for the specific destination IP address for process: "plugin-container.exe" . (Believe Firefox 3.6 and greater use "plugin-container.exe" for running the Flash plugin.) And then I set the Windows system proxy settings (via IE, Tools->Internet Options->Connections->LAN settings) to use my local http proxy server. Interesting that Flash apparently uses the Windows proxy settings, rather than Firefox's, even when running from within Firefox.

七色彩虹 2024-09-09 09:05:35

RTMP 建立在 TCP 之上,因此您应该能够选择 TCP 和相应的端口来使用防火墙进行测试。

您需要为每个端口创建一个自定义规则。

name: RTMP Default (1935)
protocol: TCP
local port: any
remote port: 1935
local ip: any
remote ip: any

name: RTMP over 443
protocol: TCP
local port: any
remote port: 443
local ip: any
remote ip: any

name: RTMP over 80
protocol: TCP
local port: any
remote port: 80
local ip: any
remote ip: any

然后将 RTMP 默认规则设置为阻止所有流量,但将其他流量设置为允许。然后测试并确保故障转移到端口 443。然后将 RTMP over 443 规则设置为阻止,并确保故障转移到端口 80。

RTMP is built on top of TCP, so you should be able to pick TCP and the corresponding port to use your firewall to test.

You'll want to create one custom rule for each port.

name: RTMP Default (1935)
protocol: TCP
local port: any
remote port: 1935
local ip: any
remote ip: any

name: RTMP over 443
protocol: TCP
local port: any
remote port: 443
local ip: any
remote ip: any

name: RTMP over 80
protocol: TCP
local port: any
remote port: 80
local ip: any
remote ip: any

Then set the RTMP Default rule to block all traffic, but set the others to allow. Then test and ensure it fails over to port 443. Then set the RTMP over 443 rule to block, and ensure it fails over to port 80.

雨后咖啡店 2024-09-09 09:05:35

您必须使用 HTTP 代理服务器中介,它将针对无效请求抛出 HTTP 错误。我不确定 RTMP 协议是如何做到这一点的,但我怀疑您声称它在端口 80 上尝试 RTMP,然后在同一端口上回退到 RTMPT 的说法可能是错误的。这真的没有多大意义。但是 - 如果确实是这种情况,我个人认为这种情况极不可能,而且我个人永远不会设计一个协议在同一端口上使用两种不同的格式,那么您将需要一个中介,例如 HTTP 代理服务器,它是我能看到这种情况在实践中发生的唯一现实的方式。

You will have to use an HTTP proxy server intermediary which will throw an HTTP error for invalid requests. I'm not sure how the RTMP protocol does this, but I suspect you may be erroneous in claiming that it tries RTMP over port 80 and then falls back to RTMPT on the same port. That really wouldn't make a whole lot of sense. BUT - IF this is actually the case, which personally I find highly unlikely and I personally would never design a protocol to use two different formats on the same port, THEN you would need to have an intermediary such as an HTTP proxy server which is the only realistic way I could see this happening in practice.

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