|
![]() | 作者: 286 [unique]
![]() |
登录 |
如题,交流一下如何? 我现在遇到的问题是:我截到一个TCP包,对其数值进行重新校验,新校验值与原值不一样。(校验算法没有错) ipHeader=(struct ip_hdr *)(SendBuf+1000); tcpHeader=(struct tcp_hdr *)(SendBuf+IpHeadLen+1000); psdHeader=(struct psd_hdr *)(SendBuf+IpHeadLen+TcpHeadLen+1000); memcpy(ipHeader,Buf,IpHeadLen+TcpHeadLen); ipHeader->checksum=0; tcpHeader->th_sum=0; psdHeader->saddr=ipHeader->sourceIP; psdHeader->daddr=ipHeader->destIP; psdHeader->mbz=0; psdHeader->ptcl=ipHeader->proto; psdHeader->tcpl=htons(TcpHeadLen); memcpy(SendBuf,psdHeader,PsdHeadLen); memcpy(SendBuf+PsdHeadLen,tcpHeader,TcpHeadLen); tcpHeader->th_sum=CheckSum((USHORT *)SendBuf,PsdHeadLen+TcpHeadLen); memcpy(SendBuf,ipHeader,IpHeadLen+TcpHeadLen); ipHeader->checksum=CheckSum((USHORT *)SendBuf,IpHeadLen+TcpHeadLen); memcpy(Buf,SendBuf+1000,IpHeadLen+TcpHeadLen); |
地主 发表时间: 03/27 17:33 |
![]() | 回复: ricky [ricky] ![]() |
登录 |
我倒是做过,不过没有考虑这个问题 |
B1层 发表时间: 03/28 09:10 |
![]() | 回复: genius_li [genius_li] ![]() |
登录 |
谁能告诉我这是用什么语言编写的,我知道是C不过的TC还是VC或是BC????? |
B2层 发表时间: 03/28 22:29 |
![]() | 回复: 286 [unique] ![]() |
登录 |
从 USHORT 这一点上应该能看出来是用VC编的吧?兄弟。 |
B3层 发表时间: 03/29 10:46 |
![]() | 回复: wineggdrop [wineggdrop] ![]() |
登录 |
lcc,devc都支持USHORT这种写法的,USHORT只是unsigned short 的缩写。 上面的代码是有问题的,至于有什么问题,那就自己一条条 语句去研究一下吧,构造这类假IP,一般都是用来做坏事的吧。 只是对TCP数据包转发的话,不需要用到上面的代码。 [此贴被 wineggdrop(wineggdrop) 在 03月29日15时00分 编辑过] |
B4层 发表时间: 03/29 15:10 |
![]() | 回复: 286 [unique] ![]() |
登录 |
KAO,难以想象你的IP转发是怎么作的,我现在是要把接到的所有包接到后,修改目的IP再转发出去,有什么不对?我又没说只构造TCP包。 |
B5层 发表时间: 03/29 15:24 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号