Pro.WScript
— API for parsing Windows Script files¶
Overview¶
The Pro.WScript
module contains the API for parsing Windows Script files such as VBS, VBE, JS and JSE.
Decoding a Windows Script file¶
Windows Script files can be encoded (VBE and JSE). The following code example demonstrates how to decode them:
from Pro.Core import *
from Pro.WScript import *
def decodeWScript(fname):
c = createContainerFromFile(fname)
if c.isNull():
return NTContainer()
obj = WScriptObject()
if not obj.Load(c):
return NTContainer()
if not obj.IsEncoded():
print("warning: the object is not encoded!")
return c
return obj.GetDecoded()
Module API¶
Pro.WScript module API.
Classes:
This class represents a Windows Script file.
- class WScriptObject¶
Bases:
Pro.Core.CFFObject
This class represents a Windows Script file.
Methods:
Decode
()Decodes the Windows Script in place.
Decodes the Windows Script data.
Returns
True
if the script is encoded; otherwise returnsFalse
.Returns
True
if the script was encoded before callingDecode()
; otherwise returnsFalse
.
- Decode() → bool¶
Decodes the Windows Script in place.
Hint
This method internally calls
GetDecoded()
followed byPro.Core.CFFObject.ReplaceStream()
.
- Returns
Returns
True
if successful; otherwise returnsFalse
.- Return type
bool
See also
IsEncoded()
andGetDecoded()
.
- GetDecoded() → Pro.Core.NTContainer¶
Decodes the Windows Script data.
- Returns
Returns the decoded data if successful; otherwise returns an invalid
Pro.Core.NTContainer
instance.- Return type
See also
IsEncoded()
andDecode()
.
- IsEncoded() → bool¶
- Returns
Returns
True
if the script is encoded; otherwise returnsFalse
.- Return type
bool
See also
GetDecoded()
andDecode()
.
- WasEncoded() → bool¶
- Returns
Returns
True
if the script was encoded before callingDecode()
; otherwise returnsFalse
.- Return type
bool
See also
IsEncoded()
andDecode()
.