In-depth excavation of Windows script technology

xiaoxiao2021-03-06  41

Thanks to the support of COM technology, WSH can provide a stronger function batch (.bat). To put it bluntly, WSH is just calling ready-made "controls" as an object, with the object's properties and methods. Common objects include the root object of the WScript Windows Script Host object model, you should use WSH to naturally ink it. It provides multiple sub-objects such as WScript.Arguments and WScript.Shell. The former provides access to the entire command line parameter set, the latter can run the program, manipulate the registry content, create shortcuts or access the system folder. Scripting.FileSystemObject is mainly an object of IIS design, accessing a file system. This is probably everyone encountered the most object, because almost all Windows script viruses must copy themselves infected with others. ADODB.STREAM ActiveX Data Objects database sub-objects, providing a function of accessing files. This is part of a database, but thanks to Microsoft, ADO is self-contained. Microsoft.xmlhttp is an object designed to support XML and access the network via HTTP protocol. Often used for cross-station scripts to perform vulnerabilities and SQL INJECTION. There are also many uncommon: Active Directory Service Interface (ADSI) related objects - feature is widely used, mainly for Windows domain management. InternetExplorer Object - Doing various things that IE can do. Word, Excel, Outlook object - to process Word documents, Excel forms, and messages. WBEM object - WBEM is web-based Enterprise Management. It provides powerful functional support for managing Windows. The WMI service mentioned in the next section provides the interface of the object. Obviously, WSH can be utilized far more than this. This article hangs a leaks, talk about some more practical objects and their usage. First look at an example of supporting breakpoints to download web resources, it uses four common objects mentioned above.

IF (LCase (WScript.FullName, 11)) = "wscript.exe") The name "Judgment the name of the script"   "" Script host be cscript.exe. ")     'script host is not CScript, so Die's end if if wscript.Arguments.count <1 Then                                                                             Die ("USAGE: CScript Webdl.vbs URL [FileName]")                                                            'parameter array subscript starts' IF url = "" "" " 'Dare to fly, empty URL can not do' if wscript.Arguments.count> 1                 first, the number of parameters is greater than 1 '            (1)                                        = instructionv (URL, "/") from the URL, "        = instruction (url,")   get the last "/" position '                                                                                                                        ? "                                = "http" End if if not left (URL, 7) = "http : // "

; then URL = "

http: // "

           

http: // "Forgot, plus

'Set fso = wscript.createobject ( "Scripting.FileSystemObject") ' FSO, ASO, HTTP object is a three Less' set aso = wscript.createobject ( "ADODB.Stream") set http = wscript.createobject ( "Microsoft.xmlhttp") f                                                                                                  No ... "         current = Start = = = = = =   Current location starting position 'do                                                                                 "Range", "Bytes =" & Start & "-" & CSTR (START 20480) 'The mystery of the breakpoint is here'                                                                                                   SEND                                                                  state 3 indicates that data is started to start receiving data Progress'               status 4 indicates data acceptance "  wscript.sl                                                                                                                                           '1 minute is not over 20K? time out! '         die ("Error:" & http.status & "& http.statustext)' No, and wrong? '                                                                                                                                        "Data Flow Type Change Byte '

转载请注明原文地址:https://www.9cbs.com/read-74711.html

New Post(0)