TCP:如何生成seq / ack数字? [英] TCP: How are the seq / ack numbers generated?

查看:1171
本文介绍了TCP:如何生成seq / ack数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究一个程序,它嗅探发送和接收到和从特定地址的TCP数据包。我想要完成的是使用定制的定制数据包来回复某些接收的数据包。我已经完成了解析。我已经可以生成有效的以太网,IP和大多数TCP数据包。

I am currently working on a program which sniffs TCP packets being sent and received to and from a particular address. What I am trying to accomplish is replying with custom tailored packets to certain received packets. I've already got the parsing done. I can already generated valid Ethernet, IP, and--for the most part--TCP packets.

我唯一不能弄清楚的是seq / ack

The only thing that I cannot figure out is how the seq / ack numbers are determined.

虽然这可能与问题无关,但程序是使用WinPCap在C ++中编写的。

While this may be irrelevant to the problem, the program is written in C++ using WinPCap. I am asking for any tips, articles, or other resources that may help me.

推荐答案

当TCP连接建立时,每个侧生成随机数作为其初始序列号。这是一个很强的随机数:如果互联网上的任何人猜测序列号,就会出现安全问题,因为它们可以轻易地伪造数据包到TCP流中。

When a TCP connection is established, each side generates a random number as its initial sequence number. It is a strongly random number: there are security problems if anybody on the internet can guess the sequence number, as they can easily forge packets to inject into the TCP stream.

此后,对于发送的每个字节,序列号将增加1. ACK字段是来自另一侧的序列号,发送回应答接收。

Thereafter, for every byte transmitted the sequence number will increment by 1. The ACK field is the sequence number from the other side, sent back to acknowledge reception.

RFC 793原来的TCP协议规范)将是很大的帮助。

RFC 793 (the original TCP protocol specification) would be of great help.

这篇关于TCP:如何生成seq / ack数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆