Get the App
SLTechnology News&Howtos  ›  Development  › 

How vbs invokes external objects and type libraries

Shulou Source: shulou.com Published: 2022-06-03 06:06:11 10月19日 Update

This article will explain in detail how vbs invokes external objects and type libraries. The editor finds it very practical, so I share it with you as a reference. I hope you can get something after reading this article.

For example, the most recent flash network horse call:

Var Flashver = (new ActiveXObject ("ShockwaveFlash.ShockwaveFlash.9")) .GetVariable ("$version") .split (",")

Where does this ShockwaveFlash.ShockwaveFlash.9 come from? open flash9f.ocx with exescope and select typelib, and you can see the function of the ShockwaveFlash.ShockwaveFlash.9 object, including GetVariable. This leads to another problem. How do you know if you want to open flash9f.ocx? If it's just for this, you can look it up using IE's component manager.

So can we call other components like mstsc.exe,3389 connectors? The registry looks for mstsc.exe, and the HKEY_CLASSES_ROOT\ CLSID\ {3523c2fb-4031-44e4-9a3b-f1e94986ee7f}\ InprocServer32 found is C:\ WINDOWS\ system32\ mstscax.dll, and then you can see the functions, properties, methods, and so on, of this component by opening it with exescope. Can be a simple example (md, but can change all aspects of the mstsc.exe attribute value, has been unable to open the connection interface, who will change? ):

Sub ExecuteConnection (strServer, strUser, strPW)

'create the client

Dim objMsRdpClient

Set objMsRdpClient = CreateObject ("MsTscAx.MsTscAx.3")

ObjMsRdpClient.Server = strServer

ObjMsRdpClient.UserName = strUser

ObjMsRdpClient.FullScreen = false

ObjMsRdpClient.AdvancedSettings2.RedirectDrives = False

ObjMsRdpClient.AdvancedSettings2.RedirectPrinters = False

ObjMsRdpClient.AdvancedSettings2.RedirectPorts = False

ObjMsRdpClient.AdvancedSettings2.RedirectSmartCards = False

ObjMsRdpClient.AdvancedSettings2.ClearTextPassword = strPW

ObjMsRdpClient.StartConnected = True

WScript.echo "Before connecting"

Wscript.echo objMsRdpClient.version

Dim intResult

IntResult = objMsRdpClient.Connect

WScript.echo "After connecting Result:" & intResult

End Sub

To invoke the component, you can not only use HKEY_CLASSES_ROOT\ CLSID\ {3523c2fb-4031-44e4-9a3b-f1e94986ee7f}\ ProgID found in the registry (the above example is CreateObject ("MsTscAx.MsTscAx.3")

), you can also use HKEY_CLASSES_ROOT\ CLSID, which is why we can also use classid in the asp Trojan horse, such as in the Haiyang top 2006 + source code:

Of course, other network horses, the basic call is CLSID, you can find some network horses to see.

However, it seems that you can't call classid directly in vbs, just put it in the wsf file, and it doesn't matter if it's html or something like that.

This is the end of the article on "how vbs invokes external objects and type libraries". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Components articles types examples functions just that is properties more registry not bad practical but not it doesn't matter above that is content files articles methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker Microsoft Redmi MariaDB