TCP连接劫持

发布于 2024-11-03 01:53:47 字数 750 浏览 1 评论 0原文

我有一个一直在 C++ 中开发的小项目,由于它的性质,我需要将数据包插入到实时 TCP 流中。 (目的很无辜,http://ee.forumify.com/viewtopic.php? id=3299 如果你必须知道) 我正在为游戏创建一个关卡编辑器,由于握手的性质,我无法简单地与 WinSock 等高级库建立新连接。到目前为止,它一直依赖 Winsock Packet Editor 来完成这些肮脏的工作,但如果我让应用程序处理这一切,那就会让每个人都高兴。

所以我的问题是:是否有一个 API 可以让我控制实时 TCP 流,并且最好是在完成后保持其有效?我宁愿不必注入任何 DLL。另外,Detours 是一个禁忌,因为我使用的是 GCC/Mingw。

我已经尝试过 WinPCap 并且我有一些工作代码(我可以收集一个数据包,并从中生成一个要发送的正确数据包),但由于它在如此低的级别上运行,我无法预料到所有潜在的协议最终用户可能会使用。是的,他们很可能会使用以太网上的 IPv4,但是那些仍然使用 PPP 或其他一些不起眼协议的人呢?此外,在我的连接完成后,客户端应用程序会断开连接,因为数据包中的最新 ID 值已更改,并且客户端假定它已断开连接。

因此,如果有人能够提供高级 TCP 流操纵器,我将非常高兴。如果没有,我将继续修补 WinPCap 并告诉所有拨号用户去获得更好的互联网。

目标平台:Microsoft Windows XP 到 Windows 7

I have a small project that I've been working on in C++, and due to the nature of what it does, I need to insert packets in to a live TCP stream. (The purpose is innocent enough, http://ee.forumify.com/viewtopic.php?id=3299 if you MUST know)
I'm creating a level editor for a game, and due to the nature of the handshakes, I can't simply establish a new connection with a high level library such as WinSock. Until now, it has relied on Winsock Packet Editor to do the dirty work, but if I were to let the application handle it all, it would make everyone happy.

So my question is this: Is there an API somewhere that will allow me to take control of a live TCP stream, and preferably one that keeps it valid after it finishes? And I would prefer to not have to inject any DLLs. Also, Detours is a no-no as I'm using GCC/Mingw.

I've toyed around with WinPCap and I have some working code (I can collect a packet, and from that generate a proper packet to send) but since it operates at such a low level, I cannot anticipate all of the potential protocols that the end user might use. Yes, chances are that they'll be using IPv4 over Ethernet, but what about those people who still use PPP, or some other obscure protocol? Also, the connection gets dropped by the client application after mine is done with it, as the latest ID values in the packets have changed and the client assumes that it has disconnected.

So, if anyone could provide a high-level TCP stream manipulator, I would be very happy. If not, I'll just continue tinkering with WinPCap and tell all the dial-up users to go get better internet.

Target platform: Microsoft Windows XP through Windows 7

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

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

发布评论

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

评论(3

穿透光 2024-11-10 01:53:47

创建一个单独的进程来绑定到本地端口。创建初始 tcp 流后,通过该进程代理它,然后该进程可以将其转发到网络。当您需要“注入”到流中时,您可以让这个代理进程来完成它。只是一个想法。

Create a separate process to bind to a local port. When the initial tcp stream is created, proxy it through that process, which can then forward it on to the network. When you need to 'inject' into the stream you can have this proxy process do it. Just a thought.

还如梦归 2024-11-10 01:53:47

你应该看看ettercap的源代码 http://ettercap.sourceforge.net/
或狩猎,tcp 劫持者 http://packetstormsecurity.org/files/view/21967/ Hunt-1.5.tgz

这两个软件可以满足您的需求。

you should look at the source code of ettercap http://ettercap.sourceforge.net/
or hunt, tcp hijacker http://packetstormsecurity.org/files/view/21967/hunt-1.5.tgz

Those 2 softs do what you're after.

对你再特殊 2024-11-10 01:53:47

我不认为有任何明智的 API 可以让你劫持 TCP 流。这样的事情本质上是一个安全问题。

您可以插入您的程序作为相关连接的代理吗?也就是说,让打开连接的程序将其打开到您的程序,然后让您的程序打开到真实目标的连接。

这个想法是,如果所有数据包都通过您的程序,那么修改 TCP 流就变得相对简单。

I don't think there's any sensible API that will allow you to hijack a TCP stream. Such a thing would, inherently, be a security problem.

Can you insert your program as a proxy for the connection in question? That is, get the program that opens the connection to open it to your program, then have your program open the connection to the real target.

The idea is that if all the packets pass through your program anyway, then modifying the TCP stream becomes relatively trivial.

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