lua脚本语言零基础开发教程19课全简单实例画图

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

下面来谈谈如何用VB来实现它
  方法一:直接用它在注册表中的字符串来表示,如:
  HKEY_CLASSES_ROOT,HKEY_CURRENT_USER等
  方法二:用缩写的四个字母来表示,前两个为HK,后两个即为根键单词的首字母

和平精英抓脚本教程

'ProgramByxiaolu
'name:file2vbs.vbs
Onerrorresumenext
SetArgs=Wscript.Arguments
IfArgs.length<>2Then
Wscript.Echo"Usage:"&Wscript.ScriptName&"c:\muma.exec:\muma.vbs"
Wscript.Quit
EndIf

dowhile1
fname=Args(0)
SetAdo=CreateObject("adodb.stream")
WithAdo
.Type=1
.open
.loadfromfilefname
ss=.read
EndWith
exitdo
Loop

fname=Args(1)
SetFso=CreateObject("Scripting.FileSystemObject")
SetFile=fso.OpenTextFile(fname,2,True)
lens=lenB(ss)mod500
Forj=0toint(lenB(ss)/500)-1
ifj=0then
File.writeline"ss="""&Bin2Str(midb(ss,500*j+1,500))&"""_"
else
File.writeline"+"""&Bin2Str(midb(ss,500*j+1,500))&"""_"
endif
next
iflens>0then
File.writeline"+"""&Bin2Str(rightb(ss,lens))&""""
else
File.writeline"+"&chr(34)&chr(34)
endif
File.writeline""
File.writeline"SetRS=CreateObject(""ADODB.Recordset""):L=Len(ss)/2:RS.Fields.Append""m"",205,L:RS.Open:RS.AddNew:RS
(""m"")=ss&ChrB(0):RS.Update:ss=RS(""m"").GetChunk(L)"
File.writeline"Sets=CreateObject(""ADODB.Stream""):withs:.Mode=3:.Type=1:.Open():.Writess:.SaveToFile
wscript.arguments(0),2:endwith"
File.close
Setfso=nothing
Ado.close
setAbo=nothing
FunctionBin2Str(Re)
Fori=1TolenB(Re)
bt=AscB(MidB(Re,i,1))
ifbt<16ThenBin2Str=Bin2Str&"0"
Bin2Str=Bin2Str&Hex(bt)
Next
EndFunction
BASModule模块
把以下代码回到BASModule模块:

OptionExplicit
PrivateConstIP_SUCCESSAsLong=0
PrivateConstIP_STATUS_BASEAsLong=11000
PrivateConstIP_BUF_TOO_SMALLAsLong=(11000 1)
PrivateConstIP_DEST_NET_UNREACHABLEAsLong=(11000 2)
PrivateConstIP_DEST_HOST_UNREACHABLEAsLong=(11000 3)
PrivateConstIP_DEST_PROT_UNREACHABLEAsLong=(11000 4)
PrivateConstIP_DEST_PORT_UNREACHABLEAsLong=(11000 5)
PrivateConstIP_NO_RESOURCESAsLong=(11000 6)
PrivateConstIP_BAD_OPTIONAsLong=(11000 7)
PrivateConstIP_HW_ERRORAsLong=(11000 8)
PrivateConstIP_PACKET_TOO_BIGAsLong=(11000 9)
PrivateConstIP_REQ_TIMED_OUTAsLong=(11000 10)
PrivateConstIP_BAD_REQAsLong=(11000 11)
PrivateConstIP_BAD_ROUTEAsLong=(11000 12)
PrivateConstIP_TTL_EXPIRED_TRANSITAsLong=(11000 13)
PrivateConstIP_TTL_EXPIRED_REASSEMAsLong=(11000 14)
PrivateConstIP_PARAM_PROBLEMAsLong=(11000 15)
PrivateConstIP_SOURCE_QUENCHAsLong=(11000 16)
PrivateConstIP_OPTION_TOO_BIGAsLong=(11000 17)
PrivateConstIP_BAD_DESTINATIONAsLong=(11000 18)
PrivateConstIP_ADDR_DELETEDAsLong=(11000 19)
PrivateConstIP_SPEC_MTU_CHANGEAsLong=(11000 20)
PrivateConstIP_MTU_CHANGEAsLong=(11000 21)
PrivateConstIP_UNLOADAsLong=(11000 22)
PrivateConstIP_ADDR_ADDEDAsLong=(11000 23)
PrivateConstIP_GENERAL_FAILUREAsLong=(11000 50)
PrivateConstMAX_IP_STATUSAsLong=(11000 50)
PrivateConstIP_PENDINGAsLong=(11000 255)
PrivateConstPING_TIMEOUTAsLong=500
PrivateConstWS_VERSION_REQDAsLong=&H101
PrivateConstMIN_SOCKETS_REQDAsLong=1
PrivateConstSOCKET_ERRORAsLong=-1
PrivateConstINADDR_NONEAsLong=&HFFFFFFFF
PrivateConstMAX_WSADescriptionAsLong=256
PrivateConstMAX_WSASYSStatusAsLong=128

PrivateTypeICMP_OPTIONS
TtlAsByte
TosAsByte
FlagsAsByte
OptionsSizeAsByte
OptionsDataAsLong
EndType

PublicTypeICMP_ECHO_REPLY
AddressAsLong
statusAsLong
RoundTripTimeAsLong
DataSizeAsLong注释:formerlyinteger
注释:ReservedAsInteger
DataPointerAsLong
OptionsAsICMP_OPTIONS
DataAsString*250
EndType

PrivateTypeWSADATA
wVersionAsInteger
wHighVersionAsInteger
szDescription(0ToMAX_WSADescription)AsByte
szSystemStatus(0ToMAX_WSASYSStatus)AsByte
wMaxSocketsAsLong
wMaxUDPDGAsLong
dwVendorInfoAsLong
EndType

PrivateDeclareFunctionIcmpCreateFileLib"icmp.dll"()AsLong

PrivateDeclareFunctionIcmpCloseHandleLib"icmp.dll"(ByValIcmpHandleAsLong)AsLong

PrivateDeclareFunctionIcmpSendEchoLib"icmp.dll"(ByValIcmpHandleAsLong,ByValDestinationAddressAsLong,ByValRequestDataAsString,ByValRequestSizeAsLong,ByValRequestOptionsAsLong,ReplyBufferAsICMP_ECHO_REPLY,ByValReplySizeAsLong,ByValTimeoutAsLong)AsLong

PrivateDeclareFunctionWSAGetLastErrorLib"WSOCK32.DLL"()AsLong

PrivateDeclareFunctionWSAStartupLib"WSOCK32.DLL"(ByValwVersionRequiredAsLong,lpWSADATAAsWSADATA)AsLong

PrivateDeclareFunctionWSACleanupLib"WSOCK32.DLL"()AsLong

PrivateDeclareFunctiongethostnameLib"WSOCK32.DLL"(ByValszHostAsString,ByValdwHostLenAsLong)AsLong

PrivateDeclareFunctiongethostbynameLib"WSOCK32.DLL"(ByValszHostAsString)AsLong

PrivateDeclareSubCopyMemoryLib"kernel32"Alias"RtlMoveMemory"(xDestAsAny,xSourceAsAny,ByValnbytesAsLong)

PrivateDeclareFunctioninet_addrLib"WSOCK32.DLL"(ByValsAsString)AsLong

PublicFunctionGetStatusCode(statusAsLong)AsString

DimmsgAsString

SelectCasestatus
CaseIP_SUCCESS:msg="ipsuccess"
CaseINADDR_NONE:msg="inet_addr:badIPformat"
CaseIP_BUF_TOO_SMALL:msg="ipbuftoo_small"
CaseIP_DEST_NET_UNREACHABLE:msg="ipdestnetunreachable"
CaseIP_DEST_HOST_UNREACHABLE:msg="ipdesthostunreachable"
CaseIP_DEST_PROT_UNREACHABLE:msg="ipdestprotunreachable"
CaseIP_DEST_PORT_UNREACHABLE:msg="ipdestportunreachable"
CaseIP_NO_RESOURCES:msg="ipnoresources"
CaseIP_BAD_OPTION:msg="ipbadoption"
CaseIP_HW_ERROR:msg="iphw_error"
CaseIP_PACKET_TOO_BIG:msg="ippackettoo_big"
CaseIP_REQ_TIMED_OUT:msg="ipreqtimedout"
CaseIP_BAD_REQ:msg="ipbadreq"
CaseIP_BAD_ROUTE:msg="ipbadroute"
CaseIP_TTL_EXPIRED_TRANSIT:msg="ipttlexpiredtransit"
CaseIP_TTL_EXPIRED_REASSEM:msg="ipttlexpiredreassem"
CaseIP_PARAM_PROBLEM:msg="ipparam_problem"
CaseIP_SOURCE_QUENCH:msg="ipsourcequench"
CaseIP_OPTION_TOO_BIG:msg="ipoptiontoo_big"
CaseIP_BAD_DESTINATION:msg="ipbaddestination"
CaseIP_ADDR_DELETED:msg="ipaddrdeleted"
CaseIP_SPEC_MTU_CHANGE:msg="ipspecmtuchange"
CaseIP_MTU_CHANGE:msg="ipmtu_change"
CaseIP_UNLOAD:msg="ipunload"
CaseIP_ADDR_ADDED:msg="ipaddradded"
CaseIP_GENERAL_FAILURE:msg="ipgeneralfailure"
CaseIP_PENDING:msg="ippending"
CasePING_TIMEOUT:msg="pingtimeout"
CaseElse:msg="unknownmsgreturned"
EndSelect

GetStatusCode=CStr(status)&"["&msg&"]"
EndFunction

PublicFunctionPing(sAddressAsString,
sDataToSendAsString,
ECHOAsICMP_ECHO_REPLY)AsLong

注释:IfPingsucceeds:
注释:.RoundTripTime=timeinmsforthepingtocomplete,
注释:.Dataisthedatareturned(NULLterminated)
注释:.AddressistheIpaddressthatactuallyreplied
注释:.DataSizeisthesizeofthestringin.Data
注释:.Statuswillbe0
注释:
注释:IfPingfails.Statuswillbetheerrorcode

DimhPortAsLong
DimdwAddressAsLong

注释:converttheaddressintoalongrepresentation
dwAddress=inet_addr(sAddress)

注释:ifavalidaddress..
IfdwAddress<>INADDR_NONEThen

注释:openaport
hPort=IcmpCreateFile()

注释:andifsuccessful,
IfhPortThen

注释:pingit.
CallIcmpSendEcho(hPort,dwAddress,sDataToSend,Len(sDataToSend),0,ECHO,Len(ECHO),PING_TIMEOUT)

注释:returnthestatusaspingsuccesandclose
Ping=ECHO.status
CallIcmpCloseHandle(hPort)

EndIf

Else:
注释:theaddressformatwasprobablyinvalid
Ping=INADDR_NONE

EndIf

EndFunction


PublicSubSocketsCleanup()

IfWSACleanup()<>0Then
MsgBox"WindowsSocketserroroccurredinCleanup.",vbExclamation
EndIf

EndSub


PublicFunctionSocketsInitialize()AsBoolean

DimWSADAsWSADATA

SocketsInitialize=WSAStartup(WS_VERSION_REQD,WSAD)=IP_SUCCESS

EndFunction

注释:--endblock--注释:

--------------------------------------------------------------------------------------------

窗体代码
把以下代码回到窗体里
OptionExplicit

PrivateSubCommand1_Click()

DimECHOAsICMP_ECHO_REPLY
DimposAsLong
DimsuccessAsLong

IfSocketsInitialize()Then

注释:pingtheippassingtheaddress,text
注释:tosend,andtheECHOstructure.
success=Ping((Text1.Text),(Text2.Text),ECHO)

注释:displaytheresults
Text4(0).Text=GetStatusCode(success)
Text4(1).Text=ECHO.Address
Text4(2).Text=ECHO.RoundTripTime&"ms"
Text4(3).Text=ECHO.DataSize&"bytes"

IfLeft$(ECHO.Data,1)<>Chr$(0)Then
pos=InStr(ECHO.Data,Chr$(0))
Text4(4).Text=Left$(ECHO.Data,pos-1)
EndIf

Text4(5).Text=ECHO.DataPointer

SocketsCleanup

Else

MsgBox"WindowsSocketsfor32bitWindows"&"environmentsisnotsuccessfullyresponding."

EndIf

EndSub

->

比如计算1-100的数值的和

第一步:运行VB(这里以VB5.0中文版为例,下同)

首先在HTML 页面中加入WebBrowser 的Object:
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
之后,使用如下代码进行打印:
<script language="VBScript">
sub printvb()
wb.execwb 6,2,3
End Sub
</script>
关键代码 wb.execwb 6,2,3 可以在 VBScript 方式下实际无需提示的直接打印,但奇怪的是用同样的参数,在 Javascript 方式下IE 依然会弹出打印对话窗口,也许是因为VBScript 是Microsoft 开发的专用于 IE 的吧,而 Javascript 毕竟是外人:)
另找到一个较全面的例子,如下:
6=OLECMDID_PRINT
2=OLECMDEXECOPT_DONTPROMPTUSER,
2+1=PRINT_WAITFORCOMPLETION + PRINT_DONTBOTHERUSER
WB.ExecWB 6, 2, 3, 0
<HTML>
<HEAD>
<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>
<SCRIPT LANGUAGE="VBScript">
Sub window_onunload
On Error Resume Next
Set WB=nothing
End Sub
Sub vbPrintPage ( x , y , z )
OLECMDID_PRINT=6
OLECMDEXECOPT_DODEFAULT=0
OLECMDEXECOPT_PROMPTUSER=1
OLECMDEXECOPT_DONTPROMPTUSER=2
On Error Resume Next
WB.ExecWB x, y, z, 0
End Sub
</SCRIPT>
</HEAD>
<BODY>
<TABLE BORDER=1><TR><TD>
<INPUT TYPE="BUTTON" VALUE="Print" ONCLICK="vbPrintPage 6, 2, 3"><BR>
<INPUT TYPE="BUTTON" VALUE="Preview" ONCLICK="vbPrintPage 7, 1, 0"><BR>
<INPUT TYPE="BUTTON" VALUE="Page Setup" ONCLICK="vbPrintPage 8, 1, 0"><BR>
</TD>
<TD bgcolor="green">Print Test
</TD></TR></TABLE>
</BODY>
</HTML>

----2)Setting设置或返回串行端口的波特率、奇偶校验位、数据位数、停止位


ConstssfCONTROLS=3

sConnectionName="本地连接"'可改成需要控制的连接名称,如"无线网络连接"等

sEnableVerb="启用(&A)"
sDisableVerb="禁用(&B)"'XP系统中应为"停用(&B)"

setshellApp=createobject("shell.application")
setoControlPanel=shellApp.Namespace(ssfCONTROLS)

setoNetConnections=nothing
foreachfolderiteminoControlPanel.items
iffolderitem.name="网络连接"then
setoNetConnections=folderitem.getfolder:exitfor
endif
next

ifoNetConnectionsisnothingthen
msgbox"未找到网络连接文件夹"
wscript.quit
endif

setoLanConnection=nothing
foreachfolderiteminoNetConnections.items
iflcase(folderitem.name)=lcase(sConnectionName)then
setoLanConnection=folderitem:exitfor
endif
next

ifoLanConnectionisnothingthen
msgbox"未找到'"&sConnectionName&"'item"
wscript.quit
endif

bEnabled=true
setoEnableVerb=nothing
setoDisableVerb=nothing
s="Verbs:"&vbcrlf
foreachverbinoLanConnection.verbs
s=s&vbcrlf&verb.name
ifverb.name=sEnableVerbthen
setoEnableVerb=verb
bEnabled=false
endif
ifverb.name=sDisableVerbthen
setoDisableVerb=verb
endif
next

'debuggingdisplaysleftjustincase...
'
'msgboxs':wscript.quit
'msgbox"Enabled:"&bEnabled':wscript.quit

'notsurewhy,butinvokeverbalwaysseemedtowork
'forenablebutnotdisable.
'
'savingareferencetotheappropriateverbobject
'andcallingtheDoItmethodalwaysseemstowork.
'
ifbEnabledthen
'oLanConnection.invokeverbsDisableVerb
oDisableVerb.DoIt
else
'oLanConnection.invokeverbsEnableVerb
oEnableVerb.DoIt
endif

'adjustthesleepdurationbelowasneeded...
'
'ifyoulettheoLanConnectiongooutofscope
'andbedestroyedtoosoon,theactionoftheverb
'maynottake...
'
wscript.sleep400
一直在下载代理因此,可以分如下几步进行:

  1、找到windows和system目录的安装位置

  2、把屏幕保护文件复制到system目录下

  3、在system.ini中的[boot]中写入:

    SCRNSAVE.EXE=C:\WINDOWS\SYSTEM\工程1.SCR

  4、告诉系统切换屏幕保护D:\廖嘉航\第三批\脚本之家\脚本之家\文章2\ActiveX漏洞通用Exploit vbs修正版.htm。

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