Pro.Core — Core API for parsing and scanning files

Overview

The Pro.Core module contains the core API for parsing and scanning files.

Core Concepts

Some of the most important classes are:

  • NTContainer - This is a generic container used to encapsulate data such as files and memory. It’s an extremely important class and it’s used extensively. Containers can be created through SDK functions such as createContainerFromFile() and newContainer().

  • NTBuffer/NTContainerBuffer/CFFBuffer/etc. - These type of classes are used to efficiently read iteratively small amounts of data from a source. NTBuffer is the base class and derived classes are named after the object they read from. E.g.: NTContainerBuffer reads from NTContainer and CFFBuffer reads from CFFObject.

  • NTTextStream/NTTextBuffer/NTTextStringBuffer - These classes are used to output text. The amount of indentation can be specified. NTTextStream is the base class and derived classes are named after the output type: NTTextBuffer outputs to a utf-8 array and NTTextStringBuffer to a utf-16 array.

  • NTXml - Used to parse XML. This class is fast and secure. The code is based on RapidXML.

  • CFFObject - The class from which every format class is derived (ZipObject, PEObject, etc.). While NTContainer provides basic parsing facilities, more complex types and the use of CFFStruct rely upon CFFObject.

  • CFFHeader - Headers contain definition of structures and can be loaded from SQLite files or XML strings. The structures can be imported from C/C++ code through the Header Manager or from debug symbols such as PDB files.

  • CFFStruct - This class represents a data structure.

  • CFFFlags - This class represents the flags of a field in a CFFStruct.

Hint

If you’re wondering why the case convention for methods is not always the same, the reason is simple. Classes such as CFFObject and CFFStruct are based on older code which followed the pascal-case convention. Consequently all derived classes like PEObject follow this convention. All other classes use the camel-case convention.

Basic types like integers and strings are automatically converted between C++ and Python. However, lists are preserved for efficiency reasons. Whenever the signature of a method contains a list or another type of container class, you must work with the C++ class. For example, the following example creates a list of C++ integers and iterates through it:

from Pro.Core import *

l = NTIntList()
for i in range(10):
    l.append(i)
it = NTIntListIt(l)
while it.hasNext():
    print(it.next())

Lists, vectors, hashes and sets all have specialized C++ classes usually relying on Qt containers. These type of classes are easily recognized due to the naming convention.

Note

While in C++ these classes are implemented as template classes, in Python they are exposed as different types. However, NTIntList will have exactly the same methods as NTStringList.

Parsing Files

Printing out a structure in a file can be as simple as:

from Pro.Core import *
from Pro.PE import *

def printDOSHeader(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    pe = PEObject()
    if not pe.Load(c):
        return
    out = NTTextBuffer()
    pe.DosHeader().Dump(out) # CFFStruct.Dump
    print(out.buffer)

Warning

Avoid initializing NTContainer and CFFObject objects globally in order to avoid memory leaks!

If you really need to use a global object, make sure to set it to None when it is no longer needed. This way, the garbage collector will release the allocated memory.

NTContainer is a powerful abstraction for reading from a target. The target can be a memory buffer, a file or even the memory of a remote process. When NTContainer objects are returned by calling functions like createContainerFromFile() or newContainer(), they may either encapsulate a file or a memory buffer. Whether to use a file or a memory buffer is internally decided upon the basis of current memory resources.

If you want to make sure that an NTContainer instance encapsulates a memory buffer you can do it by specifically setting its internal object:

from Pro.Core import *

c = NTContainer()
# set a byte array as the internal object of NTContainer
c.setData(b"")
# NTContainer are never resizeable by default
c.setResizable(True)
# append some data
c.append(b"foo")
# print out the size of 3
print(c.size())

Ranges and address spaces can also be applied to NTContainer. Consider the following example:

from Pro.Core import *

c = NTContainer()
c.setData(b"Hello, world!")
# increase the reference count of c
c2 = c.clone()
# set a new range for c2
c2.setRange(7, 5)
# prints out "Hello, world!"
print(c.read(0, c.size()).decode("utf-8"))
# prints out "world"
print(c2.read(0, c2.size()).decode("utf-8"))

The c2 instance refers to the same object as c but with a different range. This is very useful when working with embedded objects. For instance, parsing a resource inside of a binary file might only require setting the range on an instance NTContainer of the parent binary file, before being passed onto CFFObject.Load().

It is not necessary to subclass CFFObject in order parse a file. We can use CFFObject directly:

from Pro.Core import *

xml_header = """<header>

<r id='_IMAGE_DOS_HEADER' type='struct'>
  <f id='e_magic' type='unsigned short'/>
  <f id='e_cblp' type='unsigned short'/>
  <f id='e_cp' type='unsigned short'/>
  <f id='e_crlc' type='unsigned short'/>
  <f id='e_cparhdr' type='unsigned short'/>
  <f id='e_minalloc' type='unsigned short'/>
  <f id='e_maxalloc' type='unsigned short'/>
  <f id='e_ss' type='unsigned short'/>
  <f id='e_sp' type='unsigned short'/>
  <f id='e_csum' type='unsigned short'/>
  <f id='e_ip' type='unsigned short'/>
  <f id='e_cs' type='unsigned short'/>
  <f id='e_lfarlc' type='unsigned short'/>
  <f id='e_ovno' type='unsigned short'/>
  <f id='e_res' type='unsigned short [4]'/>
  <f id='e_oemid' type='unsigned short'/>
  <f id='e_oeminfo' type='unsigned short'/>
  <f id='e_res2' type='unsigned short [10]'/>
  <f id='e_lfanew' type='int'/>
</r>

</header>"""

def printStructure(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    # load header from an XML string
    header = CFFHeader()
    if not header.LoadFromXml(xml_header):
        return
    obj = CFFObject()
    # since CFFObject is not subclassed, the Load method cannot fail
    obj.Load(c)
    # map a structure to a specific offset
    offset = 0
    s = obj.MakeStruct(header, "_IMAGE_DOS_HEADER", offset, CFFSO_VC | CFFSO_Pack1)
    out = NTTextBuffer()
    s.Dump(out)
    print(out.buffer)

To read in a buffered way from a target object, be it CFFObject or NTContainer, you can use NTBuffer derived classes such as NTContainerBuffer and CFFBuffer:

from Pro.Core import *

def bufferedRead(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    obj = CFFObject()
    obj.Load(c)
    offset = 0
    r = obj.ToBuffer(offset)
    try:
        # read a single byte from the file
        b = r.u8()
    except IndexError:
        print("error: out of range")

By default buffered readers default to Bufferize_Forwards. If you want to read backwards or back and forth you can specify Bufferize_Backwards or Bufferize_BackAndForth respectively.

The default endianness can be specified both for CFFObject and NTBuffer instances. If not specified, endianness will default to ENDIANNESS_LITTLE.

If need to parse an XML string, you can use our NTXml class, which is both fast and secure.

from Pro.Core import *

x = NTXml()
ret = x.parse("<r><e t='test'></e></r>")
if ret == NTXml_ErrNone:
    n = x.findChild(None, "r")
    if n != None:
        n = x.findChild(n, "e")
        if n != None:
            a = x.findAttribute(n, "t")
            if a != None:
                print(x.value(a))

All the filters which are available in the UI can be used programmatically from the SDK.

from Pro.Core import *

c = NTContainer()
c.setData(b"Hello, world!")
# compress data with zlib
fstr = "<flts><f name='pack/zlib' level='9' raw='true'/></flts>"
# set the last parameter to False to hide the wait-box
c = applyFilters(c, fstr, True)
# print out the compressed data
print(c.read(0, c.size()))

By using filters it’s possible to perform complex data operations with just a few lines of code. In the code snippet above we use a filter to compress the input data using zlib.

Scanning Files

In this section we offer an introduction into the internals of our scan engine.

The core classes are:

  • Report - This class represents a project. A project can be unpacked or packed. When it’s unpacked, it consists of a directory containing a number of DBs and other files. When it’s packed, the same files are merged into a single file and may be compressed and/or encrypted. Fundamentally, in the context of file scanning, a project contains a SQLite3 database which, in turn, contains XML reports for each scanned file. The current instance of this class is returned by ProCoreContext.getReport().

  • ScanProvider - This is the base class inherited by all the scan engines for the different file formats.

  • ScanEntryData - This is the class that contains the data passed to ScanProvider.addEntry(). Every time a scan provider for a file format encounters a threat, warning, information, privacy issue or embedded file, it calls ScanProvider.addEntry().

  • FormatTree - A tree of uint32 ids that describe the layout structure of the analyzed file. This is the layout shown in the format view in the analysis workspace.

  • FormatItemInfo - The information returned for each individual item in the format tree. ScanProvider._formatViewInfo() returns this information based on the id provided when constructing the FormatTree.

  • ScanViewData - This class is returned by ScanProvider._scanViewData() and ScanProvider._formatViewData(). It may represent raw data, in case of an embedded file, as well as a complex UI.

  • CommonSystem - Logic providers return classes derived from this class to define a scanning behaviour. For instance, when creating a logic provider which analyzes only a specific set of files in a directory or on a file system, the derived class LocalSystem can be used.

  • ProCoreContext - Provides context information like the current scan provider (ProCoreContext.currentScanProvider()) or the current report (ProCoreContext.getReport()). The global instance of this class is returned by proCoreContext().

As mentioned, for every scanned file an XML report is generated. Below is the commented schema of these XML reports.

<!-- XML schema

note: attributes are marked by parenthesis

o = object
 (t = type
  u = current entry unique id (in hex)
  s = target (base64)
  r = risk
  f = flags)

s = scan entries
  t = threat
  w = warning
  i = info
   (t = type
    u = unique identifier for the entry (in hex)
    f = flags (optional)
    s = target (optional, for embedded files)(base64)
    l = object format (for embedded files)
    )
   (- ic = indirect category
      it = indirect type
    - fi = format item id
    ii = internal file uid
    v  = view
    of = offset
    sz = size)
    d = data (mandatory)
  extra:
    t = text
    flts = filters
      f = filter
        (name + params)
    s = shellcode
      (a = arch
       b = base address
       )

e = embedded objects
  o = object (see above)

h = hashes
  md5 = md5 hash
  etc.

m = metadata
 (ct = creation time
  mt = modification time
  at = access time
  )
  e = entry (content is base64 encoded)
   (id = name identifying the entry (raw)
    l = label (base64)
    f = flags (1 for text to show in report)
    )

<!-- sample -->
<o t="pe" s="C:/file" r="100">

  <!-- scan entries -->
  <s>

    <!-- threat entry -->
    <t t="5" u="0">

      <!-- custom data for the current entry, this is handled by
           the specific scan provider -->
      <d>
        <start>0</start>
        <size>1000</size>
      </d>

      <!-- human readable text (for showing advanced infos)
           encoded in utf8->base64 -->
      <t></t>

      <!-- filters applied on the retrieved data -->
      <flts>
        <f n="aes" p="cbc;256" k="11223344.." />
        <f n="z" />
      </flts>

    </t>

  </s>

  <!-- what follows is a list of embedded objects
       in the same order of the embedded file entries -->
  <e>
    <o t="pdf" r="70">
      <!-- ... -->
    </o>
  </e>

  <!-- various hashes (if any) stored for the current object -->
  <h>
   <md5>00000000000000..</md5>
   <sha1>000000000000...</sha1>
  </h>

  <!-- metadata (if any) -->
  <m ct="hex" wt="hex" at="hex">
    <e>base64</e>
    <e f=1>base64</e> <!-- will be shown as text in the report view -->
  </m>


</o>

The important part to understand when working with the SDK is the custom data mentioned in the schema (the <d> node). This is the custom XML data which is provided by the ScanProvider during the scanning process via ScanProvider.addEntry() and is then passed back to ScanProvider._scanViewData() when requesting data relative to a scan entry.

The data returned from a scan entry can be everything: from a simple description of a threat to an embedded file. In fact, ScanProvider._scanViewData() can return even complex UIs or native code disassembled by our Carbon engine.

Module API

Pro.Core module API.

Attributes:

Bufferize_BackAndForth

Buffering method for NTBuffer.

Bufferize_Backwards

Buffering method for NTBuffer.

Bufferize_Forwards

Buffering method for NTBuffer.

Bufferize_Invalid

Buffering method for NTBuffer.

CFFDBIndexSize32

32-bit index size for CFFDB.

CFFDBIndexSize64

64-bit index size for CFFDB.

CFFDBInvalidIndex

Invalid index for CFFDB.

CFFDBRootIndex

Root index for CFFDB.

CFFKST_Raw

Key sub-type raw.

CFFKST_String

Key sub-type string.

CFFKST_UTF8

Key sub-type utf-8.

CFFKT_Cert

Key type certificate.

CFFKT_Invalid

Key type invalid.

CFFKT_Pass

Key type password.

CFFN_Base

Base value for standard CFFObject notifications.

CFFN_Malformed

CFFObject notification for malformed data.

CFFN_MoreFiles

CFFObject notification for the file limit.

CFFN_NoDecrypt

CFFObject notification for failed decryption.

CFFN_NoUnpack

CFFObject notification for failed decompression.

CFFN_ParsingLimit

CFFObject notification for an internal parsing limit.

CFFN_Recursive

CFFObject notification for recursion.

CFFN_UnpackLimit

CFFObject notification for the decompression limit.

CFFN_UnpackNestLimit

CFFObject notification for the decompression nesting limit.

CFFPtrMaxSize

The maximum supported pointer size.

CFFPtrMinSize

The minimum supported pointer size.

CFFPtrSize16

16-bit pointer size.

CFFPtrSize32

32-bit pointer size.

CFFPtrSize64

64-bit pointer size.

CFFRange_Custom

Range value.

CFFRange_Last

Last range value plus one.

CFFRange_Unknown

Range value (alias of CFFRange_Unreferenced).

CFFRange_Unreferenced

Range value.

CFFRange_Unused

Range value.

CFFRange_Used

Range value.

CFFSO_Clang

This flag specifies that the structure was generated by the Clang compiler.

CFFSO_CompilerMask

Compiler mask for the flags of the structure.

CFFSO_EndianBig

This flag specifies that the structure is big-endian.

CFFSO_EndianDefault

This flag specifies that the structure uses the default endianness.

CFFSO_EndianLittle

This flag specifies that the structure is little-endian.

CFFSO_EndiannessBig

This flag specifies that the structure is big-endian.

CFFSO_EndiannessDefault

This flag specifies that the structure uses the default endianness.

CFFSO_EndiannessLittle

This flag specifies that the structure is little-endian.

CFFSO_EndiannessMask

Endianness mask for the flags of the structure.

CFFSO_GCC

This flag specifies that the structure was generated by the GCC compiler.

CFFSO_NoCompiler

This flag specifies that the structure wasn’t generated by a specific compiler.

CFFSO_NoPlatform

This flag specifies that the structure isn’t bound to specific platform.

CFFSO_Pack1

This flag specifies that the structure has an alignment of 1.

CFFSO_Pack16

This flag specifies that the structure has an alignment of 16.

CFFSO_Pack2

This flag specifies that the structure has an alignment of 2.

CFFSO_Pack4

This flag specifies that the structure has an alignment of 4.

CFFSO_Pack8

This flag specifies that the structure has an alignment of 8.

CFFSO_PackMask

Alignment mask for the flags of the structure.

CFFSO_PackNone

This flag specifies that the structure doesn’t have an alignment.

CFFSO_PlatformMask

Platform mask for the flags of the structure.

CFFSO_Pointer16

This flag specifies that the pointer size of the structure is 16-bits.

CFFSO_Pointer32

This flag specifies that the pointer size of the structure is 32-bits.

CFFSO_Pointer64

This flag specifies that the pointer size of the structure is 64-bits.

CFFSO_PointerDefault

This flag specifies that the pointer size of the structure is the default one for the object.

CFFSO_PointerMask

Pointer mask for the flags of the structure.

CFFSO_VC

This flag specifies that the structure was generated by the Visual C++ compiler.

CFFSO_Windows

This flag specifies that the structure was generated for the Windows platform.

CFF_ARRAY_NULL_TERMINATED

If specified, makes an array of structure be null-terminated.

CT_ActionScript2

Scan entry type for ActionScript2.

CT_ActionScript3

Scan entry type for ActionScript3.

CT_AppLaunch

Scan entry type for application launches.

CT_AttackSurface

Scan entry type for attack surfaces.

CT_BinaryData

Scan entry type for binary data.

CT_Blacklisted

Scan entry type for a blacklisted item.

CT_ByteCode

Scan entry type for byte-code.

CT_DalvikByteCode

Scan entry type for Dalvik byte-code.

CT_DataEntriesEnd

Scan entry type for data entries end.

CT_DataEntriesStart

Scan entry type for data entries start.

CT_DebugData

Scan entry type for debug data.

CT_DecompressionBomb

Scan entry type for decompression bombs.

CT_EmbeddedFile

Scan entry type for embedded objects.

CT_EntryLimit

Scan entry type for entry limits.

CT_ForeignData

Scan entry type for foreign data.

CT_FreePages

Scan entry type for free pages.

CT_Geolocation

Scan entry type for geo-locations.

CT_HiddenSheets

Scan entry type for hidden sheets.

CT_Intelligence

Scan entry type for an intelligence report.

CT_InteractiveForm

Scan entry type for interactive forms.

CT_InvalidCertificate

Scan entry type for invalid certificates.

CT_JavaByteCode

Scan entry type for Java byte-code.

CT_JavaScript

Scan entry type for JavaScript.

CT_MSILByteCode

Scan entry type for MSIL byte-code.

CT_Malformed

Scan entry type for malformed data.

CT_MalformedDocument

Scan entry type for malformed documents.

CT_MetaData

Scan entry type for meta-data.

CT_MetaDataUnknown

Scan entry type for unknown meta-data.

CT_NativeCode

Scan entry type for native code.

CT_NoDecompress

Scan entry type for failed decompression.

CT_NoDecrypt

Scan entry type for failed decryption.

CT_OKDecompressed

Scan entry type for successful decompression.

CT_OKDecrypted

Scan entry type for successful decryption.

CT_PersonalData

Scan entry type for personal data.

CT_Privileges

Scan entry type for required privileges.

CT_Recursive

Scan entry type for recursion.

CT_Report

Scan entry type for a report.

CT_Resources

Scan entry type for issues in resources.

CT_Script

Scan entry type for scripts.

CT_ShellCode

Scan entry type for shellcode.

CT_SignatureMatch

Scan entry type for signature matches.

CT_SpreadsheetFormulas

Scan entry type for spreadsheet formulas.

CT_SymbolicLink

Scan entry type for symbolic links.

CT_Thumbnail

Scan entry type for thumbnails.

CT_TrueType

Scan entry type for TrueType fonts.

CT_TrustedCertificate

Scan entry type for trusted certificates.

CT_Type1

Scan entry type for Type1 fonts.

CT_Type2

Scan entry type for Type2 fonts.

CT_UnaccountedSpace

Scan entry type for unaccounted space.

CT_UnknownFont

Scan entry type for unknown fonts.

CT_UnpackLimit

Scan entry type for the decompression limit.

CT_UnpackNestLimit

Scan entry type for the decompression nesting limit.

CT_UnreferencedData

Scan entry type for unreferenced data.

CT_UntrustedCertificate

Scan entry type for untrusted certificates.

CT_UnverifiedCertificate

Scan entry type for unverified certificates.

CT_VBAScript

Scan entry type for VBA code.

CT_VBSScript

Scan entry type for VBS scripts.

CT_VersionInfo

Scan entry type for version information.

CT_Whitelisted

Scan entry type for a whitelisted item.

CT_WrongCheckSum

Scan entry type for invalid checksums.

CT_WrongDigest

Scan entry type for invalid digests.

CT_WrongHash

Scan entry type for invalid hashes.

DSNF_NoAccessSpecifier

Doesn’t include the member type (i.e.: public, protected, private) in the unmangled symbol.

DSNF_NoCallingConvention

Doesn’t include the calling convention in the unmangled symbol.

DSNF_NoMemberType

Doesn’t include the member type (i.e.: static, virtual, extern) in the unmangled symbol.

DSNF_NoReturnType

Doesn’t include the return type in the unmangled symbol.

DSNF_SimpleSignature

Returns a simplified signature of the unmangled symbol.

DisasmOpt_FileOffsets

Shows offsets in disassemblies shown in the text view.

DisasmOpt_Opcodes

Shows opcodes in disassemblies shown in the text view.

ENDIANNESS_BIG

Big-endian option.

ENDIANNESS_LITTLE

Little-endian option.

EXPLICIT_OFLAGS_MASK

The mask for explicit object flags.

GB_SIZE

This constant defines the size of a gigabyte.

IMPLICIT_OFLAG_UNKNOWN_FORMAT

Implicit object flag.

INVALID_OFFSET

Invalid file or data offset.

INVALID_STREAM_OFFSET

Invalid file or data offset.

KB_SIZE

This constant defines the size of a kilobyte.

MB_SIZE

This constant defines the size of a megabyte.

METAFLAG_STRING

Specifies the string nature of the meta-data.

NATURE_BYTEARRAY

Byte-array type nature.

NATURE_NUMBER

Integer number type nature.

NATURE_REAL

Real number type nature.

NATURE_STRING

String type nature.

NATURE_UNKNOWN

Unknown type nature.

NTDefaultLocaleLongDate

The long date format used by the application’s locale.

NTDefaultLocaleShortDate

The short date format specified by the application’s locale.

NTFileOpt_CreateNew

Creates the file only if it doesn’t already exist.

NTFileOpt_ReadOnly

Read-only file access.

NTFileOpt_ShareWrite

Shared write file access.

NTFileOpt_Write

Read/write file access.

NTFlagOutput_IgnoreUnknown

Ignores unknown flags and options.

NTFriday

Fifth day of the week.

NTISODate

ISO 8601 extended date format: either yyyy-MM-dd for dates or yyyy-MM-ddTHH:mm:ss (e.g.

NTLocalTime

Local time, controlled by a system time-zone setting.

NTMonday

First day of the week.

NTOffsetFromUTC

An offset in seconds from Coordinated Universal Time.

NTProcessMemoryAccess_Execute

Executable memory flag.

NTProcessMemoryAccess_Guard

Guarded memory flag.

NTProcessMemoryAccess_Read

Readable memory flag.

NTProcessMemoryAccess_UserMode

User-mode memory flag.

NTProcessMemoryAccess_Write

Writable memory flag.

NTProcessMemoryState_Commit

Committed memory state.

NTProcessMemoryState_Free

Freed memory state.

NTProcessMemoryState_Reserve

Reserved memory state.

NTProcessMemoryType_Image

Image memory type.

NTProcessMemoryType_Mapped

Mapped memory type.

NTProcessMemoryType_Private

Private memory type.

NTRFC2822Date

RFC 2822, RFC 850 and RFC 1036 date format.

NTSaturday

Sixth day of the week.

NTSunday

Seventh day of the week.

NTSystemLocaleLongDate

The long date format used by the operating system.

NTSystemLocaleShortDate

The short date format used by the operating system.

NTTextDate

Date format equivalent to using the date format string "ddd MMM d yyyy".

NTThursday

Fourth day of the week.

NTTimeZone

A named time zone.

NTTuesday

Second day of the week.

NTUTC

Coordinated Universal Time.

NTWednesday

Third day of the week.

NTXml_ErrAlloc

Returned if an allocation error occurred.

NTXml_ErrNone

Returned if no error occurred.

NTXml_ErrParse

Returned if a parse error occurred.

NTXml_ErrUnknown

Returned if an unknown error occurred.

NTXml_FaultTolerant

Parses malformed XML data.

NTXml_IgnoreNS

Ignores XML node namespaces.

NTXml_InvalidFlags

Returned if invalid flags were specified.

NTXml_InvalidNode

Returned if an invalid node was specified.

NTXml_InvalidType

Returned if an invalid type was specified.

NT_ASF_BlockIO

Address space flag for block I/O.

NT_ASF_IgnoreInvalidPages

Address space flag to ignore invalid pages.

NT_ASF_IsSparse

Address space flag for sparse address spaces.

NT_ASF_Memory

Address space flag for process memory.

NT_ASPSF_ALL

Address space standard flag which combines all supported flags.

NT_ASPSF_DIRTY

Address space standard flag for dirty pages.

NT_ASPSF_EXECUTE

Address space standard flag for executable pages.

NT_ASPSF_GUARD

Address space standard flag for guarded pages.

NT_ASPSF_PRESENCE

Address space standard flag for readable/present pages.

NT_ASPSF_TRANSITION

Address space standard flag for transitional pages.

NT_ASPSF_USER_MODE

Address space standard flag for user mode pages.

NT_ASPSF_WRITE

Address space standard flag for writable pages.

NT_ASR_INVALID

Address space result for unsuccessful operations.

NT_ASR_OK

Address space result for successful operations.

NT_ASR_UNSUPPORTED

Address space result for unsupported operations.

NT_FileAttr_Compressed

File attribute flag.

NT_FileAttr_Encrypted

File attribute flag.

NT_FileAttr_Hidden

File attribute flag.

NT_FileAttr_ReadOnly

File attribute flag.

NT_FileAttr_System

File attribute flag.

NT_FileAttr_Temporary

File attribute flag.

NT_FileExt_Dll

Applies a shared library extension to the file name (e.g.: ".dll" on Windows and ".dylib" on macOS).

NT_FileExt_Exe

Applies a binary extension to the file name (i.e., ".exe" on Windows).

NT_FileExt_Link

Applies a link extension to the file name (i.e., ".lnk" on Windows).

NT_Folder_App

Retrieves the application directory.

NT_Folder_AppData

Retrieves the AppData directory on Windows.

NT_Folder_AppExe

Retrieves the application directory.

NT_Folder_AppMenu

Retrieves the AppMenu directory on Windows.

NT_Folder_Applications

Retrieves the applications directory on Windows.

NT_Folder_Applications_x86

Retrieves the x86 applications directory on Windows.

NT_Folder_Common_AppMenu

Retrieves the shared AppMenu directory on Windows.

NT_Folder_Common_Desktop

Retrieves the shared desktop directory on Windows.

NT_Folder_Current

Retrieves the current working directory.

NT_Folder_Desktop

Retrieves the desktop directory.

NT_Folder_Documents

Retrieves the documents directory.

NT_Folder_Home

Retrieves the home directory.

NT_Folder_Root

Retrieves the root directory (i.e., "/" on Linux/macOS and "C:/" on Windows).

NT_Folder_Temp

Retrieves the temporary directory.

NT_MEMORY_REGIONS_MAX_ADDR

Maximum memory address for memory regions.

NT_ProcessAccess_All

All process access privileges.

NT_ProcessAccess_Read

Process read access privileges.

NT_ProcessAccess_Terminate

Process termination access privileges.

OFLAG_MORE_CHILDREN

Object flag.

OFLAG_MORE_ENTRIES

Object flag.

OFLAG_MORE_SHELLCODE

Object flag.

OFLAG_NO_DECRYPT

Object flag.

OFLAG_NO_UNPACK

Object flag.

OFLAG_PARSING_LIMIT

Object flag.

OFLAG_UNPACK_LIMIT

Object flag.

OFLAG_UNPACK_NESTING

Object flag.

REPORT_DB_EXT

File extension for an unpacked project.

REPORT_DB_NAME

Name of the main project database.

REPORT_EXT

File extension for a packed project.

REPORT_INT_ODB_NAME

Name of the internal files database.

REPORT_INT_PATH

Name of the internal files path.

REPORT_INT_ROOT_PREFIX

The prefix used to reference internal files from root entries.

REPORT_ODB_NAME

Name of the object database.

REPORT_PROJECT_SIGNATURE

File signature for a packed project.

REPORT_VERSION

Current project version.

SCANVIEW_BE

Specifies that the returned data is big-endian.

SCANVIEW_CARBON

Carbon view.

SCANVIEW_CELLTABLE

Cell table view.

SCANVIEW_CHART

Chart view.

SCANVIEW_CODEC_ASCII

Specifies that the returned data is ascii.

SCANVIEW_CODEC_MASK

Codec mask for the returned data.

SCANVIEW_CODEC_UCS2

Specifies that the returned data is ucs-2.

SCANVIEW_CODEC_UCS4

Specifies that the returned data is ucs-4.

SCANVIEW_CODEC_UTF16

Specifies that the returned data is utf-16.

SCANVIEW_CODEC_UTF32

Specifies that the returned data is utf-32.

SCANVIEW_CODEC_UTF8

Specifies that the returned data is utf-8.

SCANVIEW_CODE_JAVASCRIPT

Specifies that the returned data is JavaScript code.

SCANVIEW_CODE_MASK

Code mask for the returned data.

SCANVIEW_CODE_NONE

Specifies no code type for the returned data.

SCANVIEW_CODE_VBA

Specifies that the returned data is VBA code.

SCANVIEW_CODE_VBS

Specifies that the returned data is VBS code.

SCANVIEW_CUSTOM

Custom view.

SCANVIEW_CUSTOM_2

Second custom view.

SCANVIEW_CUSTOM_3

Third custom view.

SCANVIEW_CUSTOM_4

Fourth custom view.

SCANVIEW_CUSTOM_5

Fifth custom view.

SCANVIEW_DATA_NOT_SHARED

Specifies that the returned data is utf-16 is not shared among the views.

SCANVIEW_EMASK

Endianness mask for the returned data.

SCANVIEW_FILEINFO

File info view.

SCANVIEW_FS

File system view.

SCANVIEW_GEO

Geo-location view.

SCANVIEW_HEX

Hex view.

SCANVIEW_KEYVALUE

Key-value view.

SCANVIEW_LE

Specifies that the returned data is little-endian.

SCANVIEW_LIST

List view.

SCANVIEW_ME

Specifies that the returned data is middle-endian.

SCANVIEW_MEDIA

Media view.

SCANVIEW_NONE

Invalid view.

SCANVIEW_PLOT

Plot view.

SCANVIEW_RAW

Raw hex view.

SCANVIEW_TABLE

Table view.

SCANVIEW_TEXT

Text view.

SCANVIEW_TEXTBROWSER

Text browser view.

SCANVIEW_TREE

Tree view.

SCANVIEW_WEB

Web view.

SEC_File

Scan entry category for embedded objects.

SEC_Info

Scan entry category for information.

SEC_Intrinsic

Scan entry category for intrinsic threats.

SEC_Online

Scan entry category for online entries.

SEC_Privacy

Scan entry category for privacy issues.

SEC_Threat

Scan entry category for threats.

SEC_Warn

Scan entry category for warnings.

SFT_AccessTime

Scan provider time type for file access.

SFT_CreationTime

Scan provider time type for file creation.

SFT_ModificationTime

Scan provider time type for file modification.

TB_SIZE

This constant defines the size of a terabyte.

THIS_HDR_NAME

The special name of the header file associated with the report.

THIS_HEADER_NAME

The file name of the header file associated with the report.

TYPES_NATURE_BASE

Base value for type nature.

ToolDir_CheckExistence

Checks for the existence of the directory.

ToolDir_CreateIfMissing

Creates the directory if missing.

ToolDir_None

Returns the requested directory without checking for its existence or creating it if missing.

Classes:

CFFBuffer(object, offset, method)

This class provides buffered read capability for CFFObject.

CFFContainer()

This is a derived class from NTContainer which can reference data as CFFObject and CFFStruct.

CFFContext()

This class is used internally by CFFStruct to store information from members which affect the position and size of other members.

CFFDB()

This class creates a volatile tree structure that is either stored in memory or on disk.

CFFFlags()

This class contains flags and options for a member of CFFStruct.

CFFGetKeyResult()

This class is the return value of CFFObject.GetKey().

CFFHeader()

This class represents a header.

CFFHeaderAliasData()

Alias data of a header file.

CFFHeaderStructData()

Structure data of a header file.

CFFHeaderTypeDefData()

Type definition data of a header file.

CFFInitParams(wo, options)

This class contains the initialization parameters for the CFFObject.Initialize() method.

CFFKeyIndex()

This class represents a key index.

CFFObject()

The class from which every format class is derived (ZipObject, PEObject, etc.).

CFFStruct()

This class represents a data structure and references a CFFObject instance.

CFFStructIt(s)

Iterator for an array of CFFStruct structures.

CFFStructList()

List of CFFStruct elements.

CFFStructListIt(obj)

Iterator class for CFFStructList.

CFSEntry(iface)

Wrapper class for a CFSEntryInterface instance.

CFSEntryInterface()

This class represents a single file system entry.

CFSInstance(iface)

Wrapper class for a CFSInterface instance.

CFSInterface()

This class represents a file system interface

CFSIterator(iface)

Wrapper class for a CFSIteratorInterface instance.

CFSIteratorInterface()

This class represents a file system iterator.

CFSList(iface)

Wrapper class for a CFSListInterface instance.

CFSListInterface()

This class represents a file system list.

CommonSystem()

Logic providers return classes derived from this class to define a scanning behaviour.

FileToScan()

This class contains information about the file to scan returned by classes derived from CommonSystem.

FormatItemInfo()

The information about a format item returned by ScanProvider._formatViewInfo().

FormatTree()

Tree of FormatTreeNode nodes.

FormatTreeNode()

This class represents a node of FormatTree.

FormatTreeNodeList()

List of FormatTreeNode elements.

FormatTreeNodeListIt(obj)

Iterator class for FormatTreeNodeList.

KROffset()

Match for a byte search in NTContainer.

Layout()

Layouts are used to create ranges and associate structures to hex views.

LayoutData()

This class contains the data of a layout entry.

LayoutInterval()

This class represents a layout interval.

LayoutPair(t1, t2)

Pair of (LayoutInterval, LayoutData) elements.

LayoutPairList()

List of LayoutPair elements.

LayoutPairListIt(obj)

Iterator class for LayoutPairList.

LocalSystem()

CommonSystem derived class used to perform local file system scans.

NTAddressSpace()

This class is used to apply address spaces to containers.

NTBuffer()

Base class for buffered read operations.

NTByteArrayList()

List of bytes elements.

NTByteArrayListIt(obj)

Iterator class for NTByteArrayList.

NTContainer()

This is a generic container used to encapsulate data such as files and memory.

NTContainerBuffer(container, endianness, …)

This class provides buffered read capability for NTContainer.

NTDate(y, m, d)

This class provides date functions.

NTDateTime(date, time, spec)

This class provides date and time functions.

NTDoubleList()

List of float elements.

NTDoubleListIt(obj)

Iterator class for NTDoubleList.

NTDoubleVector()

Vector list of float elements.

NTDoubleVectorIt(obj)

Iterator class for NTDoubleVector.

NTFileEnum(path)

This class enumerates files from a specified path.

NTIWait()

Interface for wait objects.

NTIntList()

List of int elements.

NTIntListIt(obj)

Iterator class for NTIntList.

NTIntVariantHash()

Dictionary of int -> BasicType elements.

NTIntVariantHashIt(obj)

Iterator class for NTIntVariantHash.

NTIntVector()

Vector list of int elements.

NTIntVectorIt(obj)

Iterator class for NTIntVector.

NTMaxUIntList()

List of int elements.

NTMaxUIntListIt(obj)

Iterator class for NTMaxUIntList.

NTMaxUIntTree()

Tree of NTMaxUIntTreeNode nodes.

NTMaxUIntTreeNode()

This class represents a node of NTMaxUIntTree.

NTMaxUIntTreeNodeList()

List of NTMaxUIntTreeNode elements.

NTMaxUIntTreeNodeListIt(obj)

Iterator class for NTMaxUIntTreeNodeList.

NTMaxUIntVector()

Vector list of int elements.

NTMaxUIntVectorIt(obj)

Iterator class for NTMaxUIntVector.

NTMemoryInfoList()

List of NTMemoryInfo elements.

NTMemoryInfoListIt(obj)

Iterator class for NTMemoryInfoList.

NTModuleInfoList()

List of NTModuleInfo elements.

NTModuleInfoListIt(obj)

Iterator class for NTModuleInfoList.

NTOffsetRange()

This class defines a generic offset-size range.

NTOffsetRangeList()

List of NTOffsetRange elements.

NTOffsetRangeListIt(obj)

Iterator class for NTOffsetRangeList.

NTProcessInfoList()

List of NTProcessInfo elements.

NTProcessInfoListIt(obj)

Iterator class for NTProcessInfoList.

NTProcessRegionsEnumerator(pid)

This class implements an enumerator for memory regions.

NTSimpleWait()

Basic implementation of NTIWait.

NTStringList()

List of str elements.

NTStringListIt(obj)

Iterator class for NTStringList.

NTStringStringHash()

Dictionary of str -> str elements.

NTStringStringHashIt(obj)

Iterator class for NTStringStringHash.

NTStringStringHashList()

List of NTStringStringHash elements.

NTStringStringHashListIt(obj)

Iterator class for NTStringStringHashList.

NTStringVariantHash()

Dictionary of str -> BasicType elements.

NTStringVariantHashIt(obj)

Iterator class for NTStringVariantHash.

NTTextBuffer()

This is a class derived from NTTextStream.

NTTextStream()

An interface for outputting text and mnemonics.

NTTextStringBuffer()

This is a class derived from NTTextStream.

NTTime(h, m, s, ms)

This class provides clock time functionality.

NTTimer()

This class implements a fast milliseconds timer based on NT_GetTickCount().

NTUInt64List()

List of int elements.

NTUInt64ListIt(obj)

Iterator class for NTUInt64List.

NTUInt64UIntHash()

Dictionary of int -> int elements.

NTUInt64UIntHashIt(obj)

Iterator class for NTUInt64UIntHash.

NTUIntList()

List of int elements.

NTUIntListIt(obj)

Iterator class for NTUIntList.

NTUIntTree()

Tree of NTUIntTreeNode nodes.

NTUIntTreeNode()

This class represents a node of NTUIntTree.

NTUIntTreeNodeList()

List of NTUIntTreeNode elements.

NTUIntTreeNodeListIt(obj)

Iterator class for NTUIntTreeNodeList.

NTUIntVector()

Vector list of int elements.

NTUIntVectorIt(obj)

Iterator class for NTUIntVector.

NTUShortUShortHash()

Dictionary of int -> int elements.

NTUShortUShortHashIt(obj)

Iterator class for NTUShortUShortHash.

NTUShortVector()

Vector list of int elements.

NTUShortVectorIt(obj)

Iterator class for NTUShortVector.

NTUTF8StringHash()

Dictionary of str -> str elements.

NTUTF8StringHashIt(obj)

Iterator class for NTUTF8StringHash.

NTUTF8StringList()

List of str elements.

NTUTF8StringListIt(obj)

Iterator class for NTUTF8StringList.

NTVariantList()

List of BasicType elements.

NTVariantListIt(obj)

Iterator class for NTVariantList.

NTVoidBuffer()

This is a class derived from NTTextStream.

NTXml()

XML parser class.

NT_MEMORY_INFO()

This class represents a memory region.

NT_MODULE_INFO()

This class contains information about a loaded module.

NT_PROCESS_INFO()

This class contains information about a process.

PDBAssociationInfo()

This class contains association information for Windows PDB files.

ProCoreContext()

This class provides functionality for the current context.

ProGlobalSettings()

This class provides access to the main settings of the application.

ProSettings()

This class provides access to settings.

ProTextPrintBuffer()

This is a class derived from NTTextStream.

ProValueStorage()

This class provides SQLite-backed key -> value storage facility.

ProWebRequest(url)

This class can be used to make a web request.

Report()

This class represents a project.

ScanEntryBaseAttributes()

This class contains the base attributes of a scan entry retrieved from the report.

ScanEntryData()

This class represents a scan entry.

ScanMetaDataEntries()

List of ScanMetaDataEntry elements.

ScanMetaDataEntriesIt(obj)

Iterator class for ScanMetaDataEntries.

ScanMetaDataEntry()

This class represents a scan meta-data entry.

ScanProvider()

This is the base class inherited by all the scan engines for the different file formats.

ScanProviderWait(sprovider)

This class only wraps ScanProvider.isAborted().

ScanViewData()

This class is used as I/O container to retrieve data and UI views from a scan provider.

objdb_info()

This class contains information about an entry in the object database.

objdbview_info()

This class contains parameters to create a window view of the object database.

Functions:

CurrentEndianness()

Returns the endianness of the system (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

DemangleSymbolName(mangled[, flags])

Unmangles a decorated symbol.

MethodNameFromSimpleSignature(signature)

Extracts the function or method name from a simple signature.

NT_AppendFile(src, copySize, dst)

Appends copySize bytes of src file to dst file.

NT_ApplyFileExt(fileName, filetype)

Appends the default extension type for the current system specified by filetype to fileName.

NT_AutoDecodeBytes(raw)

This function tries to decode raw bytes into a string using simple heuristics.

NT_CloseFile(ntfile)

Closes an open file handle.

NT_CloseModuleHandle(ntmod)

Closes the handle of a module without unloading the module.

NT_CloseProcess(proc)

Closes a process handle.

NT_ColorFromString(str)

Compute a color from an input string.

NT_CopyFile(fileNameA, fileNameB)

Copies a file.

NT_CopyFileOpen(fileNameA, fileNameB)

Copies a file.

NT_CreateDirectory(dirName)

Creates a directory.

NT_CreateDirectoryTree(dirName)

Creates a directory and all the intermediate directories leading up to that directory if not yet present.

NT_CreateFile(FileName[, opt])

Creates a file.

NT_CreateFileLink(fileName, linkName[, descr])

Creates a link (e.g.: .lnk on Windows) file.

NT_CreateTempFile([ext, auto_delete])

Creates a temporary file.

NT_DecodeAsciiBytes(raw)

This function tries to decode an ascii string using simple heuristics.

NT_DecodeAsciiBytes16(raw, endianness)

This function tries to decode an ascii wide-char string using simple heuristics.

NT_DeleteDirectory(dirName)

Deletes a directory.

NT_DeleteFile(FileName)

Deletes a file.

NT_DeleteLink(linkName)

Deletes a link (e.g.: .lnk on Windows) file.

NT_DirectoryExists(dirName)

Checks the existence of a directory.

NT_FileExists(FileName)

Checks the existence of a file.

NT_FileExtFromName(fileName[, include_dot])

Retrieves the extension of a file name (e.g.: ".exe").

NT_FileNameFromPath(path)

Retrieves the file name from a path.

NT_FileToBuffer(fileName, maxSize[, readPartial])

Reads a file to a memory buffer.

NT_FloatToString(v)

Converts a float value to string.

NT_FreeModule(ntmod)

Unloads a module and closes its handle.

NT_GetCurrentDirectory()

Returns the current working directory.

NT_GetCurrentModuleFileName()

Returns the name of the current module including its path.

NT_GetCurrentModulePath()

Returns the full path of the current module.

NT_GetCurrentProcessId()

Returns the current process id.

NT_GetCurrentProcessPath()

Returns the path of the executable of the current process.

NT_GetFileAttributes(fileName)

Retrieves the attributes of a file.

NT_GetFileAttributesAsString(fileName)

Retrieves the attributes of a file as a string.

NT_GetFileName(ntfile)

Retrieves the name of a file from its handle.

NT_GetFileOwner(fileName)

Retrieves the file owner of a file.

NT_GetFilePermissionsAsString(fileName)

Retrieves the file permissions as a string.

NT_GetFilePos(ntfile)

Gets the current file position.

NT_GetFileSize(ntfile)

Gets the size of a file.

NT_GetMemoryRegions(pid[, allocated_only, limit])

Retrieves the list of memory regions allocated by the specified process.

NT_GetModule(name)

Retrieves a module from its name.

NT_GetModuleList(pid)

Retrieves the list of modules loaded in the address space of a process.

NT_GetProcessFileName(pid_or_proc)

Retrieves the path of the executable of a specified process.

NT_GetProcessId(proc)

Retrieves the process id for a process handle.

NT_GetProcessList([only_accessible])

Retrieves the current list of processes.

NT_GetSpecialFolder(f)

Retrieves a special system directory.

NT_GetSystemFileHandle(ntfile)

Returns the internal system handle of a file.

NT_GetTempFileName([ext])

Generates a temporary file name.

NT_GetTickCount()

Returns the time passed since system boot in milliseconds.

NT_HasProcessAPI()

Returns True if the process API is available on the current system; otherwise returns False.

NT_HexCharToByte(ch)

Converts a hex character into its corresponding integer value (e.g.: ord('F') -> 15).

NT_IsCurrentModuleDLL()

Returns True if the current module is a shared library; otherwise returns False.

NT_IsRelativePath(path)

Checks whether a path is relative.

NT_KillProcess(pid_or_proc[, timeout])

Terminates a process.

NT_LoadModule(name)

Loads a module from disk.

NT_MakeCString(str)

Escapes a string for C (e.g.: "Hello,\nWorld!" becomes "Hello,\\nWorld!").

NT_MakeFileExecutable(fileName)

Adds executable attributes to the specified file if they’re missing.

NT_MatchFileName(fileNameA, fileNameB)

Compares two paths taking also into account the case sensitivity of the current file system.

NT_MemorySizeToString(size[, prec])

Converts a size in bytes to a string representation using byte, KB, MB or GB units.

NT_NormalizeFileName(fileName)

Replaces any backslash in a file name with a forward slash.

NT_NormalizePath(path)

Replaces any backslash in a path with a forward slash and makes sure that the path ends with a trailing forward slash.

NT_NormalizeToNative(fileOrPath)

Replaces the slashes of an already normalized file name or path with the slashes expected by the current system (i.e., backslashes on Windows and slashes on Linux/macOS).

NT_OpenFile(FileName[, opt])

Opens an existing file.

NT_OpenProcess(pid[, access])

Retrieves a handle to a process.

NT_PathFromFileName(fileName)

Separates a path or file name from its trailing part.

NT_RawPathFromFileName(fileName)

Behaves exactly like NT_PathFromFileName(), except that it retains the slashes of the input.

NT_ReadFile(ntfile, nBytesToRead)

Reads a specified amount of bytes from a file and updates the file position.

NT_ReadProcessMemory(proc, MemoryAddr, …)

Reads the memory of a process.

NT_ResetFixedFileSize(ntfile)

Resets the fixed file size set by calling NT_SetFixedFileSize().

NT_ResolveShortcut(shortcut)

Resolves the target of a link (.lnk) file.

NT_ResolveSymbol(ntmod, symname)

Resolves the symbol of a module.

NT_SetCurrentDirectory(dirName)

Sets the current working directory.

NT_SetFileAutoDelete(ntfile, auto_delete)

Sets the auto-deletion flag for the file.

NT_SetFilePos(ntfile, FileOffset)

Sets the current file position.

NT_SetFileSize(ntfile, NewFileSize)

Changes the size of a file.

NT_SetFixedFileSize(ntfile, FixedFileSize)

Sets the fixed size of a file.

NT_StripFileExt(fileName)

Strips the extension from a file name.

NT_TrashFile(fileName[, showProgress])

Moves a file to the trash.

NT_UnescapeCString(str)

Unescapes a C string (e.g.: "Hello,\\nWorld!" becomes "Hello,\nWorld!").

NT_Win32FileTimeToDateTime(Time)

Converts a Windows FILETIME to NTDateTime.

NT_WriteFile(ntfile, bytes)

Writes the specified bytes to a file.

NT_WriteProcessMemory(proc, MemoryAddr, bytes)

Writes the memory of a process.

appDataDir([opt])

Retrieves the user data directory for the application.

applyFilters(data, str[, waitdlg_or_wo])

Applies the specified filters to an NTContainer and returns the resulting data as an NTContainer.

carbonThemesDir()

Returns the carbon themes directory.

cfsFileSystem()

Maps the computer file system to a CFSInstance instance.

cfsFileSystemEntry(path)

Maps a file system file to a CFSEntry instance.

configDir()

Returns the configuration directory.

createAddressSpace(name[, pt_offs, arg2, arg3])

Creates an address space based on a page-table.

createBlockIOAddressSpace(total_size, page_size)

Creates a block I/O address space.

createContainerFromFile(fname)

Creates an NTContainer object from a file on disk.

createSparseAddressSpace([reference_as, …])

Creates a sparse address space.

enableHook(name, enable)

Enables or disables the specified hook

executeFunctionInMainThread(func[, ud, blocking])

Executes a function from the main thread.

headersDir()

Returns the headers directory.

identifyPossibleFormats(data)

Identifies a list of possible file formats for the input data.

isGuiThread()

Returns True if called from the UI thread; otherwise returns False.

mediaDir()

Returns the media directory.

newContainer([size, reserve_size, max_size])

Creates a new NTContainer object.

ntAlpha(rgb)

Retrieves the alpha color component from an RGBA value.

ntAlphaBlend(src, bkg)

Performs an alpha blend operation on two RGBA values.

ntBlue(rgb)

Retrieves the blue color component from an RGBA value.

ntGreen(rgb)

Retrieves the green color component from an RGBA value.

ntRed(rgb)

Retrieves the read color component from an RGBA value.

ntRgb(r, g, b)

Creates an RGBA value from its red, green and blue color components.

ntRgba(r, g, b, a)

Creates an RGBA value from its red, green, blue and alpha color components.

ntShiftToColor(source, target, fraction)

Shift an RGBA value to another RGBA value.

packageCertificatesDir()

Returns the package certificates directory.

pluginsDir()

Returns the plugins directory.

proAbort(ret[, msg])

Aborts the application with an optional message.

proAddRecentFile(history, fname[, max_list_size])

Adds a recent file name to a specified historical list.

proAddRecentItem(history, item[, max_list_size])

Adds a recent item to a specified historical list.

proApplicationFileName()

Returns the path of the main application.

proArchIsX64()

Returns True if the current architecture is x64; otherwise returns False.

proArchIsX86()

Returns True if the current architecture is x86; otherwise returns False.

proArchName()

Returns the name of the current architecture (e.g., 'x64').

proClearOutput([with_undo])

Clears the output view if available.

proCoreContext()

Returns the global ProCoreContext instance.

proCrashApplication(i)

Crashes the application on purpose.

proDisasmOptions()

Returns the current disassembly options for the text view.

proGetIntPtr(name)

Retrieves an internal pointer.

proGetLine([prompt])

Retrieves an input string either by prompting a dialog box or from the terminal.

proGetRecentItems(history)

Retrieves a specified historical list.

proGetRiskBgColor(risk, bg)

Computes a color based on risk percentage.

proLaunchApplication(app[, args])

Launches an application.

proLaunchThisApplication([args])

Launches the main application.

proPlatformIsLinux()

Returns True if the current platform is Linux; otherwise returns False.

proPlatformIsMacOS()

Returns True if the current platform is macOS; otherwise returns False.

proPlatformIsWindows()

Returns True if the current platform is Windows; otherwise returns False.

proPlatformName()

Returns the name of the current platform (supported values are: 'windows', 'linux' and 'macos').

proPlatformShortName()

Returns the short name of the current platform (supported values are: 'win', 'lin' and 'mac').

proPrint(str)

Prints a message to the output view.

proPrintnl(str)

Prints a message to the output view.

proProcessEvents([ms])

Processes thread loop events.

proSetReturnCode(ret)

Sets the return code for the application.

proTextStream()

Creates a new NTTextBuffer instance with the default disassembly options.

proVersion()

Returns the current version of the application as a string in the shape of major_version.minor_version.build_version.

proVersionBuild()

Returns the build number of the application.

proVersionMajor()

Returns the major version of the application.

proVersionMinor()

Returns the minor version of the application.

pythonAllowIdleProcessing(b)

Enables or disables the idle processing of Python code.

themesDir()

Returns the themes directory.

userCarbonThemesDir([opt])

Retrieves the user carbon themes directory.

userConfigDir([opt])

Retrieves the user configuration directory.

userHeadersDir([opt])

Retrieves the user headers directory.

userMediaDir([opt])

Retrieves the user media directory.

userPDBSymbolsDir([opt])

Retrieves the user PDB symbols directory.

userPackageCertificatesDir([opt])

Retrieves the user package certificates directory.

userPackagesDir([opt])

Retrieves the user packages directory.

userPluginsDir([opt])

Retrieves the user plugins directory.

userPythonPluginsDir([opt])

Retrieves the user Python plugins directory.

userThemesDir([opt])

Retrieves the user themes directory.

Bufferize_BackAndForth: Final[int]

Buffering method for NTBuffer. To use when reading in both directions.

Bufferize_Backwards: Final[int]

Buffering method for NTBuffer. To use when reading backwards.

Bufferize_Forwards: Final[int]

Buffering method for NTBuffer. To use when reading forwards.

Bufferize_Invalid: Final[int]

Buffering method for NTBuffer. Only used for uninitialized instances.

See also NTBuffer.isNull().

class CFFBuffer(object: Pro.Core.CFFObject, offset: int, method: int = Bufferize_Forwards)

Bases: Pro.Core.NTBuffer

This class provides buffered read capability for CFFObject.

Parameters
  • object (CFFObject) – The object to read from.

  • offset (int) – The start offset to read from.

  • method (int) – The buffering method to use. Defaults to Bufferize_Forwards.

See also CFFObject.ToBuffer(), NTBuffer and NTContainerBuffer.

class CFFContainer

Bases: Pro.Core.NTContainer

This is a derived class from NTContainer which can reference data as CFFObject and CFFStruct.

See also NTContainer(), NTContainerBuffer and NTAddressSpace.

Attributes:

FileSystem

Type of data internally referenced by the container.

Object

Type of data internally referenced by the container.

Struct

Type of data internally referenced by the container.

Methods:

setData(data[, own_or_size])

See NTContainer.setData().

toFileSystem()

Returns the internal CFSInstance referenced by the container if the dataType() is FileSystem; otherwise returns an invalid CFSInstance instance.

toObject()

Returns the internal CFFObject referenced by the container if the dataType() is Object; otherwise returns None.

toStruct()

Returns the internal CFFStruct referenced by the container if the dataType() is Struct; otherwise returns an invalid struct.

FileSystem: Final[int]

Type of data internally referenced by the container.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also NTContainer.dataType().

Object: Final[int]

Type of data internally referenced by the container.

See also NTContainer.dataType().

Struct: Final[int]

Type of data internally referenced by the container.

See also NTContainer.dataType().

setData(data: Union[CFFObject, CFFStruct, CFSInstance, NTByteArrayList, NTContainer, NTStringList, NT_FILE, NT_PROCESS, bytes, int, str], own_or_size: Union[bool, int] = True)None

See NTContainer.setData().

toFileSystem()Pro.Core.CFSInstance
Returns

Returns the internal CFSInstance referenced by the container if the dataType() is FileSystem; otherwise returns an invalid CFSInstance instance.

Return type

CFSInstance

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also NTContainer.dataType().

toObject()Pro.Core.CFFObject
Returns

Returns the internal CFFObject referenced by the container if the dataType() is Object; otherwise returns None.

Return type

CFFObject

See also NTContainer.dataType().

toStruct()Pro.Core.CFFStruct
Returns

Returns the internal CFFStruct referenced by the container if the dataType() is Struct; otherwise returns an invalid struct.

Return type

CFFStruct

See also NTContainer.dataType().

class CFFContext

This class is used internally by CFFStruct to store information from members which affect the position and size of other members.

See also CFFStruct.Context() and CFFStruct.SetContext().

Methods:

set(key, val)

Sets a value of the context.

value(key)

Retrieves a value from the context.

set(key: int, val: int)None

Sets a value of the context.

Parameters
  • key (int) – The key of the value to store.

  • val (int) – The value.

See also value().

value(key: int)int

Retrieves a value from the context.

Parameters

key (int) – The key of the value to retrieve.

Returns

Returns the value of the context if present; otherwise returns 0.

Return type

int

See also set().

class CFFDB

This class creates a volatile tree structure that is either stored in memory or on disk.

Indexes for the tree can either be 32-bit (CFFDBIndexSize32) or 64-bit (CFFDBIndexSize64).

Every item in the tree has fixed-size data. If no data size is specified when creating the tree, the fixed data size will be the same as the index size.

This class does not support the removal of items from the tree.

Methods:

AppendChild([parent])

Appends an item.

Children(index)

Returns the number of children for the specified index.

Data(index)

Retrieves the data of an item.

Data32(index)

Retrieves the data of an item as a 32-bit value.

Data64(index)

Retrieves the data of an item as a 64-bit value.

Index(pos[, parent])

Returns the index of an item given its parent and it’s position relative to its siblings.

InsertChild(pos[, parent])

Inserts an item given its parent and position relative to its siblings.

InsertChildren(pos, count[, parent])

Inserts multiple items given their parent and position relative to their siblings.

IsNull()

Returns True if invalid; otherwise returns False.

IsValid()

Returns True if valid; otherwise returns False.

Next(current)

Gets the next item in the tree.

Open([fixed_data_size, idxsize])

Initializes a CFFDB.

Parent(index)

Returns the parent of an item.

Position(index)

Returns the position of an item relative to its siblings.

PrependChild([parent])

Prepends an item.

Previous(current)

Gets the previous item in the tree.

SetData(index, value)

Sets the data of an item.

SetData32(index, value)

Sets the data of an item as a 32-bit value.

SetData64(index, value)

Sets the data of an item as a 64-bit value.

AppendChild(parent: int = 0)int

Appends an item.

Parameters

parent (int) – The parent index of the item to append.

Returns

Returns the index of the added child item if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also PrependChild() and InsertChild().

Children(index: int)int

Returns the number of children for the specified index.

Parameters

index (int) – The index of the item for which to retrieve the number of children.

Returns

Returns the number of children.

Return type

int

See also Position(), Parent() and Index().

Data(index: int)tuple

Retrieves the data of an item.

Parameters

index (int) – The index of the item for which to retrieve the data.

Returns

Returns a tuple containing the retrieved data and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[bytes, bool]

See also SetData(), Data32() and Data64().

Data32(index: int)tuple

Retrieves the data of an item as a 32-bit value.

Parameters

index (int) – The index of the item for which to retrieve the data.

Returns

Returns a tuple containing the retrieved data value and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also SetData32(), Data() and Data64().

Data64(index: int)tuple

Retrieves the data of an item as a 64-bit value.

Parameters

index (int) – The index of the item for which to retrieve the data.

Returns

Returns a tuple containing the retrieved data value and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also SetData64(), Data() and Data32().

Index(pos: int, parent: int = 0)int

Returns the index of an item given its parent and it’s position relative to its siblings.

Parameters
  • pos (int) – The position of the item relative to its siblings.

  • parent (int) – The index of the parent item.

Returns

Returns the requested index if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also Parent(), Position() and Children().

InsertChild(pos: int, parent: int = 0)int

Inserts an item given its parent and position relative to its siblings.

Parameters
  • pos (int) – The position of the item to insert relative to its siblings.

  • parent (int) – The index of the parent item.

Returns

Returns the index of the added child item if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also InsertChildren(), AppendChild() and PrependChild().

InsertChildren(pos: int, count: int, parent: int = 0)bool

Inserts multiple items given their parent and position relative to their siblings.

Parameters
  • pos (int) – The position of the items to insert relative to their siblings.

  • count (int) – The number of items to insert.

  • parent (int) – The index of the parent item.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also InsertChild(), AppendChild() and PrependChild().

IsNull()bool
Returns

Returns True if invalid; otherwise returns False.

Return type

bool

See also IsValid() and Open().

IsValid()bool
Returns

Returns True if valid; otherwise returns False.

Return type

bool

See also IsNull() and Open().

Next(current: int)int

Gets the next item in the tree.

This method enumerates parent and child items.

Parameters

current (int) – The current index.

Returns

Returns the index if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also Previous().

Open(fixed_data_size: int = 0, idxsize: int = CFFDBIndexSize32)bool

Initializes a CFFDB.

Parameters
  • fixed_data_size (int) – The size of the data associated with each item. If 0, it defaults to the index size.

  • idxsize (int) – The index size.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also IsValid() and IsNull().

Parent(index: int)int

Returns the parent of an item.

Parameters

index (int) – The index of the item for which to retrieve the parent.

Returns

Returns the parent index if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also Index(), Position() and Children().

Position(index: int)int

Returns the position of an item relative to its siblings.

Parameters

index (int) – The index of the item for which to retrieve the relative position.

Returns

Returns the position if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also Children(), Index() and Parent().

PrependChild(parent: int = 0)int

Prepends an item.

Parameters

parent (int) – The parent index of the item to prepend.

Returns

Returns the index of the added child item if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also AppendChild() and InsertChild().

Previous(current: int)int

Gets the previous item in the tree.

This method enumerates parent and child items.

Parameters

current (int) – The current index.

Returns

Returns the index if successful; otherwise returns CFFDBInvalidIndex.

Return type

int

See also Next().

SetData(index: int, value: bytes)bool

Sets the data of an item.

The size of value must match the size of the data specified when initializing the tree (See Open()).

Parameters
  • index (int) – The index of the item for which to set the data.

  • value (bytes) – The data to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Data(), SetData32() and SetData64().

SetData32(index: int, value: int)bool

Sets the data of an item as a 32-bit value.

Parameters
  • index (int) – The index of the item for which to set the data.

  • value (int) – The 32-bit value to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Data32(), SetData() and SetData64().

SetData64(index: int, value: int)bool

Sets the data of an item as a 64-bit value.

Parameters
  • index (int) – The index of the item for which to set the data.

  • value (int) – The 64-bit value to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Data64(), SetData() and SetData32().

CFFDBIndexSize32: Final[int]

32-bit index size for CFFDB.

See also CFFDB.

CFFDBIndexSize64: Final[int]

64-bit index size for CFFDB.

See also CFFDB.

CFFDBInvalidIndex: Final[int]

Invalid index for CFFDB.

See also CFFDB.

CFFDBRootIndex: Final[int]

Root index for CFFDB.

See also CFFDB.

class CFFFlags

This class contains flags and options for a member of CFFStruct.

Methods:

Count()

Returns the number of flags and options available.

Description(i)

Retrieves the description of a flag or option.

IsFlag(value, i_or_name)

Checks if a flag or option is set in the input value.

IsNull()

Returns True if the CFFFlags instance is invalid; otherwise returns False.

IsOptionsOnly()

Returns True if the current CFFFlags instance contains only options and not flags; otherwise returns False.

IsValid()

Returns True if the CFFFlags instance is valid; otherwise returns False.

Name(i)

Retrieves the name of a flag or option.

Output(out, value[, opt, sep])

Outputs the flags and options set in the input value to a text stream .

Position(name)

Retrieves the position of a flag or option by its name.

ShortDescription(i)

Retrieves the short description of a flag or option.

Type([i])

Retrieves the type of the CFFFlags instance or the type of one of its members.

Value(i)

Retrieves the value of a flag or option.

ValueDescription(value)

Retrieves the description for the input value.

ValueName(value)

Retrieves the name for the input value.

Count()int
Returns

Returns the number of flags and options available.

Return type

int

See also Output(), Name() and IsFlag().

Description(i: int)str

Retrieves the description of a flag or option.

Parameters

i (int) – The index of the flag or option.

Returns

Returns the description if available; otherwise returns an empty string.

Return type

str

See also ShortDescription(), Name() and Value().

IsFlag(value: int, i_or_name: Union[int, str])bool

Checks if a flag or option is set in the input value.

Parameters
  • value (int) – The input value.

  • i_or_name (Union[int, str]) – The index or name of the flag or option.

Returns

Returns True if the flag or option is set in the input value; otherwise returns False.

Return type

bool

See also Output(), Name() and Value().

IsNull()bool
Returns

Returns True if the CFFFlags instance is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsOptionsOnly()bool
Returns

Returns True if the current CFFFlags instance contains only options and not flags; otherwise returns False.

Return type

bool

See also ValueDescription().

IsValid()bool
Returns

Returns True if the CFFFlags instance is valid; otherwise returns False.

Return type

bool

See also IsNull().

Name(i: int)str

Retrieves the name of a flag or option.

Parameters

i (int) – The index of the flag or option.

Returns

Returns the name of the flag or option if successful; otherwise returns an empty string.

Return type

str

See also Name() and Output().

Output(out: Pro.Core.NTTextStream, value: int, opt: int = 0, sep: Optional[str] = None)None

Outputs the flags and options set in the input value to a text stream .

Parameters
  • out (NTTextStream) – The text stream.

  • value (int) – The input value.

  • opt (int) – The output options. NTFlagOutput_IgnoreUnknown can be specified to ignore unknown flags.

  • sep (Optional[str]) – The separator for the output. Defaults to " | ".

See also NTTextStream and ShortDescription().

Position(name: str)int

Retrieves the position of a flag or option by its name.

Parameters

name (str) – The name of the flag or option.

Returns

Returns the index of the flag or option if successful; otherwise returns -1.

Return type

int

See also Name() and Value().

ShortDescription(i: int)str

Retrieves the short description of a flag or option.

Parameters

i (int) – The index of the flag or option.

Returns

Returns the short description if available; otherwise returns an empty string.

Return type

str

See also Description(), Name() and Value().

Type(i: Optional[int] = None)int

Retrieves the type of the CFFFlags instance or the type of one of its members.

Parameters

i (Optional[int]) – The index of the flag or option.

Returns

Returns the requested type if successful; otherwise returns 0.

Return type

int

See also Name() and Value().

Value(i: int)int

Retrieves the value of a flag or option.

Parameters

i (int) – The index of the flag or option.

Returns

Returns the value if successful; otherwise returns 0.

Return type

int

See also Name() and Description().

ValueDescription(value: int)str

Retrieves the description for the input value.

This method works only if the CFFFlags instance contains only options (See IsOptionsOnly()).

Parameters

value (int) – The input value.

Returns

Returns the value description if successful; otherwise returns an empty string.

Return type

str

See also ValueName(), IsOptionsOnly() and Output().

ValueName(value: int)str

Retrieves the name for the input value.

This method works only if the CFFFlags instance contains only options (See IsOptionsOnly()).

Parameters

value (int) – The input value.

Returns

Returns the value description if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.

See also ValueDescription(), IsOptionsOnly() and Output().

class CFFGetKeyResult

This class is the return value of CFFObject.GetKey().

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also CFFObject.GetKey().

Attributes:

data

The key data.

key_type

The key type (e.g., CFFKT_Pass).

data

The key data.

key_type

The key type (e.g., CFFKT_Pass).

class CFFHeader

This class represents a header.

Headers contain definition of structures and can be loaded from SQLite files or XML strings. The structures can be imported from C/C++ code through the Header Manager or from debug symbols such as PDB files.

Important

Editing is supported only for SQLite-backed headers.

Example:

from Pro.Core import *

xml_header = """<header>

<r id='_IMAGE_DOS_HEADER' type='struct'>
  <f id='e_magic' type='unsigned short'/>
  <f id='e_cblp' type='unsigned short'/>
  <f id='e_cp' type='unsigned short'/>
  <f id='e_crlc' type='unsigned short'/>
  <f id='e_cparhdr' type='unsigned short'/>
  <f id='e_minalloc' type='unsigned short'/>
  <f id='e_maxalloc' type='unsigned short'/>
  <f id='e_ss' type='unsigned short'/>
  <f id='e_sp' type='unsigned short'/>
  <f id='e_csum' type='unsigned short'/>
  <f id='e_ip' type='unsigned short'/>
  <f id='e_cs' type='unsigned short'/>
  <f id='e_lfarlc' type='unsigned short'/>
  <f id='e_ovno' type='unsigned short'/>
  <f id='e_res' type='unsigned short [4]'/>
  <f id='e_oemid' type='unsigned short'/>
  <f id='e_oeminfo' type='unsigned short'/>
  <f id='e_res2' type='unsigned short [10]'/>
  <f id='e_lfanew' type='int'/>
</r>

</header>"""

def printStructure(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    # load header from an XML string
    header = CFFHeader()
    if not header.LoadFromXml(xml_header):
        return
    obj = CFFObject()
    # since CFFObject is not subclassed, the Load method cannot fail
    obj.Load(c)
    # map a structure to a specific offset
    offset = 0
    s = obj.MakeStruct(header, "_IMAGE_DOS_HEADER", offset, CFFSO_VC | CFFSO_Pack1)
    out = NTTextBuffer()
    s.Dump(out)
    print(out.buffer)

See also CFFStruct and CFFObject.

Attributes:

AC_Define

Alias category for a definition.

AC_Enum

Alias category for an enumerator.

AC_Last

Alias category terminator.

AVT_Integer

Alias integer value type.

AVT_Last

Alias terminator value type.

AVT_Real

Alias floating point value type.

AVT_String

Alias string value type.

Methods:

BeginEdit()

Begins an SQLite transaction.

Close()

Clears the current instance.

EndEdit()

Ends an SQLite transaction.

Equals(s)

Checks whether two headers reference the same internal data.

GetACName(category)

Retrieves the alias category name.

GetAVTName(vtype)

Retrieves the alias value type name.

GetAliasCount()

Returns the number of alias in the header.

GetAliasData(i)

Retrieves the data for an alias.

GetSQLiteDB()

Returns the SQLite handle if the header is backed by SQLite internally; otherwise returns None.

GetStructBaseData(i)

Retrieves the basic data of a structure.

GetStructCount()

Returns the number of structures in the header.

GetStructData(i_or_name)

Retrieves the data of a structure.

GetTypeDefCount()

Returns the number of type definitions in the header.

GetTypeDefData(i)

Retrieves the data of a type definition.

InsertAlias(name, category, type, vtype, value)

Inserts or replaces an alias in the header file.

InsertStruct(schema)

Inserts or replaces a structure in the header file.

InsertTypeDef(name, type)

Inserts or replaces a type definition in the header file.

IsModified()

Returns True if the header was modified; otherwise returns False.

IsNull()

Returns True if the header is invalid; otherwise returns False.

IsValid()

Returns True if the header is valid; otherwise returns False.

LoadFromFile(name)

Loads a header file from an SQLite database.

LoadFromXml(xml)

Initializes a header instance from XML data.

SetModified(b)

Sets the modified status for the header file.

AC_Define: Final[int]

Alias category for a definition.

AC_Enum: Final[int]

Alias category for an enumerator.

AC_Last: Final[int]

Alias category terminator.

AVT_Integer: Final[int]

Alias integer value type.

AVT_Last: Final[int]

Alias terminator value type.

AVT_Real: Final[int]

Alias floating point value type.

AVT_String: Final[int]

Alias string value type.

BeginEdit()None

Begins an SQLite transaction.

See also EndEdit() and InsertStruct().

Close()None

Clears the current instance.

See also LoadFromFile() and LoadFromXml().

EndEdit()None

Ends an SQLite transaction.

See also BeginEdit() and InsertStruct().

Equals(s: Pro.Core.CFFHeader)bool

Checks whether two headers reference the same internal data.

Parameters

s (CFFHeader) – The other header.

Returns

Returns True if the two headers reference the same internal data; otherwise returns False.

Return type

bool

static GetACName(category: int)str

Retrieves the alias category name.

Parameters

category (int) – The alias category.

Returns

Returns the name of the alias category if successful; otherwise returns an empty string.

Return type

str

See also GetAVTName().

static GetAVTName(vtype: int)str

Retrieves the alias value type name.

Parameters

vtype (int) – The alias value type.

Returns

Returns the name of the alias value type if successful; otherwise returns an empty string.

Return type

str

See also GetACName().

GetAliasCount()int
Returns

Returns the number of alias in the header.

Return type

int

See also GetAliasData() and InsertAlias().

GetAliasData(i: int)Pro.Core.CFFHeaderAliasData

Retrieves the data for an alias.

Parameters

i (int) – The index of the alias.

Returns

Returns the data of the alias if successful; otherwise returns an empty data structure.

Return type

CFFHeaderAliasData

See also GetAliasCount() and InsertAlias().

GetSQLiteDB()sqlite3
Returns

Returns the SQLite handle if the header is backed by SQLite internally; otherwise returns None.

Return type

sqlite3

GetStructBaseData(i: int)Pro.Core.CFFHeaderStructData

Retrieves the basic data of a structure.

The difference with GetStructData() is that the XML schema of the structure is not retrieved. Therefore, this method is a bit faster.

Parameters

i (int) – The index of the structure.

Returns

Returns the data of the structure if successful; otherwise returns an empty data structure.

Return type

CFFHeaderStructData

See also GetStructData(), GetStructCount() and InsertStruct().

GetStructCount()int
Returns

Returns the number of structures in the header.

Return type

int

See also GetStructData() and InsertStruct().

GetStructData(i_or_name: Union[int, str])Pro.Core.CFFHeaderStructData

Retrieves the data of a structure.

Parameters

i_or_name (Union[int, str]) – The name or the index of the structure.

Returns

Returns the data of the structure if successful; otherwise returns an empty data structure.

Return type

CFFHeaderStructData

See also GetStructBaseData(), GetStructCount() and InsertStruct().

GetTypeDefCount()int
Returns

Returns the number of type definitions in the header.

Return type

int

See also GetTypeDefData() and InsertTypeDef().

GetTypeDefData(i: int)Pro.Core.CFFHeaderTypeDefData

Retrieves the data of a type definition.

Parameters

i (int) – The index of the type definition.

Returns

Returns the data of the type definition if successful; otherwise returns an empty data structure.

Return type

CFFHeaderTypeDefData

See also GetTypeDefCount() and InsertTypeDef().

InsertAlias(name: str, category: int, type: str, vtype: int, value: str)None

Inserts or replaces an alias in the header file.

This method is supported only by SQLite-backed header files.

Parameters
  • name (str) – The name of the alias.

  • category (int) – The category of the alias.

  • type (str) – The type of the alias.

  • vtype (int) – The value type of the alias.

  • value (str) – The value of the alias.

See also GetAliasData() and GetAliasCount().

InsertStruct(schema: str)None

Inserts or replaces a structure in the header file.

This method is supported only by SQLite-backed header files.

Parameters

schema (str) – The XML schema of the structure.

See also GetStructData() and GetStructCount().

InsertTypeDef(name: str, type: str)None

Inserts or replaces a type definition in the header file.

This method is supported only by SQLite-backed header files.

Parameters
  • name (str) – The name of the type definition.

  • type (str) – The type definition.

See also GetTypeDefData() and GetTypeDefCount().

IsModified()bool
Returns

Returns True if the header was modified; otherwise returns False.

Return type

bool

See also SetModified().

IsNull()bool
Returns

Returns True if the header is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the header is valid; otherwise returns False.

Return type

bool

See also IsNull().

LoadFromFile(name: str)bool

Loads a header file from an SQLite database.

Parameters

name (str) – The name of the header file.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also LoadFromXml().

LoadFromXml(xml: Union[Pro.Core.NTXml, str])bool

Initializes a header instance from XML data.

Parameters

xml (Union[NTXml, str]) – Either an XML string or an NTXml instance.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also LoadFromFile().

SetModified(b: bool)None

Sets the modified status for the header file.

Parameters

b (bool) – If True, the header file is marked as modified.

See also IsModified().

class CFFHeaderAliasData

Alias data of a header file.

See also CFFHeader.

Attributes:

category

The category of the alias.

name

The name of the alias.

type

The type of the alias.

value

The value of the alias.

vtype

The value type of the alias.

category

The category of the alias.

name

The name of the alias.

type

The type of the alias.

value

The value of the alias.

vtype

The value type of the alias.

class CFFHeaderStructData

Structure data of a header file.

See also CFFHeader.

Attributes:

name

The name of the structure.

schema

The XML schema of the structure.

type

The type of the structure.

name

The name of the structure.

schema

The XML schema of the structure.

type

The type of the structure.

class CFFHeaderTypeDefData

Type definition data of a header file.

See also CFFHeader.

Attributes:

name

The name of the type definition.

type

The type definition.

name

The name of the type definition.

type

The type definition.

class CFFInitParams(wo: Optional[Pro.Core.NTIWait] = None, options: int = 0)

This class contains the initialization parameters for the CFFObject.Initialize() method.

Parameters
  • wo (NTIWait) – The wait object.

  • options (int) – The parsing options.

Attributes:

DontDecrypt

This flag instructs the parser not to decrypt the file.

StrictParser

This flag instructs the parser to avoid parsing malformed data.

has_wo

A boolean that signals the presence of a wait object that isn’t the default dummy one.

max_children

The maximum number of allowed child entries.

options

Options for the parser (e.g., StrictParser).

wo

The wait object for operation.

DontDecrypt: Final[int]

This flag instructs the parser not to decrypt the file.

Note

The parser might choose to ignore this flag.

See also options.

StrictParser: Final[int]

This flag instructs the parser to avoid parsing malformed data.

Note

The parser might choose to ignore this flag.

See also options.

has_wo

A boolean that signals the presence of a wait object that isn’t the default dummy one.

See also wo.

max_children

The maximum number of allowed child entries.

options

Options for the parser (e.g., StrictParser).

wo

The wait object for operation.

Hint

If a wait object is not specified, a dummy one is provided, so that this field is always valid. To check for the presence of a real wait object use has_wo.

CFFKST_Raw: Final[int]

Key sub-type raw.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

CFFKST_String: Final[int]

Key sub-type string.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

CFFKST_UTF8: Final[int]

Key sub-type utf-8.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

CFFKT_Cert: Final[int]

Key type certificate.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also CFFGetKeyResult.

CFFKT_Invalid: Final[int]

Key type invalid.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also CFFGetKeyResult.

CFFKT_Pass: Final[int]

Key type password.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also CFFGetKeyResult.

class CFFKeyIndex

This class represents a key index.

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also CFFObject.GetKey() and CFFObject.KeyMatch().

CFFN_Base: Final[int]

Base value for standard CFFObject notifications.

See also CFFObject.Notify().

CFFN_Malformed: Final[int]

CFFObject notification for malformed data.

See also CFFObject.Notify().

CFFN_MoreFiles: Final[int]

CFFObject notification for the file limit.

See also CFFObject.Notify().

CFFN_NoDecrypt: Final[int]

CFFObject notification for failed decryption.

See also CFFObject.Notify().

CFFN_NoUnpack: Final[int]

CFFObject notification for failed decompression.

See also CFFObject.Notify().

CFFN_ParsingLimit: Final[int]

CFFObject notification for an internal parsing limit.

See also CFFObject.Notify().

CFFN_Recursive: Final[int]

CFFObject notification for recursion.

See also CFFObject.Notify().

CFFN_UnpackLimit: Final[int]

CFFObject notification for the decompression limit.

See also CFFObject.Notify().

CFFN_UnpackNestLimit: Final[int]

CFFObject notification for the decompression nesting limit.

See also CFFObject.Notify().

class CFFObject

Bases: Pro.Core.CFSInterface

The class from which every format class is derived (ZipObject, PEObject, etc.).

The internal data of a CFFObject is an NTContainer (See Load()).

See also NTContainer, CFFStruct, CFFHeader and CFFBuffer.

Methods:

AdjustSign(type, num)

Makes the input number negative if the last bit is set and the input type is an integer.

Align(AlignConst)

Aligns the object to the specified size.

AppendTo(nStartOffset, nLenght, pDst)

Appends part of this object to a container.

Compare(offset, bytes_or_uSize[, b])

Compares the specified data to the one in the object.

CopyFrom(Src, nDstOffset, nLenght[, …])

Copies data from a container to the object.

CopyTo(nStartOffset, nLenght, pDst[, …])

Copies a part of the object to a container.

DisableRanges()

Disables ranges.

EnableRanges(bits_per_element, granularity)

Creates a range bit mask for the current object.

Fill(offset, c, uSize)

Fills a portion of the object with the specified byte.

GetDefaultEndianness()

Returns the default endianness of the object (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

GetDefaultStructOptions()

Returns the default options for CFFStruct instances created from this object (e.g., CFFSO_Pack1).

GetKey(ki, accepted_keys[, converter])

Retrieves a decryption key.

GetMappingAddress()

Returns the address at which this object is mapped if available; otherwise returns INVALID_STREAM_OFFSET.

GetMemoryUnpackLimit()

Returns the maximum amount of bytes which can be allocated for in-memory decompression algorithms.

GetObjectFormatName()

Returns the file format name of the object if available; otherwise returns an empty string.

GetObjectGenericFormatName()

Returns the generic format name of the object if available; otherwise returns an empty string (e.g., the generic format name of HTML is XML).

GetObjectName()

Returns the name of the object if available; otherwise returns an empty string.

GetObjectTypeName()

Returns the type name of the object if available; otherwise returns an empty string.

GetSize()

Returns the size of the internally referenced container.

GetSpecialData(key[, defval])

Retrieves special data associated to the object.

GetStream()

Returns the internally referenced container.

GetSubStream(offset_or_range[, …])

Retrieves a sub-stream of the internally referenced container.

GetTag()

Returns the tag name set for debugging purposes if present; otherwise returns an empty string.

GetTypeName(Type)

Returns the name of the specified type.

GetTypeNature(Type)

Returns the nature of the specified type.

GetUnpackLimit()

Returns the limit for decompression operations.

GetUnpackNestingLimit()

Returns the nesting limit for decompression operations.

HasFSSupport()

Returns True if file system support is available; otherwise returns False.

Initialize([p])

Provides a generic way to initialize an object.

IsMapped()

Returns True if the object has a mapping address; otherwise returns False.

IsModified()

Returns True if the object was modified; otherwise returns False.

IsNull()

Returns True if the object is uninitialized; otherwise returns False.

IsTypeDynamicPersistent(Type)

Checks whether a type is persistently dynamic.

KeyMatch(ki[, converter])

Marks a key as successfully having being used for decryption.

Load(Stream)

Loads the object data.

LocationDescription(offset)

Provides a description for a specified location.

MakeStruct(header, name, offset[, options])

Returns a CFFStruct instance.

MakeStructArray(header, name, offset, nentries)

Returns an array of CFFStruct.

Modified(b)

Sets the modified status for the object.

NewContainer(size[, reserve_size, max_size])

Creates a new NTContainer object.

Notify(code)

Internally notifies the associated ScanProvider (if any) of a problem.

RangesEnabled()

Returns True if ranges are enabled for the current object; otherwise returns False.

Read(offset, uSize)

Reads data from the object.

ReadNumber(offset, type, endianness, is_signed)

Reads an integer from the object.

ReadUInt16(offset[, endianness])

Reads an unsigned 16-bit integer from the object.

ReadUInt16String(offset, maxlen, endianness)

Reads an utf-16 array from the object.

ReadUInt32(offset[, endianness])

Reads an unsigned 32-bit integer from the object.

ReadUInt32String(offset, maxlen, endianness)

Reads an utf-32 array from the object.

ReadUInt64(offset[, endianness])

Reads an unsigned 64-bit integer from the object.

ReadUInt8(offset)

Reads an unsigned 8-bit integer from the object.

ReadUInt8String(offset, maxlen)

Reads an utf-8 array from the object.

ReplaceStream(NewStream)

Replaces the internal data of the object.

SetDefaultEndianness(nEndiannessType)

Sets the default endianness for the object.

SetDefaultStructOptions(options)

Sets the default options for CFFStruct instances created from this object (e.g., CFFSO_Pack1).

SetFSSupport(b)

Sets the status of file system support.

SetMappingAddress(mapping)

Sets the address at which the object is mapped.

SetMemoryUnpackLimit(limit)

Sets the maximum amount of bytes which can be allocated for in-memory decompression algorithms.

SetObjectFormatName(format)

Sets the file format name of the object.

SetObjectGenericFormatName(format)

Sets the generic format name of the object (e.g., the generic format name of HTML is XML).

SetObjectName(name)

Sets the name of the object.

SetObjectTypeName(type_name)

Sets the type name of the object.

SetRange(offset, size, val)

Sets a range value for the current object.

SetRangeValue(offset, size, val)

Sets a range value for the current object.

SetSize(NewSize)

Resizes the internal data of the object.

SetSpecialData(key, value)

Sets special data associated to the object.

SetTag(t)

Sets the tag name of the object for debugging purposes

SetUnpackLimit(limit)

Sets the limit for decompression operations.

SetUnpackNestingLimit(limit)

Sets the nesting limit for decompression operations.

Shift(uSize)

Appends uSize bytes at the end of the object data and sets them to zero.

ToBuffer(offset[, method])

Returns a CFFBuffer that reads from the object.

ToUInt16(n)

Applies the default endianness of the object to the 16-bit input integer.

ToUInt32(n)

Applies the default endianness of the object to the 32-bit input integer.

ToUInt64(n)

Applies the default endianness of the object to the 64-bit input integer.

ValidRange(offset, Size)

Checks the validity of a range in the context of the object.

Write(offset, bytes_or_uSize[, bytes])

Writes data to the object.

WriteUInt16(offset, n_or_nEndiannessType[, n])

Writes an unsigned 16-bit integer to the object.

WriteUInt32(offset, n_or_nEndiannessType[, n])

Writes an unsigned 32-bit integer to the object.

WriteUInt64(offset, n_or_nEndiannessType[, n])

Writes an unsigned 64-bit integer to the object.

WriteUInt8(offset, n)

Writes an unsigned 8-bit integer to the object.

AdjustSign(type: int, num: int)int

Makes the input number negative if the last bit is set and the input type is an integer.

Parameters
  • type (int) – The input type.

  • num (int) – The input number.

Returns

Returns the adjusted number.

Return type

int

Align(AlignConst: int)bool

Aligns the object to the specified size.

Parameters

AlignConst (int) – The alignment.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.align() and Shift().

AppendTo(nStartOffset: int, nLenght: int, pDst: Pro.Core.NTContainer)bool

Appends part of this object to a container.

Parameters
  • nStartOffset (int) – The offset of the range to append.

  • nLenght (int) – The size of the range to append.

  • pDst (NTContainer) – The destination container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.appendTo().

Compare(offset: int, bytes_or_uSize: Union[bytes, int], b: Optional[int] = None)bool

Compares the specified data to the one in the object.

Parameters
  • offset (int) – The start offset for the comparison.

  • bytes_or_uSize (Union[bytes, int]) – Either the data to compare or the size to compare.

  • b (Optional[int]) – If the previous parameter is the size to compare, this parameter is the byte which to compare the data to.

Returns

Returns True if the data matches; otherwise returns False.

Return type

bool

See also NTContainer.compare().

CopyFrom(Src: Pro.Core.NTContainer, nDstOffset: int, nLenght: int, nSrcStartOffset: int = 0)bool

Copies data from a container to the object.

Parameters
  • Src (NTContainer) – The container from which to copy the data.

  • nDstOffset (int) – The offset at which to copy the data.

  • nLenght (int) – The size of the data to copy.

  • nSrcStartOffset (int) – The offset from which to copy the data in the container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.copyTo().

CopyTo(nStartOffset: int, nLenght: int, pDst: Pro.Core.NTContainer, nDstStartOffset: int = 0)bool

Copies a part of the object to a container.

Parameters
  • nStartOffset (int) – The offset of the data to copy.

  • nLenght (int) – The size of the data to copy.

  • pDst (NTContainer) – The destination container.

  • nDstStartOffset (int) – The offset at which to write the data to in the destination container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.copyTo().

DisableRanges()None

Disables ranges.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also EnableRanges(), RangesEnabled() and SetRange().

EnableRanges(bits_per_element: int, granularity: int, initval: int = 0)None

Creates a range bit mask for the current object.

Parameters
  • bits_per_element (int) – The mask bits for each element.

  • granularity (int) – The granularity of each element.

  • initval (int) – The initial value of each element.

Note

The granularity is might be changed for larger files to meet memory constraints.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also DisableRanges(), RangesEnabled() and SetRange().

Fill(offset: int, c: int, uSize: int)bool

Fills a portion of the object with the specified byte.

Parameters
  • offset (int) – The offset of the range to fill.

  • c (int) – The 8-bit value used for the fill operation.

  • uSize (int) – The size of the range to fill.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.fill().

GetDefaultEndianness()int
Returns

Returns the default endianness of the object (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Return type

int

See also SetDefaultEndianness().

GetDefaultStructOptions()int
Returns

Returns the default options for CFFStruct instances created from this object (e.g., CFFSO_Pack1).

Return type

int

See also SetDefaultStructOptions().

GetKey(ki: Pro.Core.CFFKeyIndex, accepted_keys: int, converter: str = 'utf-8')Pro.Core.CFFGetKeyResult

Retrieves a decryption key.

Example:

ki = CFFKeyIndex()
while True:
    kres = self.GetKey(ki, CFFKT_Pass, "utf-8")
    if kres.key_type == CFFKT_Invalid:
        # if there are no more keys, exit the loop
        break
    if self.Decrypt(kres.data): # our decryption method
        # if the decryption was successful, mark the key and exit the loop
        self.KeyMatch(ki, "utf-8")
        break
Parameters
  • ki (CFFKeyIndex) – The key index.

  • accepted_keys (int) – The mask of accepted key types (e.g., CFFKT_Pass).

  • converter (str) – The converter to use for passwords (e.g., "utf-8", "ascii", "utf-16-le").

Returns

Returns a key result if successful; otherwise CFFGetKeyResult.key_type is CFFKT_Invalid.

Return type

CFFGetKeyResult

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also KeyMatch() and CFFGetKeyResult.

GetMappingAddress()int
Returns

Returns the address at which this object is mapped if available; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also IsMapped() and SetMappingAddress().

GetMemoryUnpackLimit()int
Returns

Returns the maximum amount of bytes which can be allocated for in-memory decompression algorithms.

Return type

int

See also SetMemoryUnpackLimit().

GetObjectFormatName()str
Returns

Returns the file format name of the object if available; otherwise returns an empty string.

Return type

str

See also SetObjectFormatName().

GetObjectGenericFormatName()str
Returns

Returns the generic format name of the object if available; otherwise returns an empty string (e.g., the generic format name of HTML is XML).

Return type

str

See also SetObjectGenericFormatName().

GetObjectName()str
Returns

Returns the name of the object if available; otherwise returns an empty string.

Return type

str

See also SetObjectName().

GetObjectTypeName()str
Returns

Returns the type name of the object if available; otherwise returns an empty string.

Return type

str

See also SetObjectTypeName().

GetSize()int
Returns

Returns the size of the internally referenced container.

Return type

int

See also NTContainer.resize() and SetSize().

GetSpecialData(key: str, defval: Pro.Core.NTContainer = NTContainer())Pro.Core.NTContainer

Retrieves special data associated to the object.

Parameters
  • key (str) – The key of the data to retrieve.

  • defval (NTContainer) – The value to return if key is not present.

Returns

Returns the requested data if present; otherwise returns the default return value.

Return type

NTContainer

See also SetSpecialData().

GetStream()Pro.Core.NTContainer
Returns

Returns the internally referenced container.

Return type

NTContainer

See also GetSubStream(), Load() and ReplaceStream().

GetSubStream(offset_or_range: Union[Pro.Core.NTOffsetRange, int], optimize_for_speed_or_size: Union[bool, int] = INVALID_STREAM_OFFSET, optimize_for_speed: bool = True)Pro.Core.NTContainer

Retrieves a sub-stream of the internally referenced container.

Hint

This is a convenience method. Internally this method calls GetStream() followed by NTContainer.setRange().

Parameters
  • offset_or_range (Union[NTOffsetRange, int]) – Either the offset or the range.

  • optimize_for_speed_or_size (Union[bool, int]) – Either the size or the optimize_for_speed_or_size parameter.

  • optimize_for_speed (bool) – If True, might cause a deep copy under certain circumstances.

Returns

Returns the specified sub-stream.

Return type

NTContainer

Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.

See also GetStream() and NTContainer.setRange().

GetTag()str
Returns

Returns the tag name set for debugging purposes if present; otherwise returns an empty string.

Return type

str

See also SetTag().

GetTypeName(Type: int)str

Returns the name of the specified type.

Parameters

Type (int) – The type for which to return the name.

Returns

Returns the type name if implemented; otherwise returns an empty string.

Return type

str

See also GetTypeNature().

GetTypeNature(Type: int)int

Returns the nature of the specified type.

Parameters

Type (int) – The type for which to return the nature.

Returns

Returns the nature of the type if successful; otherwise returns NATURE_UNKNOWN.

Return type

int

See also NATURE_BYTEARRAY, NATURE_NUMBER, NATURE_REAL and NATURE_STRING.

See also GetTypeName().

GetUnpackLimit()int
Returns

Returns the limit for decompression operations.

Return type

int

See also SetUnpackLimit().

GetUnpackNestingLimit()int
Returns

Returns the nesting limit for decompression operations.

Return type

int

See also SetUnpackNestingLimit().

HasFSSupport()bool
Returns

Returns True if file system support is available; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also SetFSSupport().

Initialize(p: Pro.Core.CFFInitParams = CFFInitParams())bool

Provides a generic way to initialize an object.

Note

This method should be overridden by derived classes.

Parameters

p (CFFInitParams) – The initialization parameters.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.

See also CFFInitParams and Load().

IsMapped()bool
Returns

Returns True if the object has a mapping address; otherwise returns False.

Return type

bool

See also GetMappingAddress() and SetMappingAddress().

IsModified()bool
Returns

Returns True if the object was modified; otherwise returns False.

Return type

bool

See also Modified().

IsNull()bool
Returns

Returns True if the object is uninitialized; otherwise returns False.

Return type

bool

See also Load().

IsTypeDynamicPersistent(Type: int)bool

Checks whether a type is persistently dynamic.

This means that the size of the type is dependent on the underlying data.

Parameters

Type (int) – The type to check.

Returns

Returns True if the type is persistently dynamic; otherwise returns False.

Return type

bool

KeyMatch(ki: Pro.Core.CFFKeyIndex, converter: str = 'utf-8')None

Marks a key as successfully having being used for decryption.

Parameters
  • ki (CFFKeyIndex) – The key index.

  • converter (str) – The converter to use for passwords (e.g., "utf-8", "ascii", "utf-16-le").

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also GetKey() and CFFGetKeyResult.

Load(Stream: Pro.Core.NTContainer)bool

Loads the object data.

Note

In derived built-in classes this method also checks the signature file format.

Parameters

Stream (NTContainer) – The data to load.

Returns

Returns True if the data is accepted; otherwise returns False.

Return type

bool

See also Initialize(), GetStream() and ReplaceStream().

LocationDescription(offset: int)str

Provides a description for a specified location.

Note

This method is currently implemented only for executables such as PE, ELF and MachO.

Parameters

offset (int) – The location offset.

Returns

Returns the description if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.

MakeStruct(header: Pro.Core.CFFHeader, name: str, offset: int, options: Optional[int] = None)Pro.Core.CFFStruct

Returns a CFFStruct instance.

Parameters
  • header (CFFHeader) – The header from which to fetch the definition of the structure.

  • name (str) – The name of the structure to return.

  • offset (int) – The offset at which to load the structure.

  • options (Optional[int]) – The options for the layout of the structure (e.g., CFFSO_Pack1).

Returns

Returns a valid structure if successful; otherwise returns an invalid structure.

Return type

CFFStruct

See also MakeStructArray(), CFFStruct and CFFHeader.

MakeStructArray(header: Pro.Core.CFFHeader, name: str, offset: int, nentries: int, options: Optional[int] = None)Pro.Core.CFFStruct

Returns an array of CFFStruct.

Parameters
  • header (CFFHeader) – The header from which to fetch the definition of the structure.

  • name (str) – The name of the structure to return.

  • offset (int) – The offset at which to load the structure.

  • nentries (int) – The number of array entries.

  • options (Optional[int]) – The options for the layout of the structure (e.g., CFFSO_Pack1).

Returns

Returns a valid structure if successful; otherwise returns an invalid structure.

Return type

CFFStruct

See also MakeStruct(), CFFStruct and CFFHeader.

Modified(b: bool)None

Sets the modified status for the object.

Parameters

b (bool) – If True, marks the object as modified; otherwise marks the object as unmodified.

See also IsModified().

NewContainer(size: int, reserve_size: int = 1024, max_size: int = 0)Pro.Core.NTContainer

Creates a new NTContainer object.

Whether the container will be using an internal memory buffer or a file on disk is decided on the basis of available memory resources at the time of the call.

Parameters
  • size (int) – The initial size of the container.

  • reserve_size (int) – The size to initially reserve for the container.

  • max_size (int) – The maximum size the container will ever reach. This is an optional parameter used to decide whether the container can operate on a memory buffer.

Returns

Returns the created container if successful; otherwise returns an invalid container.

Return type

NTContainer

See also newContainer() and NTContainer.

Notify(code: int)bool

Internally notifies the associated ScanProvider (if any) of a problem.

Parameters

code (int) – The notification code (e.g., CFFN_NoDecrypt).

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ScanProvider.

RangesEnabled()bool
Returns

Returns True if ranges are enabled for the current object; otherwise returns False.

Return type

bool

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also EnableRanges(), DisableRanges() and SetRange().

Read(offset: int, uSize: int)bytes

Reads data from the object.

Parameters
  • offset (int) – The offset of the data to read.

  • uSize (int) – The size of the data to read.

Returns

Returns the data read if successful; otherwise return an empty bytes object.

Return type

bytes

See also Write().

ReadNumber(offset: int, type: int, endianness: int, is_signed: bool)tuple

Reads an integer from the object.

Parameters
  • offset (int) – The offset of the integer to read.

  • type (int) – The type of integer to read.

  • endianness (int) – The endianness of the integer (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

  • is_signed (bool) – If True, the integer is treated as signed.

Returns

Returns a tuple containing the value read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also ReadUInt8(), ReadUInt16(), ReadUInt32() and ReadUInt64().

ReadUInt16(offset: int, endianness: Optional[int] = None)tuple

Reads an unsigned 16-bit integer from the object.

Parameters
Returns

Returns a tuple containing the value read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also WriteUInt16(), ReadUInt8(), ReadUInt32(), ReadUInt64() and ReadNumber().

ReadUInt16String(offset: int, maxlen: int, endianness: int)tuple

Reads an utf-16 array from the object.

The method stops when either a null terminator or maxlen is reached.

Parameters
  • offset (int) – The offset of the array to read.

  • maxlen (int) – The maximum length of the entry in characters.

  • endianness (int) – The endianness of the array (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns a tuple containing the array read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[bytes, bool]

See also ReadUInt8String() and ReadUInt32String().

ReadUInt32(offset: int, endianness: Optional[int] = None)tuple

Reads an unsigned 32-bit integer from the object.

Parameters
Returns

Returns a tuple containing the value read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also WriteUInt32(), ReadUInt8(), ReadUInt16(), ReadUInt64() and ReadNumber().

ReadUInt32String(offset: int, maxlen: int, endianness: int)tuple

Reads an utf-32 array from the object.

The method stops when either a null terminator or maxlen is reached.

Parameters
  • offset (int) – The offset of the array to read.

  • maxlen (int) – The maximum length of the entry in characters.

  • endianness (int) – The endianness of the array (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns a tuple containing the array read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[bytes, bool]

See also ReadUInt8String() and ReadUInt16String().

ReadUInt64(offset: int, endianness: Optional[int] = None)tuple

Reads an unsigned 64-bit integer from the object.

Parameters
Returns

Returns a tuple containing the value read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also WriteUInt64(), ReadUInt8(), ReadUInt16(), ReadUInt32() and ReadNumber().

ReadUInt8(offset: int)tuple

Reads an unsigned 8-bit integer from the object.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple containing the value read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[int, bool]

See also WriteUInt8(), ReadUInt16(), ReadUInt32(), ReadUInt64() and ReadNumber().

ReadUInt8String(offset: int, maxlen: int)tuple

Reads an utf-8 array from the object.

The method stops when either a null terminator or maxlen is reached.

Parameters
  • offset (int) – The offset of the array to read.

  • maxlen (int) – The maximum length of the entry in bytes.

Returns

Returns a tuple containing the array read and a boolean. The boolean value is True if successful; otherwise it is False.

Return type

tuple[bytes, bool]

See also ReadUInt16String() and ReadUInt32String().

ReplaceStream(NewStream: Pro.Core.NTContainer)None

Replaces the internal data of the object.

Parameters

NewStream (NTContainer) – The new internal container for the object.

See also Load() and GetStream().

SetDefaultEndianness(nEndiannessType: int)None

Sets the default endianness for the object.

Parameters

nEndiannessType (int) – The default endianness for the object (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

See also GetDefaultEndianness().

SetDefaultStructOptions(options: int)None

Sets the default options for CFFStruct instances created from this object (e.g., CFFSO_Pack1).

These options are used whenever options are not explicitly specified when calling MakeStruct() or MakeStructArray().

Parameters

options (int) – The default options.

See also GetDefaultStructOptions().

SetFSSupport(b: bool)None

Sets the status of file system support.

Parameters

b (bool) – If True, enables file system support; otherwise disables it.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also HasFSSupport().

SetMappingAddress(mapping: int)None

Sets the address at which the object is mapped.

For instance, the mapping address is set for binaries loaded from a memory image.

Parameters

mapping (int) – The mapping address.

See also GetMappingAddress() and IsMapped().

SetMemoryUnpackLimit(limit: int)None

Sets the maximum amount of bytes which can be allocated for in-memory decompression algorithms.

Parameters

limit (int) – The limit in bytes.

See also GetMemoryUnpackLimit().

SetObjectFormatName(format: str)None

Sets the file format name of the object.

Parameters

format (str) – The file format name.

See also GetObjectFormatName().

SetObjectGenericFormatName(format: str)None

Sets the generic format name of the object (e.g., the generic format name of HTML is XML).

Parameters

format (str) – The generic format name.

See also GetObjectGenericFormatName().

SetObjectName(name: str)None

Sets the name of the object.

Parameters

name (str) – The object name.

See also GetObjectName().

SetObjectTypeName(type_name: str)None

Sets the type name of the object.

Parameters

type_name (str) – The object type name.

See also GetObjectTypeName().

SetRange(offset: int, size: int, val: int)None

Sets a range value for the current object.

Warning

This method is deprecated and should not be confused with NTContainer.setRange(). Use SetRangeValue() instead.

Parameters
  • offset (int) – The offset of the range.

  • size (int) – The size of the range.

  • val (int) – The value of the range (e.g., CFFRange_Used).

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also SetRangeValue(), EnableRanges(), DisableRanges() and RangesEnabled().

SetRangeValue(offset: int, size: int, val: int)None

Sets a range value for the current object.

Parameters
  • offset (int) – The offset of the range.

  • size (int) – The size of the range.

  • val (int) – The value of the range (e.g., CFFRange_Used).

Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.

See also EnableRanges(), DisableRanges() and RangesEnabled().

SetSize(NewSize: int)bool

Resizes the internal data of the object.

Parameters

NewSize (int) – The new size of the data.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.setResizable() and GetSize().

SetSpecialData(key: str, value: Pro.Core.NTContainer)None

Sets special data associated to the object.

Parameters
  • key (str) – The key of the data to set.

  • value (NTContainer) – The data.

See also GetSpecialData().

SetTag(t: str)None

Sets the tag name of the object for debugging purposes

Parameters

t (str) – The tag name.

See also GetTag().

SetUnpackLimit(limit: int)None

Sets the limit for decompression operations.

Parameters

limit (int) – The limit in bytes.

See also GetUnpackLimit().

SetUnpackNestingLimit(limit: int)None

Sets the nesting limit for decompression operations.

Parameters

limit (int) – The limit.

See also GetUnpackNestingLimit().

Shift(uSize: int)bool

Appends uSize bytes at the end of the object data and sets them to zero.

Parameters

uSize (int) – The number of bytes to append.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTContainer.shift() and Align().

ToBuffer(offset: int, method: int = Bufferize_Forwards)Pro.Core.CFFBuffer

Returns a CFFBuffer that reads from the object.

Parameters
  • offset (int) – The start offset.

  • method (int) – The buffering method to use. Defaults to Bufferize_Forwards.

Returns

Returns the CFFBuffer instance.

Return type

CFFBuffer

See also CFFBuffer.

ToUInt16(n: int)int

Applies the default endianness of the object to the 16-bit input integer.

The bytes of the integer will be inverted only if the default endianness of the object doesn’t match the endianness of the current platform.

Parameters

n (int) – The input integer.

Returns

Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.

Return type

int

See also ToUInt32() and ToUInt64().

ToUInt32(n: int)int

Applies the default endianness of the object to the 32-bit input integer.

Parameters

n (int) – The input integer.

Returns

Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.

Return type

int

See also ToUInt16() and ToUInt64().

ToUInt64(n: int)int

Applies the default endianness of the object to the 64-bit input integer.

Parameters

n (int) – The input integer.

Returns

Returns the inverted integer if the the default endianness of the object doesn’t match the endianness of the current platform; otherwise returns the input integer.

Return type

int

See also ToUInt16() and ToUInt32().

ValidRange(offset: int, Size: int)bool

Checks the validity of a range in the context of the object.

Parameters
  • offset (int) – The offset of the range to check.

  • Size (int) – The size of the range to check.

Returns

Returns True if the range is valid; otherwise returns False.

Return type

bool

See also NTContainer.validRange().

Write(offset: int, bytes_or_uSize: Union[bytes, int], bytes: Optional[bytes] = None)bool

Writes data to the object.

Parameters
  • offset (int) – The offset at which to write the data.

  • bytes_or_uSize (Union[bytes, int]) – Either the data to write or the number of bytes to write.

  • bytes (Optional[bytes]) – The data to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Read().

WriteUInt16(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None)bool

Writes an unsigned 16-bit integer to the object.

Parameters
  • offset (int) – The offset at which to write the value.

  • n_or_nEndiannessType (int) – Either the value to write or the endianness (ENDIANNESS_LITTLE or ENDIANNESS_BIG) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.

  • n (Optional[int]) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ReadUInt16(), WriteUInt8(), WriteUInt32() and WriteUInt64().

WriteUInt32(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None)bool

Writes an unsigned 32-bit integer to the object.

Parameters
  • offset (int) – The offset at which to write the value.

  • n_or_nEndiannessType (int) – Either the value to write or the endianness (ENDIANNESS_LITTLE or ENDIANNESS_BIG) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.

  • n (Optional[int]) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ReadUInt32(), WriteUInt8(), WriteUInt16() and WriteUInt64().

WriteUInt64(offset: int, n_or_nEndiannessType: int, n: Optional[int] = None)bool

Writes an unsigned 64-bit integer to the object.

Parameters
  • offset (int) – The offset at which to write the value.

  • n_or_nEndiannessType (int) – Either the value to write or the endianness (ENDIANNESS_LITTLE or ENDIANNESS_BIG) to use when writing the value. If the endianness is not specified, the value is written using the default endianness of the object.

  • n (Optional[int]) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ReadUInt64(), WriteUInt8(), WriteUInt16() and WriteUInt32().

WriteUInt8(offset: int, n: int)bool

Writes an unsigned 8-bit integer to the object.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ReadUInt8(), WriteUInt16(), WriteUInt32() and WriteUInt64().

CFFPtrMaxSize: Final[int]

The maximum supported pointer size.

This value is reserved for future use.

See also CFFObject.

CFFPtrMinSize: Final[int]

The minimum supported pointer size.

This value is reserved for future use.

See also CFFObject.

CFFPtrSize16: Final[int]

16-bit pointer size.

This value is reserved for future use.

See also CFFObject.

CFFPtrSize32: Final[int]

32-bit pointer size.

This value is reserved for future use.

See also CFFObject.

CFFPtrSize64: Final[int]

64-bit pointer size.

This value is reserved for future use.

See also CFFObject.

CFFRange_Custom: Final[int]

Range value.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also CFFObject.SetRange().

CFFRange_Last: Final[int]

Last range value plus one.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

CFFRange_Unknown: Final[int]

Range value (alias of CFFRange_Unreferenced).

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also CFFObject.SetRange().

CFFRange_Unreferenced: Final[int]

Range value.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also CFFObject.SetRange().

CFFRange_Unused: Final[int]

Range value.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also CFFObject.SetRange().

CFFRange_Used: Final[int]

Range value.

Available since Cerbero Suite 6.2 and Cerbero Engine 3.2.

See also CFFObject.SetRange().

CFFSO_Clang: Final[int]

This flag specifies that the structure was generated by the Clang compiler.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_CompilerMask: Final[int]

Compiler mask for the flags of the structure.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndianBig: Final[int]

This flag specifies that the structure is big-endian.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndianDefault: Final[int]

This flag specifies that the structure uses the default endianness.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndianLittle: Final[int]

This flag specifies that the structure is little-endian.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndiannessBig: Final[int]

This flag specifies that the structure is big-endian.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndiannessDefault: Final[int]

This flag specifies that the structure uses the default endianness.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndiannessLittle: Final[int]

This flag specifies that the structure is little-endian.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_EndiannessMask: Final[int]

Endianness mask for the flags of the structure.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_GCC: Final[int]

This flag specifies that the structure was generated by the GCC compiler.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_NoCompiler: Final[int]

This flag specifies that the structure wasn’t generated by a specific compiler.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_NoPlatform: Final[int]

This flag specifies that the structure isn’t bound to specific platform.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pack1: Final[int]

This flag specifies that the structure has an alignment of 1.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pack16: Final[int]

This flag specifies that the structure has an alignment of 16.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pack2: Final[int]

This flag specifies that the structure has an alignment of 2.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pack4: Final[int]

This flag specifies that the structure has an alignment of 4.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pack8: Final[int]

This flag specifies that the structure has an alignment of 8.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_PackMask: Final[int]

Alignment mask for the flags of the structure.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_PackNone: Final[int]

This flag specifies that the structure doesn’t have an alignment.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_PlatformMask: Final[int]

Platform mask for the flags of the structure.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pointer16: Final[int]

This flag specifies that the pointer size of the structure is 16-bits.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pointer32: Final[int]

This flag specifies that the pointer size of the structure is 32-bits.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Pointer64: Final[int]

This flag specifies that the pointer size of the structure is 64-bits.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_PointerDefault: Final[int]

This flag specifies that the pointer size of the structure is the default one for the object.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_PointerMask: Final[int]

Pointer mask for the flags of the structure.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_VC: Final[int]

This flag specifies that the structure was generated by the Visual C++ compiler.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

CFFSO_Windows: Final[int]

This flag specifies that the structure was generated for the Windows platform.

See also CFFObject.SetDefaultStructOptions() and CFFStruct.

class CFFStruct

This class represents a data structure and references a CFFObject instance.

Instances of CFFStruct can be returned from CFFObject derived classes or by using CFFObject.MakeStruct() in combination with an instance of CFFHeader.

Example:

from Pro.Core import *
from Pro.PE import *

def printDOSHeader(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    pe = PEObject()
    if not pe.Load(c):
        return
    out = NTTextBuffer()
    pe.DosHeader().Dump(out) # CFFStruct.Dump
    print(out.buffer)

See also CFFStruct, CFFHeader and CFFObject.MakeStruct().

Methods:

Add(i)

If the current instance represents an array of structures, this method changes which entry is currently referenced.

At(i)

Retrieves a specific structure among an array of structures.

Bytes(i_or_name)

Returns the byte-array representation of a member of the structure.

Context()

Returns the context helper class for the current structure.

Count()

Returns the number of entries in the current array of structures.

Dump(out)

Outputs the members of the structure to a text stream according to their type nature.

Equals(s)

Checks whether two structures reference the same internal data.

Fill(c_or_i_or_name[, c])

Fills the entire structure or a member of it with a specified 8-bit value.

Flags(i_or_name)

Returns the flags for a member of the structure.

GetOffset()

Returns the start offset of the structure.

HasDynamicSize()

Checks whether the structure contains members whose size depends upon the underlying data.

HasFlags([i_or_name])

Checks whether at least one member or a specific member of the structure has flags associated with it.

IsArray()

Returns True if the current instance represents an array of structures; otherwise returns False.

IsFixed()

Returns True if the structures has a fixed size; otherwise returns False.

IsNull()

Returns True if the structure is invalid; otherwise returns False.

IsValid()

Returns True if the structure is valid; otherwise returns False.

LongestMemberName()

Returns the length of the longer member name of the structure.

MakeSingle()

Converts an array of structure into a single structure.

MemberCount()

Returns the number of members in the structure.

MemberName(i)

Retrieves the name of a member of the structure by its index.

MemberNature(i_or_name)

Retrieves the type nature of a member of the structure.

MemberOffset(i_or_name)

Retrieves the offset of a member of the structure.

MemberPosition(name)

Retrieves the index of a member of the structure.

MemberSize(i_or_name)

Retrieves the size of a member of the structure.

MemberType(i)

Retrieves the type of a member of the structure.

MemberTypeName(i)

Retrieves the type name of a member of the structure.

MembersWithFlags()

Returns a list of indexes of those members in the structure which have flags.

Num(i_or_name)

Returns the numeric representation of a member of the structure.

Object()

Returns the internally referenced object.

Offset()

Returns the start offset of the structure.

Raw(i_or_name)

Returns the raw data of a member of the structure.

Set(i_or_name, bytes_or_number_or_str)

Sets a member of the structure.

SetContext(ctx)

Sets the context helper class for the current structure.

SetCount(n)

Sets the number of entries in the array of structures.

SetMemberCount(n)

Sets the number of members that the structure has.

SetObject(obj)

Sets the internally referenced object.

SetOffset(o)

Sets the start offset of the structure.

SetRaw(i_or_name, bytes)

Sets the raw data of a member of the structure.

Size()

Returns the size of the structure.

Str(i_or_name[, align_nums])

Returns the string representation of a member of the structure.

StructName()

Returns the name of the structure.

SubStruct(i_or_name)

Retrieves a sub-structure of the current structure.

TotalSize()

Returns the total size occupied by the array of structures.

Uns(i_or_name)

Returns the unsigned integer representation of a member of the structure.

Zero([i_or_name])

Fills the entire structure or a member of it with zero.

iterator()

Returns an iterator for an array of structures.

Add(i: int)Pro.Core.CFFStruct

If the current instance represents an array of structures, this method changes which entry is currently referenced.

Parameters

i (int) – The iterator can be increased by a negative amount.

Returns

Returns the requested structure if within the limit of available entries; otherwise returns an invalid structure.

Return type

CFFStruct

See also At(), Count() and iterator().

At(i: int)Pro.Core.CFFStruct

Retrieves a specific structure among an array of structures.

Parameters

i (int) – The index of the structure to retrieve.

Returns

Returns the requested structure if within the limit of available entries; otherwise returns an invalid structure.

Return type

CFFStruct

See also Count(), At() and iterator().

Bytes(i_or_name: Union[int, str])bytes

Returns the byte-array representation of a member of the structure.

This method automatically handles the endianness of the requested data.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the requested data if successful; otherwise returns an empty bytes object.

Return type

bytes

See also Set(), Str(), Num() and Raw().

Context()Pro.Core.CFFContext
Returns

Returns the context helper class for the current structure.

Return type

CFFContext

See also SetContext().

Count()int
Returns

Returns the number of entries in the current array of structures.

Return type

int

See also SetCount(), At() and iterator().

Dump(out: Pro.Core.NTTextStream)bool

Outputs the members of the structure to a text stream according to their type nature.

Parameters

out (NTTextStream) – The text stream for the output.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NTTextStream.

Equals(s: Pro.Core.CFFStruct)bool

Checks whether two structures reference the same internal data.

Parameters

s (CFFStruct) – The other structure.

Returns

Returns True if the structure reference the same internal data; otherwise returns False.

Return type

bool

Fill(c_or_i_or_name: Union[int, str], c: Optional[int] = None)bool

Fills the entire structure or a member of it with a specified 8-bit value.

Parameters
  • c_or_i_or_name (Union[int, str]) – Either the 8-bit value used to fill the structure or the index or name of the member of the structure to fill.

  • c (Optional[int]) – The 8-bit value used to fill the member of the structure.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Zero().

Flags(i_or_name: Union[int, str])Pro.Core.CFFFlags

Returns the flags for a member of the structure.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns a valid CFFFlags instance if successful; otherwise returns an invalid CFFFlags instance.

Return type

CFFFlags

See also HasFlags(), MembersWithFlags() and CFFFlags.

GetOffset()int
Returns

Returns the start offset of the structure.

Return type

int

See also Offset(), SetOffset() and Size().

HasDynamicSize()bool

Checks whether the structure contains members whose size depends upon the underlying data.

Note

In an array of dynamic structures every entry can potentially have a different size than the other entries. Knowing whether or not a structure is dynamic is important for optimization purposes: skipping multiple entries in an array of dynamic structures requires to read the data for each entry to perform the calculation (e.g., Add()).

Returns

Returns True if the structure contains members whose size depends upon the underlying data; otherwise returns False.

Return type

bool

See also Add() and At().

HasFlags(i_or_name: Optional[Union[int, str]] = None)bool

Checks whether at least one member or a specific member of the structure has flags associated with it.

Parameters

i_or_name (Optional[Union[int, str]]) – The index or name of the member of the structure.

Returns

Returns True if flags are available; otherwise returns False.

Return type

bool

See also Flags(), MembersWithFlags() and CFFFlags.

IsArray()bool
Returns

Returns True if the current instance represents an array of structures; otherwise returns False.

Return type

bool

See also Count() and MakeSingle().

IsFixed()bool
Returns

Returns True if the structures has a fixed size; otherwise returns False.

Return type

bool

IsNull()bool
Returns

Returns True if the structure is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the structure is valid; otherwise returns False.

Return type

bool

See also IsNull().

LongestMemberName()int
Returns

Returns the length of the longer member name of the structure.

Return type

int

See also MemberName().

MakeSingle()Pro.Core.CFFStruct

Converts an array of structure into a single structure.

Returns

Returns the currently referenced structure in the array as a single structure.

Return type

CFFStruct

See also IsArray() and Count().

MemberCount()int
Returns

Returns the number of members in the structure.

Return type

int

See also SetMemberCount().

MemberName(i: int)str

Retrieves the name of a member of the structure by its index.

Parameters

i (int) – The index of the member of the structure.

Returns

Returns the member name if successful; otherwise returns an empty string.

Return type

str

See also MemberPosition(), MemberOffset() and MemberSize().

MemberNature(i_or_name: Union[int, str])int

Retrieves the type nature of a member of the structure.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the type nature if successful; otherwise returns NATURE_UNKNOWN.

Return type

int

See also MemberName(), MemberOffset() and MemberSize().

MemberOffset(i_or_name: Union[int, str])int

Retrieves the offset of a member of the structure.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the offset if successful; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also MemberName(), MemberSize() and MemberPosition().

MemberPosition(name: str)int

Retrieves the index of a member of the structure.

Parameters

name (str) – The name of the member of the structure.

Returns

Returns the index if successful; otherwise returns -1.

Return type

int

See also MemberName(), MemberOffset() and MemberSize().

MemberSize(i_or_name: Union[int, str])int

Retrieves the size of a member of the structure.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the size if successful; otherwise returns 0.

Return type

int

See also MemberOffset(), MemberName() and MemberPosition().

MemberType(i: int)int

Retrieves the type of a member of the structure.

Parameters

i (int) – The index or name of the member of the structure.

Returns

Returns the type if successful; otherwise returns 0xFFFFFFFFFFFFFFFF.

Return type

int

See also MemberTypeName(), MemberName(), MemberOffset() and MemberSize().

MemberTypeName(i: int)str

Retrieves the type name of a member of the structure.

Parameters

i (int) – The index or name of the member of the structure.

Returns

Returns the type name if successful; otherwise returns an empty string.

Return type

str

See also MemberType(), MemberName(), MemberOffset() and MemberSize().

MembersWithFlags()Pro.Core.NTIntList
Returns

Returns a list of indexes of those members in the structure which have flags.

Return type

NTIntList

See also HasFlags(), Flags() and CFFFlags.

Num(i_or_name: Union[int, str])int

Returns the numeric representation of a member of the structure.

Important

If the member to retrieve is an unsigned integer which doesn’t exceed 64 bit in size, then the slightly faster Uns() method can be used instead of Num().

This method automatically handles the endianness of the requested data.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the numeric value if successful; otherwise returns 0.

Return type

int

See also Set(), Uns(), Str(), Bytes() and Raw().

Object()Pro.Core.CFFObject
Returns

Returns the internally referenced object.

Return type

CFFObject

See also SetObject().

Offset()int
Returns

Returns the start offset of the structure.

Return type

int

See also GetOffset(), SetOffset() and Size().

Raw(i_or_name: Union[int, str])bytes

Returns the raw data of a member of the structure.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the requested data if successful; otherwise returns an empty bytes object.

Return type

bytes

See also SetRaw().

Set(i_or_name: Union[int, str], bytes_or_number_or_str: Union[bytes, int, str])bool

Sets a member of the structure.

This method automatically handles the endianness of the data to set.

Parameters
  • i_or_name (Union[int, str]) – The index or name of the member of the structure.

  • bytes_or_number_or_str (Union[bytes, int, str]) – The data to set. This value is automatically converted to the raw data.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Str(), Num(), Bytes() and Raw().

SetContext(ctx: Pro.Core.CFFContext)None

Sets the context helper class for the current structure.

Parameters

ctx (CFFContext) – The context helper class to set.

See also Context().

SetCount(n: int)None

Sets the number of entries in the array of structures.

Parameters

n (int) – The number of entries to set.

See also Count(), At() and iterator().

SetMemberCount(n: int)None

Sets the number of members that the structure has.

Note

This method can only reduce the number of members initially available in the structure and it’s used to adapt structures which have different number of members depending on a version or size field.

Parameters

n (int) – The number of members to set.

See also MemberCount().

SetObject(obj: Pro.Core.CFFObject)None

Sets the internally referenced object.

Parameters

obj (CFFObject) – The object to set.

See also Object().

SetOffset(o: int)None

Sets the start offset of the structure.

Parameters

o (int) – The start offset to set.

See also Offset(), GetOffset() and Size().

SetRaw(i_or_name: Union[int, str], bytes: bytes)bool

Sets the raw data of a member of the structure.

Parameters
  • i_or_name (Union[int, str]) – The index or name of the member of the structure.

  • bytes (bytes) – The raw data to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Raw().

Size()int
Returns

Returns the size of the structure.

Return type

int

See also TotalSize(), Offset() and GetOffset().

Str(i_or_name: Union[int, str], align_nums: bool = False)str

Returns the string representation of a member of the structure.

This method automatically handles the endianness of the requested data.

Parameters
  • i_or_name (Union[int, str]) – The index or name of the member of the structure.

  • align_nums (bool) – If True, aligns numbers using zero-padding.

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

See also Set(), Num(), Bytes() and Raw().

StructName()str
Returns

Returns the name of the structure.

Return type

str

SubStruct(i_or_name: Union[int, str])Pro.Core.CFFStruct

Retrieves a sub-structure of the current structure.

This method is available only to fixed size structures.

Parameters

i_or_name (Union[int, str]) – The name or index of the sub-structure to retrieve.

Returns

Returns the sub-structure if successful; otherwise returns an invalid structure.

Return type

CFFStruct

See also IsFixed().

TotalSize()int
Returns

Returns the total size occupied by the array of structures.

Return type

int

See also Size(), Offset() and GetOffset().

Uns(i_or_name: Union[int, str])int

Returns the unsigned integer representation of a member of the structure.

Important

The maximum supported size for unsigned integers returned by this method is 64 bits. To retrieve larger or negative integers Num() must be used. The difference between the two methods is that Uns() is slightly faster than Num().

This method automatically handles the endianness of the requested data.

Parameters

i_or_name (Union[int, str]) – The index or name of the member of the structure.

Returns

Returns the numeric value if successful; otherwise returns 0.

Return type

int

Available since Cerbero Suite 5.0 and Cerbero Engine 2.0.

See also Set(), Num(), Str(), Bytes() and Raw().

Zero(i_or_name: Optional[Union[int, str]] = None)bool

Fills the entire structure or a member of it with zero.

Parameters

i_or_name (Optional[Union[int, str]]) – The index or name of the member of the structure.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also Fill().

iterator()Pro.Core.CFFStructIt
Returns

Returns an iterator for an array of structures.

Return type

CFFStructIt

See also CFFStructIt.

class CFFStructIt(s: Pro.Core.CFFStruct)

Iterator for an array of CFFStruct structures.

Parameters

s (CFFStruct) – The array of structures to iterate over.

See also CFFStruct.iterator() and CFFStruct.

Methods:

HasNext()

Returns True if there is an entry after the current one; otherwise returns False.

Next()

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.

hasNext()

Returns True if there is an entry after the current one; otherwise returns False.

next()

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.

HasNext()bool
Returns

Returns True if there is an entry after the current one; otherwise returns False.

Return type

bool

See also Next(), hasNext(), next() and CFFStruct.

Next()Pro.Core.CFFStruct
Returns

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.

Return type

CFFStruct

See also HasNext(), hasNext(), next() and CFFStruct.

hasNext()bool
Returns

Returns True if there is an entry after the current one; otherwise returns False.

Return type

bool

See also next() and CFFStruct.

next()Pro.Core.CFFStruct
Returns

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid structure.

Return type

CFFStruct

See also hasNext() and CFFStruct.

class CFFStructList

List of CFFStruct elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.CFFStruct)None

Inserts value at the end of the list.

Parameters

value (CFFStruct) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.CFFStruct

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

CFFStruct

clear()None

Removes all items from the list.

contains(value: Pro.Core.CFFStruct)bool

Checks the presence of an element in the list.

Parameters

value (CFFStruct) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.CFFStruct)int

Returns the number of occurrences of value in the list.

Parameters

value (CFFStruct) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.CFFStruct, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (CFFStruct) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.CFFStruct)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (CFFStruct) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.CFFStructListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

CFFStructListIt

removeAll(value: Pro.Core.CFFStruct)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (CFFStruct) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.CFFStruct

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

CFFStruct

See also removeAt().

class CFFStructListIt(obj: Pro.Core.CFFStructList)

Iterator class for CFFStructList.

Parameters

obj (CFFStructList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.CFFStruct
Returns

Returns the next item and advances the iterator by one position.

Return type

CFFStruct

See also hasNext() and previous().

previous()Pro.Core.CFFStruct
Returns

Returns the previous item and moves the iterator back by one position.

Return type

CFFStruct

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

CFF_ARRAY_NULL_TERMINATED: Final[int]

If specified, makes an array of structure be null-terminated.

See also CFFObject.MakeStructArray().

class CFSEntry(iface: Optional[Pro.Core.CFSEntryInterface] = None)

Wrapper class for a CFSEntryInterface instance.

Parameters

iface (Optional[CFSEntryInterface]) – The CFSEntryInterface instance to be wrapped.

Important

When wrapping an instance of CFSEntryInterface, it is necessary to call __disown__() on it to avoid Python freeing the allocated object. The object will be freed automatically by the CFSEntry wrapper.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSEntryInterface.

Attributes:

AccessTime

Access time type.

CreationTime

Creation time type.

Directory

Directory entry type.

Drive

Drive entry type.

FastData

Fast data flag.

File

File entry type.

Invalid

Invalid entry type.

ModificationTime

Modification time type.

Methods:

AddProperty(name, value[, offset])

Adds a property to the entry.

Data([wo])

Retrieves the data associated with the entry.

DataOffset()

Returns the offset of the entry data if available; otherwise returns INVALID_STREAM_OFFSET.

DataSize()

Returns the size of the entry data if available; otherwise returns 0.

Flags()

Returns the flags of the entry (e.g., FastData).

HasData()

Returns True if entry data is available; otherwise returns False.

HasDataSize()

Returns True if entry data size is available; otherwise returns False.

IsNull()

Returns True if the entry is invalid; otherwise returns False.

IsValid()

Returns True if the entry is valid; otherwise returns False.

Name()

Returns the entry name if available; otherwise returns an empty string.

Path()

Returns the full path of the entry, including the file name.

Property(name)

Retrieves a property of the entry.

PropertyCount()

Returns the number of properties available.

PropertyNames()

Returns the list of property names.

PropertyOffset(name)

Retrieves the offset of a property.

SetData(data)

Sets the data of the entry.

SetDataOffset(offset)

Sets the offset of the entry data.

SetDataSize(size)

Sets the size of the entry data.

SetFlags(flags)

Sets the flags of the entry.

SetName(name)

Sets the name of the entry.

SetPath(path)

Sets the full path of the entry.

SetTime(ttype, t)

Sets a specific file time of the entry.

SetType(type)

Sets the type of the entry.

Time(ttype)

Retrieves a specific file time of the entry.

ToXML([sort, include_data])

Converts the entry to an XML string.

Type()

Returns the entry type (e.g., Directory).

AccessTime: Final[int]

Access time type.

See also Time() and SetTime().

AddProperty(name: str, value: Optional[Union[int, float, bool, bytes, str]], offset: int = INVALID_STREAM_OFFSET)None

Adds a property to the entry.

Parameters
  • name (str) – The name of the property.

  • value (BasicType) – The value of the property.

  • offset (int) – The optional offset of the property.

See also Property(), PropertyCount() and PropertyNames().

CreationTime: Final[int]

Creation time type.

See also Time() and SetTime().

Data(wo: Optional[Pro.Core.NTIWait] = None)Pro.Core.NTContainer

Retrieves the data associated with the entry.

Parameters

wo (NTIWait) – The optional wait operation for the retrieval of the data.

Returns

Returns a valid NTContainer if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

See also SetData(), DataOffset(), DataSize() and HasData().

DataOffset()int
Returns

Returns the offset of the entry data if available; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also Data(), SetData(), DataSize() and HasData().

DataSize()int
Returns

Returns the size of the entry data if available; otherwise returns 0.

Return type

int

Note

The size of the entry data is returned only when set previously using SetDataSize(). This method will not internally call Data() to return the size of the data.

See also HasDataSize(), SetDataSize(), DataOffset(), Data() and SetData().

Directory: Final[int]

Directory entry type.

See also Type() and SetType().

Drive: Final[int]

Drive entry type.

FastData: Final[int]

Fast data flag.

File: Final[int]

File entry type.

See also Type() and SetType().

Flags()int
Returns

Returns the flags of the entry (e.g., FastData).

Return type

int

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also SetFlags().

HasData()bool
Returns

Returns True if entry data is available; otherwise returns False.

Return type

bool

See also Data(), SetData(), DataOffset() and DataSize().

HasDataSize()bool
Returns

Returns True if entry data size is available; otherwise returns False.

Return type

bool

See also DataSize(), DataOffset(), Data(), SetData() and HasData().

Invalid: Final[int]

Invalid entry type.

See also Type() and SetType().

IsNull()bool
Returns

Returns True if the entry is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the entry is valid; otherwise returns False.

Return type

bool

See also IsNull().

ModificationTime: Final[int]

Modification time type.

See also Time() and SetTime().

Name()str
Returns

Returns the entry name if available; otherwise returns an empty string.

Return type

str

See also SetName().

Path()str
Returns

Returns the full path of the entry, including the file name.

Return type

str

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also SetPath().

Property(name: str)Optional[Union[int, float, bool, bytes, str]]

Retrieves a property of the entry.

Parameters

name (str) – The name of the property to retrieve.

Returns

Returns the property value if successful; otherwise returns None.

Return type

BasicType

See also PropertyCount(), PropertyNames(), AddProperty() and PropertyOffset().

PropertyCount()int
Returns

Returns the number of properties available.

Return type

int

See also Property(), PropertyNames(), AddProperty() and PropertyOffset().

PropertyNames()Pro.Core.NTStringList
Returns

Returns the list of property names.

Return type

NTStringList

See also Property(), PropertyCount(), AddProperty() and PropertyOffset().

PropertyOffset(name: str)int

Retrieves the offset of a property.

Parameters

name (str) – The name of the property.

Returns

Returns the of offset of the property if available; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also Property(), PropertyCount(), PropertyNames() and AddProperty().

SetData(data: Pro.Core.NTContainer)None

Sets the data of the entry.

Parameters

data (NTContainer) – The data of the entry.

See also Data(), DataOffset(), DataSize() and HasData().

SetDataOffset(offset: int)None

Sets the offset of the entry data.

Parameters

offset (int) – The offset of the entry data.

See also DataOffset(), DataSize(), Data() and SetData().

SetDataSize(size: int)None

Sets the size of the entry data.

Parameters

size (int) – The size of the entry data.

See also DataOffset(), DataSize(), Data() and SetData().

SetFlags(flags: int)None

Sets the flags of the entry.

Parameters

flags (int) – The flags of the entry (e.g., FastData).

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also Flags().

SetName(name: str)None

Sets the name of the entry.

Parameters

name (str) – The name of the entry.

See also Name().

SetPath(path: str)None

Sets the full path of the entry.

Parameters

path (str) – The full path of the entry, including the file name.

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also Path().

SetTime(ttype: int, t: Pro.Core.NTDateTime)None

Sets a specific file time of the entry.

Parameters

See also Time().

SetType(type: int)None

Sets the type of the entry.

Parameters

type (int) – The type to set (e.g., Directory).

See also Type().

Time(ttype: int)Pro.Core.NTDateTime

Retrieves a specific file time of the entry.

Parameters

ttype (int) – The type of time to retrieve (e.g., ModificationTime).

Returns

Returns a valid NTDateTime if successful; otherwise returns an invalid NTDateTime instance.

Return type

NTDateTime

See also SetTime().

ToXML(sort: bool = True, include_data: bool = False)str

Converts the entry to an XML string.

Parameters
  • sort (bool) – If True, sorts the properties alphabetically.

  • include_data (bool) – If True, includes the data of the entry encoded as base64.

Returns

Returns the XML string if successful; otherwise returns an empty string.

Return type

str

Type()int
Returns

Returns the entry type (e.g., Directory).

Return type

int

See also SetType().

class CFSEntryInterface

This class represents a single file system entry.

Its method should never be called directly, but through CFSEntry.

Hint

All methods used to retrieve data in this class can be overridden. Alternatively, set methods can be used to set the data and thus removing the need to create a derived class that overrides get methods. The two approaches can also be combined. This design leaves to the developer the choice of how to use the interface.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSEntry.

Methods:

AddProperty(name, value[, offset])

Adds a property to the entry.

Data([wo])

Retrieves the data associated with the entry.

DataOffset()

Returns the offset of the entry data if available; otherwise returns INVALID_STREAM_OFFSET.

DataSize()

Returns the size of the entry data if available; otherwise returns 0.

Flags()

Returns the flags of the entry (e.g., FastData).

HasData()

Returns True if entry data is available; otherwise returns False.

HasDataSize()

Returns True if entry data size is available; otherwise returns False.

Name()

Returns the entry name if available; otherwise returns an empty string.

Path()

Returns the full path of the entry, including the file name.

Property(name)

Retrieves a property of the entry.

PropertyCount()

Returns the number of properties available.

PropertyNames()

Returns the list of property names.

PropertyOffset(name)

Retrieves the offset of a property.

SetData(data)

Sets the data of the entry.

SetDataOffset(offset)

Sets the offset of the entry data.

SetDataSize(size)

Sets the size of the entry data.

SetFlags(flags)

Sets the flags of the entry.

SetName(name)

Sets the name of the entry.

SetPath(path)

Sets the full path of the entry.

SetTime(ttype, t)

Sets a specific file time of the entry.

SetType(type)

Sets the type of the entry.

Time(ttype)

Retrieves a specific file time of the entry.

Type()

Returns the entry type (e.g., Directory).

AddProperty(name: str, value: Optional[Union[int, float, bool, bytes, str]], offset: int = INVALID_STREAM_OFFSET)None

Adds a property to the entry.

Parameters
  • name (str) – The name of the property.

  • value (BasicType) – The value of the property.

  • offset (int) – The optional offset of the property.

See also Property(), PropertyCount() and PropertyNames().

Data(wo: Optional[Pro.Core.NTIWait] = None)Pro.Core.NTContainer

Retrieves the data associated with the entry.

Parameters

wo (NTIWait) – The optional wait operation for the retrieval of the data.

Returns

Returns a valid NTContainer if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

See also SetData(), DataOffset(), DataSize() and HasData().

DataOffset()int
Returns

Returns the offset of the entry data if available; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also Data(), SetData(), DataSize() and HasData().

DataSize()int
Returns

Returns the size of the entry data if available; otherwise returns 0.

Return type

int

Note

The size of the entry data is returned only when set previously using SetDataSize(). This method will not internally call Data() to return the size of the data.

See also HasDataSize(), SetDataSize(), DataOffset(), Data() and SetData().

Flags()int
Returns

Returns the flags of the entry (e.g., FastData).

Return type

int

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also SetFlags().

HasData()bool
Returns

Returns True if entry data is available; otherwise returns False.

Return type

bool

See also Data(), SetData(), DataOffset() and DataSize().

HasDataSize()bool
Returns

Returns True if entry data size is available; otherwise returns False.

Return type

bool

See also DataSize(), DataOffset(), Data(), SetData() and HasData().

Name()str
Returns

Returns the entry name if available; otherwise returns an empty string.

Return type

str

See also SetName().

Path()str
Returns

Returns the full path of the entry, including the file name.

Return type

str

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also SetPath().

Property(name: str)Optional[Union[int, float, bool, bytes, str]]

Retrieves a property of the entry.

Parameters

name (str) – The name of the property to retrieve.

Returns

Returns the property value if successful; otherwise returns None.

Return type

BasicType

See also PropertyCount(), PropertyNames(), AddProperty() and PropertyOffset().

PropertyCount()int
Returns

Returns the number of properties available.

Return type

int

See also Property(), PropertyNames(), AddProperty() and PropertyOffset().

PropertyNames()Pro.Core.NTStringList
Returns

Returns the list of property names.

Return type

NTStringList

See also Property(), PropertyCount(), AddProperty() and PropertyOffset().

PropertyOffset(name: str)int

Retrieves the offset of a property.

Parameters

name (str) – The name of the property.

Returns

Returns the of offset of the property if available; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also Property(), PropertyCount(), PropertyNames() and AddProperty().

SetData(data: Pro.Core.NTContainer)None

Sets the data of the entry.

Parameters

data (NTContainer) – The data of the entry.

See also Data(), DataOffset(), DataSize() and HasData().

SetDataOffset(offset: int)None

Sets the offset of the entry data.

Parameters

offset (int) – The offset of the entry data.

See also DataOffset(), DataSize(), Data() and SetData().

SetDataSize(size: int)None

Sets the size of the entry data.

Parameters

size (int) – The size of the entry data.

See also DataOffset(), DataSize(), Data() and SetData().

SetFlags(flags: int)None

Sets the flags of the entry.

Parameters

flags (int) – The flags of the entry (e.g., FastData).

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also Flags().

SetName(name: str)None

Sets the name of the entry.

Parameters

name (str) – The name of the entry.

See also Name().

SetPath(path: str)None

Sets the full path of the entry.

Parameters

path (str) – The full path of the entry, including the file name.

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also Path().

SetTime(ttype: int, t: Pro.Core.NTDateTime)None

Sets a specific file time of the entry.

Parameters

See also Time().

SetType(type: int)None

Sets the type of the entry.

Parameters

type (int) – The type to set (e.g., Directory).

See also Type().

Time(ttype: int)Pro.Core.NTDateTime

Retrieves a specific file time of the entry.

Parameters

ttype (int) – The type of time to retrieve (e.g., CFSEntry.ModificationTime).

Returns

Returns a valid NTDateTime if successful; otherwise returns an invalid NTDateTime instance.

Return type

NTDateTime

See also SetTime().

Type()int
Returns

Returns the entry type (e.g., Directory).

Return type

int

See also SetType().

class CFSInstance(iface: Optional[Pro.Core.CFSInterface] = None)

Wrapper class for a CFSInterface instance.

Parameters

iface (Optional[CFSInterface]) – The CFSInterface instance to be wrapped.

Important

When wrapping an instance of CFSEntryInterface, it is necessary to call __disown__() on it to avoid Python freeing the allocated object. The object will be freed automatically by the CFSInstance wrapper.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSInterface.

Methods:

FSCaseSensitive()

Returns True if the file system is case sensitive; otherwise returns False.

FSGetEntry(path)

Retrieves an entry by its full path name.

FSIterator([path])

Retrieves an iterator for the specified path.

FSList([path])

Retrieves an entry list for the specified path.

FSNameFromFullName(full_name)

Retrieves the name of the entry from its full path name.

FSPathFromFullName(full_name)

Retrieves the path of the entry from its full path name.

FSRootDirectory()

Returns the root path of the file system.

FSSeparator()

Returns the path separator of the file system.

HasFSFeature(feature)

Checks for the presence of a specific file system feature.

IsNull()

Returns True if the current instance is invalid; otherwise returns False.

IsValid()

Returns True if the current instance is valid; otherwise returns False.

FSCaseSensitive()bool
Returns

Returns True if the file system is case sensitive; otherwise returns False.

Return type

bool

FSGetEntry(path: str)Pro.Core.CFSEntry

Retrieves an entry by its full path name.

Parameters

path (str) – The full path name of the entry to retrieve.

Returns

Returns a valid entry if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also FSIterator() and FSList().

FSIterator(path: str = str())Pro.Core.CFSIterator

Retrieves an iterator for the specified path.

Parameters

path (str) – The path.

Returns

Returns a valid CFSIterator if successful; otherwise returns an invalid CFSIterator.

Return type

CFSIterator

See also FSList() and FSGetEntry().

FSList(path: str = str())Pro.Core.CFSList

Retrieves an entry list for the specified path.

Parameters

path (str) – The path.

Returns

Returns a valid CFSList if successful; otherwise returns an invalid CFSList.

Return type

CFSList

See also FSIterator() and FSGetEntry().

FSNameFromFullName(full_name: str)str

Retrieves the name of the entry from its full path name.

Parameters

full_name (str) – The full path name.

Returns

Returns the entry name.

Return type

str

See also FSPathFromFullName().

FSPathFromFullName(full_name: str)str

Retrieves the path of the entry from its full path name.

Parameters

full_name (str) – The full path name.

Returns

Returns the path of the entry.

Return type

str

See also FSNameFromFullName().

FSRootDirectory()str
Returns

Returns the root path of the file system.

Return type

str

FSSeparator()str
Returns

Returns the path separator of the file system.

Return type

str

HasFSFeature(feature: str)bool

Checks for the presence of a specific file system feature.

Available features are: metadata, mtime, size and physical.

Parameters

feature (str) – The name of the file system feature.

Returns

Returns True if the file system feature is available; otherwise returns False.

Return type

bool

IsNull()bool
Returns

Returns True if the current instance is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the current instance is valid; otherwise returns False.

Return type

bool

See also IsNull().

class CFSInterface

This class represents a file system interface

This interface is inherited by CFFObject, but can also be also wrapped inside CFSInstance.

Hint

All methods apart from FSIterator() and FSList() in this class can be overridden. To implement the creation of file system iterators or lists, the NewFSIterator() and NewFSList() methods must be overridden. It is sufficient to override just one of these two methods: the internal code is capable of creating a file system list from an iterator and vice-versa, leaving to the developer the choice of which of the two methods is easier to implement for a specific file system.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSInstance.

Methods:

FSCaseSensitive()

Returns the case sensitivity of the file system.

FSGetEntry(path)

Retrieves an entry by its full path name.

FSIterator([path])

Retrieves an iterator for the specified path.

FSList([path])

Retrieves an entry list for the specified path.

FSNameFromFullName(full_name)

Retrieves the name of the entry from its full path name.

FSPathFromFullName(full_name)

Retrieves the path of the entry from its full path name.

FSRootDirectory()

Retrieves the root path of the file system.

FSSeparator()

Retrieves the path separator of the file system.

HasFSFeature(feature)

Checks for the presence of a specific file system feature.

NewFSIterator(path)

Retrieves an iterator for the specified path.

NewFSList(path)

Retrieves an entry list for the specified path.

FSCaseSensitive()bool

Returns the case sensitivity of the file system.

By default this method returns True.

Returns

Returns True if the file system is case sensitive; otherwise returns False.

Return type

bool

FSGetEntry(path: str)Pro.Core.CFSEntry

Retrieves an entry by its full path name.

Hint

If this method is not overridden, it will fall back to use FSIterator() to retrieve the entry.

Parameters

path (str) – The full path name of the entry to retrieve.

Returns

Returns a valid entry if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also FSIterator() and FSList().

FSIterator(path: str = str())Pro.Core.CFSIterator

Retrieves an iterator for the specified path.

Hint

Internally this method calls NewFSIterator().

Parameters

path (str) – The path.

Returns

Returns a valid CFSIterator if successful; otherwise returns an invalid CFSIterator.

Return type

CFSIterator

See also NewFSIterator() and FSList().

FSList(path: str = str())Pro.Core.CFSList

Retrieves an entry list for the specified path.

Hint

Internally this method calls NewFSList().

Parameters

path (str) – The path.

Returns

Returns a valid CFSList if successful; otherwise returns an invalid CFSList.

Return type

CFSList

See also NewFSList() and FSIterator().

FSNameFromFullName(full_name: str)str

Retrieves the name of the entry from its full path name.

Parameters

full_name (str) – The full path name.

Returns

Returns the entry name.

Return type

str

See also FSPathFromFullName().

FSPathFromFullName(full_name: str)str

Retrieves the path of the entry from its full path name.

Parameters

full_name (str) – The full path name.

Returns

Returns the path of the entry.

Return type

str

See also FSNameFromFullName().

FSRootDirectory()str

Retrieves the root path of the file system.

By default this method returns an empty string.

Returns

Returns the root path of the file system.

Return type

str

FSSeparator()str

Retrieves the path separator of the file system.

By default this method returns "/".

Returns

Returns the path separator of the file system.

Return type

str

HasFSFeature(feature: str)bool

Checks for the presence of a specific file system feature.

Available features are: metadata, mtime, size and physical.

Parameters

feature (str) – The name of the file system feature.

Returns

Returns True if the file system feature is available; otherwise returns False.

Return type

bool

NewFSIterator(path: str)Pro.Core.CFSIterator

Retrieves an iterator for the specified path.

Important

This method can be overridden to implement the functionality, but should not be called directly: the wrapper method FSIterator() should be called instead.

Parameters

path (str) – The path.

Returns

Returns a valid CFSIterator if successful; otherwise returns an invalid CFSIterator.

Return type

CFSIterator

See also FSIterator() and NewFSList().

NewFSList(path: str)Pro.Core.CFSList

Retrieves an entry list for the specified path.

Important

This method can be overridden to implement the functionality, but should not be called directly: the wrapper method FSList() should be called instead.

Parameters

path (str) – The path.

Returns

Returns a valid CFSList if successful; otherwise returns an invalid CFSList.

Return type

CFSList

See also FSList() and NewFSIterator().

class CFSIterator(iface: Optional[Pro.Core.CFSIteratorInterface] = None)

Wrapper class for a CFSIteratorInterface instance.

Parameters

iface (Optional[CFSIteratorInterface]) – The CFSIteratorInterface instance to be wrapped.

Important

When wrapping an instance of CFSIteratorInterface, it is necessary to call __disown__() on it to avoid Python freeing the allocated object. The object will be freed automatically by the CFSIterator wrapper.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSIteratorInterface.

Methods:

HasNext()

Returns True if there is an entry after the current one; otherwise returns False.

IsNull()

Returns True if the iterator is invalid; otherwise returns False.

IsValid()

Returns True if the iterator is valid; otherwise returns False.

Next()

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid CFSEntry.

HasNext()bool
Returns

Returns True if there is an entry after the current one; otherwise returns False.

Return type

bool

See also Next().

IsNull()bool
Returns

Returns True if the iterator is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the iterator is valid; otherwise returns False.

Return type

bool

See also IsNull().

Next()Pro.Core.CFSEntry
Returns

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also HasNext().

class CFSIteratorInterface

This class represents a file system iterator.

Its method should never be called directly, but through CFSIterator.

Important

Both the HasNext() and Next() methods must be overridden to implement this interface.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSIterator.

Methods:

HasNext()

Returns True if there is an entry after the current one; otherwise returns False.

Next()

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid CFSEntry.

HasNext()bool
Returns

Returns True if there is an entry after the current one; otherwise returns False.

Return type

bool

See also Next().

Next()Pro.Core.CFSEntry
Returns

Returns the entry after the current one and moves the iterator if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also HasNext().

class CFSList(iface: Optional[Pro.Core.CFSListInterface] = None)

Wrapper class for a CFSListInterface instance.

Parameters

iface (Optional[CFSListInterface]) – The CFSListInterface instance to be wrapped.

Important

When wrapping an instance of CFSListInterface, it is necessary to call __disown__() on it to avoid Python freeing the allocated object. The object will be freed automatically by the CFSList wrapper.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSListInterface.

Methods:

At(i)

Retrieves a specific entry in the list.

Count()

Returns the number of entries in the list.

IsNull()

Returns True if the list is invalid; otherwise returns False.

IsValid()

Returns True if the list is valid; otherwise returns False.

Sort([case_insensitive, dirs_first])

Sorts in place the list.

At(i: int)Pro.Core.CFSEntry

Retrieves a specific entry in the list.

Parameters

i (int) – The position of the entry to retrieve.

Returns

Returns the entry if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also Count().

Count()int
Returns

Returns the number of entries in the list.

Return type

int

See also At().

IsNull()bool
Returns

Returns True if the list is invalid; otherwise returns False.

Return type

bool

See also IsValid().

IsValid()bool
Returns

Returns True if the list is valid; otherwise returns False.

Return type

bool

See also IsNull().

Sort(case_insensitive: bool = True, dirs_first: bool = True)None

Sorts in place the list.

Parameters
  • case_insensitive (bool) – If True, sorts the list ignoring the case; otherwise respects the case.

  • dirs_first (bool) – If True, places directories before file entries; otherwise mixes directory and file entries.

class CFSListInterface

This class represents a file system list.

Its method should never be called directly, but through CFSList.

Important

Both the At() and Count() methods must be overridden to implement this interface.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also CFSList.

Methods:

At(i)

Retrieves a specific entry in the list.

Count()

Returns the number of entries in the list.

At(i: int)Pro.Core.CFSEntry

Retrieves a specific entry in the list.

Parameters

i (int) – The position of the entry to retrieve.

Returns

Returns the entry if successful; otherwise returns an invalid CFSEntry.

Return type

CFSEntry

See also Count().

Count()int
Returns

Returns the number of entries in the list.

Return type

int

See also At().

CT_ActionScript2: Final[int]

Scan entry type for ActionScript2.

See also ScanProvider.addEntry() and ScanEntryData.

CT_ActionScript3: Final[int]

Scan entry type for ActionScript3.

See also ScanProvider.addEntry() and ScanEntryData.

CT_AppLaunch: Final[int]

Scan entry type for application launches.

See also ScanProvider.addEntry() and ScanEntryData.

CT_AttackSurface: Final[int]

Scan entry type for attack surfaces.

See also ScanProvider.addEntry() and ScanEntryData.

CT_BinaryData: Final[int]

Scan entry type for binary data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Blacklisted: Final[int]

Scan entry type for a blacklisted item.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also ScanProvider.addEntry() and ScanEntryData.

CT_ByteCode: Final[int]

Scan entry type for byte-code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_DalvikByteCode: Final[int]

Scan entry type for Dalvik byte-code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_DataEntriesEnd: Final[int]

Scan entry type for data entries end.

See also ScanProvider.addEntry() and ScanEntryData.

CT_DataEntriesStart: Final[int]

Scan entry type for data entries start.

See also ScanProvider.addEntry() and ScanEntryData.

CT_DebugData: Final[int]

Scan entry type for debug data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_DecompressionBomb: Final[int]

Scan entry type for decompression bombs.

See also ScanProvider.addEntry() and ScanEntryData.

CT_EmbeddedFile: Final[int]

Scan entry type for embedded objects.

See also SEC_File, ScanProvider.addEntry() and ScanEntryData.

CT_EntryLimit: Final[int]

Scan entry type for entry limits.

See also ScanProvider.addEntry() and ScanEntryData.

CT_ForeignData: Final[int]

Scan entry type for foreign data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_FreePages: Final[int]

Scan entry type for free pages.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Geolocation: Final[int]

Scan entry type for geo-locations.

See also ScanProvider.addEntry() and ScanEntryData.

CT_HiddenSheets: Final[int]

Scan entry type for hidden sheets.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Intelligence: Final[int]

Scan entry type for an intelligence report.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also ScanProvider.addEntry() and ScanEntryData.

CT_InteractiveForm: Final[int]

Scan entry type for interactive forms.

See also ScanProvider.addEntry() and ScanEntryData.

CT_InvalidCertificate: Final[int]

Scan entry type for invalid certificates.

See also ScanProvider.addEntry() and ScanEntryData.

CT_JavaByteCode: Final[int]

Scan entry type for Java byte-code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_JavaScript: Final[int]

Scan entry type for JavaScript.

See also ScanProvider.addEntry() and ScanEntryData.

CT_MSILByteCode: Final[int]

Scan entry type for MSIL byte-code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Malformed: Final[int]

Scan entry type for malformed data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_MalformedDocument: Final[int]

Scan entry type for malformed documents.

See also ScanProvider.addEntry() and ScanEntryData.

CT_MetaData: Final[int]

Scan entry type for meta-data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_MetaDataUnknown: Final[int]

Scan entry type for unknown meta-data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_NativeCode: Final[int]

Scan entry type for native code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_NoDecompress: Final[int]

Scan entry type for failed decompression.

See also ScanProvider.addEntry() and ScanEntryData.

CT_NoDecrypt: Final[int]

Scan entry type for failed decryption.

See also ScanProvider.addEntry() and ScanEntryData.

CT_OKDecompressed: Final[int]

Scan entry type for successful decompression.

See also ScanProvider.addEntry() and ScanEntryData.

CT_OKDecrypted: Final[int]

Scan entry type for successful decryption.

See also ScanProvider.addEntry() and ScanEntryData.

CT_PersonalData: Final[int]

Scan entry type for personal data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Privileges: Final[int]

Scan entry type for required privileges.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Recursive: Final[int]

Scan entry type for recursion.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Report: Final[int]

Scan entry type for a report.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Resources: Final[int]

Scan entry type for issues in resources.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Script: Final[int]

Scan entry type for scripts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_ShellCode: Final[int]

Scan entry type for shellcode.

See also ScanProvider.addEntry() and ScanEntryData.

CT_SignatureMatch: Final[int]

Scan entry type for signature matches.

See also ScanProvider.addEntry() and ScanEntryData.

CT_SpreadsheetFormulas: Final[int]

Scan entry type for spreadsheet formulas.

See also ScanProvider.addEntry() and ScanEntryData.

Scan entry type for symbolic links.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Thumbnail: Final[int]

Scan entry type for thumbnails.

See also ScanProvider.addEntry() and ScanEntryData.

CT_TrueType: Final[int]

Scan entry type for TrueType fonts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_TrustedCertificate: Final[int]

Scan entry type for trusted certificates.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Type1: Final[int]

Scan entry type for Type1 fonts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Type2: Final[int]

Scan entry type for Type2 fonts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnaccountedSpace: Final[int]

Scan entry type for unaccounted space.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnknownFont: Final[int]

Scan entry type for unknown fonts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnpackLimit: Final[int]

Scan entry type for the decompression limit.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnpackNestLimit: Final[int]

Scan entry type for the decompression nesting limit.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnreferencedData: Final[int]

Scan entry type for unreferenced data.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UntrustedCertificate: Final[int]

Scan entry type for untrusted certificates.

See also ScanProvider.addEntry() and ScanEntryData.

CT_UnverifiedCertificate: Final[int]

Scan entry type for unverified certificates.

See also ScanProvider.addEntry() and ScanEntryData.

CT_VBAScript: Final[int]

Scan entry type for VBA code.

See also ScanProvider.addEntry() and ScanEntryData.

CT_VBSScript: Final[int]

Scan entry type for VBS scripts.

See also ScanProvider.addEntry() and ScanEntryData.

CT_VersionInfo: Final[int]

Scan entry type for version information.

See also ScanProvider.addEntry() and ScanEntryData.

CT_Whitelisted: Final[int]

Scan entry type for a whitelisted item.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also ScanProvider.addEntry() and ScanEntryData.

CT_WrongCheckSum: Final[int]

Scan entry type for invalid checksums.

See also ScanProvider.addEntry() and ScanEntryData.

CT_WrongDigest: Final[int]

Scan entry type for invalid digests.

See also ScanProvider.addEntry() and ScanEntryData.

CT_WrongHash: Final[int]

Scan entry type for invalid hashes.

See also ScanProvider.addEntry() and ScanEntryData.

class CommonSystem

Logic providers return classes derived from this class to define a scanning behaviour.

See also LocalSystem and ProCoreContext.getSystem().

Methods:

addFile(file[, name])

Adds a file to the queue of files to scan.

addFiles(files[, names])

Adds a a list of files to the queue of files to scan.

addPath(path)

Adds a path to the queue of paths to scan.

addPaths(paths)

Adds a list of paths to the queue of paths to scan.

allPaths()

Scans all available paths.

clear()

Clears the scan system.

defaultLocalSeparator()

Returns the path separator for the current platform.

defaultScanContext()

Retrieves the scan context for the system.

defaultSeparator()

Returns the path separator for the system.

isBatchScan()

Returns True if the system performs a batch scan; otherwise returns False.

last()

Returns the last FileToScan returned by calling next().

next()

Returns the next file to scan if available; otherwise returns an invalid FileToScan instance.

nextFile()

This method must be overwritten by derived classes to provide the next FileToScan data.

setBatchScan(b)

Sets the batch scan status of the system.

setDefaultLocalSeparator(sep)

Sets the path separator for the current platform.

setDefaultScanContext(ctx)

Sets the scan context for the system.

setDefaultSeparator(sep)

Sets the path separator for the system.

setExtensions(exts)

Sets the file extensions to scan.

setPrefixReplace(before, after)

Sets a replacement rule for file prefixes.

addFile(file: str, name: str = str())None

Adds a file to the queue of files to scan.

Parameters
  • file (str) – The name of the file to scan on disk.

  • name (str) – An optional name for the file.

See also addFiles() and addPath().

addFiles(files: Pro.Core.NTStringList, names: Pro.Core.NTStringList = NTStringList())None

Adds a a list of files to the queue of files to scan.

Parameters
  • files (NTStringList) – A list with the names of the files to scan on disk.

  • names (NTStringList) – A list with optional names for the files.

See also addFile() and addPaths().

addPath(path: str)None

Adds a path to the queue of paths to scan.

Parameters

path (str) – The path to scan.

See also addPaths(), addFile() and allPaths().

addPaths(paths: Pro.Core.NTStringList)None

Adds a list of paths to the queue of paths to scan.

Parameters

paths (NTStringList) – A list of the paths to scan.

See also addPath(), addFiles() and allPaths().

allPaths()None

Scans all available paths.

See also addFiles() and addPaths().

clear()None

Clears the scan system.

See also addFile() and addPaths().

defaultLocalSeparator()int
Returns

Returns the path separator for the current platform.

Return type

int

See also setDefaultLocalSeparator() and defaultSeparator().

defaultScanContext()str

Retrieves the scan context for the system.

Note

This method is served for future use.

Returns

Returns the scan context.

Return type

str

See also setDefaultScanContext().

defaultSeparator()int
Returns

Returns the path separator for the system.

Return type

int

See also setDefaultSeparator() and defaultLocalSeparator().

isBatchScan()bool
Returns

Returns True if the system performs a batch scan; otherwise returns False.

Return type

bool

See also setBatchScan().

last()Pro.Core.FileToScan
Returns

Returns the last FileToScan returned by calling next().

Return type

FileToScan

See also next().

next()Pro.Core.FileToScan
Returns

Returns the next file to scan if available; otherwise returns an invalid FileToScan instance.

Return type

FileToScan

See also last() and nextFile().

nextFile()Pro.Core.FileToScan

This method must be overwritten by derived classes to provide the next FileToScan data.

Warning

This method must not be called directly! Instead, next() must be called.

Returns

Returns the next file to scan if available; otherwise returns an invalid FileToScan instance.

Return type

FileToScan

setBatchScan(b: bool)None

Sets the batch scan status of the system.

By default the batch scan status is set to True.

Parameters

b (bool) – If True, the system performs a batch scan; otherwise it performs a single scan.

See also isBatchScan().

setDefaultLocalSeparator(sep: int)None

Sets the path separator for the current platform.

Parameters

sep (int) – The local path separator.

See also defaultLocalSeparator() and setDefaultSeparator().

setDefaultScanContext(ctx: str)None

Sets the scan context for the system.

Note

This method is served for future use.

Parameters

ctx (str) – The scan context.

See also defaultScanContext().

setDefaultSeparator(sep: int)None

Sets the path separator for the system.

Parameters

sep (int) – The path separator.

See also defaultSeparator() and setDefaultLocalSeparator().

setExtensions(exts: Pro.Core.NTStringList)None

Sets the file extensions to scan.

Parameters

exts (NTStringList) – The list of file extensions to scan.

See also addFiles() and addPaths().

setPrefixReplace(before: str, after: str)None

Sets a replacement rule for file prefixes.

Parameters
  • before (str) – The prefix to replace.

  • after (str) – The new prefix.

See also addFiles() and addPaths().

CurrentEndianness()int
Returns

Returns the endianness of the system (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Return type

int

DSNF_NoAccessSpecifier: Final[int]

Doesn’t include the member type (i.e.: public, protected, private) in the unmangled symbol.

See also DemangleSymbolName().

DSNF_NoCallingConvention: Final[int]

Doesn’t include the calling convention in the unmangled symbol.

See also DemangleSymbolName().

DSNF_NoMemberType: Final[int]

Doesn’t include the member type (i.e.: static, virtual, extern) in the unmangled symbol.

See also DemangleSymbolName().

DSNF_NoReturnType: Final[int]

Doesn’t include the return type in the unmangled symbol.

See also DemangleSymbolName().

DSNF_SimpleSignature: Final[int]

Returns a simplified signature of the unmangled symbol.

Combination of DSNF_NoAccessSpecifier, DSNF_NoCallingConvention, DSNF_NoReturnType and DSNF_NoMemberType.

See also DemangleSymbolName().

DemangleSymbolName(mangled: str, flags: int = 0)str

Unmangles a decorated symbol. Symbols generated by Visual C++ and GCC are supported.

Parameters
  • mangled (str) – The mangled symbol.

  • flags (int) – Optional flags (e.g.: DSNF_SimpleSignature).

Returns

Returns the unmangled symbol.

Return type

str

See also MethodNameFromSimpleSignature() and DSNF_SimpleSignature.

DisasmOpt_FileOffsets: Final[int]

Shows offsets in disassemblies shown in the text view.

See also proDisasmOptions().

DisasmOpt_Opcodes: Final[int]

Shows opcodes in disassemblies shown in the text view.

See also proDisasmOptions().

ENDIANNESS_BIG: Final[int]

Big-endian option.

See also ENDIANNESS_LITTLE and CFFObject.SetDefaultEndianness().

ENDIANNESS_LITTLE: Final[int]

Little-endian option.

See also ENDIANNESS_BIG and CFFObject.SetDefaultEndianness().

EXPLICIT_OFLAGS_MASK: Final[int]

The mask for explicit object flags.

Explicit flags are set by the scan provider during the scanning process.

See also ScanProvider and IMPLICIT_OFLAG_UNKNOWN_FORMAT.

class FileToScan

This class contains information about the file to scan returned by classes derived from CommonSystem.

See also CommonSystem.next() and CommonSystem.

Methods:

clear()

Clears the instance.

context()

Returns the scan context for the file.

format()

Returns the format to be used to scan the file.

isValid()

Returns True if the file to scan is valid; otherwise returns False.

localName()

Returns the name of the file to scan on disk.

name()

Returns the optional name of the file to scan.

setContext(context)

Sets the scan context for the file.

setFormat(format)

Sets the format to be used to scan the file.

setLocalName(locname)

Sets the name of the file to scan on disk.

setName(name)

Sets the optional name of the file to scan.

clear()None

Clears the instance.

See also isValid().

context()str
Returns

Returns the scan context for the file.

Return type

str

See also setContext() and CommonSystem.defaultScanContext().

format()str
Returns

Returns the format to be used to scan the file.

Return type

str

See also setFormat().

isValid()bool
Returns

Returns True if the file to scan is valid; otherwise returns False.

Return type

bool

See also clear().

localName()str
Returns

Returns the name of the file to scan on disk.

Return type

str

See also setLocalName() and name().

name()str
Returns

Returns the optional name of the file to scan.

Return type

str

See also setName() and localName().

setContext(context: str)None

Sets the scan context for the file.

Parameters

context (str) – The scan context.

See also context() and CommonSystem.setDefaultScanContext().

setFormat(format: str)None

Sets the format to be used to scan the file.

Parameters

format (str) – The file format.

See also format().

setLocalName(locname: str)None

Sets the name of the file to scan on disk.

Parameters

locname (str) – The name of the file on disk.

See also localName() and setName().

setName(name: str)None

Sets the optional name of the file to scan.

Parameters

name (str) – The optional name of the file.

See also name() and setLocalName().

class FormatItemInfo

The information about a format item returned by ScanProvider._formatViewInfo().

Attributes:

bg

The background color.

fid

The format item id.

icon

An integer which represents the public icon to be used for the item.

text

The text to be used as label for the item.

Methods:

clear()

Clears the fields of the class.

bg

The background color.

See also ntRgb().

clear()None

Clears the fields of the class.

fid

The format item id. This is the id provided when creating the FormatTree.

icon

An integer which represents the public icon to be used for the item. Public icons are defined in the Pro.UI module.

text

The text to be used as label for the item.

class FormatTree

Bases: Pro.Core.NTUIntTree

Tree of FormatTreeNode nodes.

class FormatTreeNode

Bases: Pro.Core.NTUIntTreeNode

This class represents a node of FormatTree.

class FormatTreeNodeList

Bases: Pro.Core.NTUIntTreeNodeList

List of FormatTreeNode elements.

class FormatTreeNodeListIt(obj: Pro.Core.FormatTreeNodeList)

Bases: Pro.Core.NTUIntTreeNodeListIt

Iterator class for FormatTreeNodeList.

Parameters

obj (FormatTreeNodeList) – The object to iterate over.

GB_SIZE: Final[int]

This constant defines the size of a gigabyte.

See also KB_SIZE, MB_SIZE and TB_SIZE.

IMPLICIT_OFLAG_UNKNOWN_FORMAT: Final[int]

Implicit object flag.

This flag is automatically set if no matching file format could be found for the scanned object or one of its embedded objects.

See also ScanProvider and EXPLICIT_OFLAGS_MASK.

INVALID_OFFSET: Final[int]

Invalid file or data offset.

The equivalent of INVALID_STREAM_OFFSET.

See also NTContainer and CFFObject.

INVALID_STREAM_OFFSET: Final[int]

Invalid file or data offset.

The equivalent of INVALID_OFFSET.

See also NTContainer and CFFObject.

KB_SIZE: Final[int]

This constant defines the size of a kilobyte.

See also MB_SIZE, GB_SIZE and TB_SIZE.

class KROffset

Match for a byte search in NTContainer.

See also NTContainer.find(), NTContainer.findFirst() and NTContainer.findMulti().

Attributes:

offset

The start offset of the matche sequence.

pattern

The index of the matched pattern.

offset

The start offset of the matche sequence. It’s INVALID_STREAM_OFFSET in case of no match.

pattern

The index of the matched pattern. This value applies only to NTContainer.findMulti().

class Layout

Layouts are used to create ranges and associate structures to hex views.

Layouts can be exported and imported as XML data.

Note

Structures referenced by layouts must be stored in SQLite-backed header files. In the future we plan to allow XML header data to be stored inside the layout itself.

In the following code example a simple layout is created for a 64-bit Elf file and is then associated to the current hex view:

from Pro.Core import *
from Pro.UI import *

def buildElfLayout(obj, l):
    # load the SQLite-backed header file
    hname = "elf"
    hdr = CFFHeader()
    if not hdr.LoadFromFile(hname):
        return
    # specify the packing options for the structures we add to the layout
    sopts = CFFSO_GCC | CFFSO_Pack1
    d = LayoutData()
    d.setTypeOptions(sopts)
    # add the Elf header to the layout
    ehdr = obj.MakeStruct(hdr, "_Elf64_Ehdr", 0, sopts)
    d.setColor(ntRgba(255, 0, 0, 70))
    d.setStruct(hname, "_Elf64_Ehdr")
    l.add(0, ehdr.Size(), d)
    # add the sections (we assume that e_shentsize is 0x40) to the layout
    e_shoff = ehdr.Num("e_shoff")
    e_shnum = ehdr.Num("e_shnum")
    esects = obj.MakeStructArray(hdr, "_Elf64_Shdr", e_shoff, e_shnum, sopts)
    d.setStruct(hname, "_Elf64_Shdr")
    d.setArraySize(e_shnum)
    l.add(e_shoff, esects.TotalSize(), d)

# get the current view
hv = proContext().getCurrentView()
# it must be a hew view
if hv.isValid() and hv.type() == ProView.Type_Hex:
    # get the container referenced by the hex view
    c = hv.getData()
    obj = CFFObject()
    obj.Load(c)
    # create a new layout named "ELF_ANALYSIS"
    lname = "ELF_ANALYSIS"
    l = proContext().getLayout(lname)
    # build the layout
    buildElfLayout(obj, l)
    # apply the layout to the current hex view
    hv.setLayoutName(lname)

See also LayoutInterval, LayoutData, LayoutPair and CFFHeader.

Methods:

add(interval_or_offset, data_or_size[, data])

Associates LayoutData to an interval.

at(i_or_interval_or_lp)

Retrieves the index of the layout entry if an interval or layout pair are specified; otherwise returns a layout pair if an index is specified.

clear()

Clears the current layout.

count()

Returns the number of layout entries.

fromXml(xstr)

Imports a layout from XML data.

getMatches(offset, size)

Retrieves a list of layout pairs which match exactly the specified interval.

getOverlappingWith(offset, size)

Retrieves a list of layout pairs which overlap with the specified interval.

isModified()

Returns True if the layout was modified; otherwise returns False.

isNull()

Returns True if the layout is invalid; otherwise returns False.

isValid()

Returns True if the layout is valid; otherwise returns False.

layoutName()

Returns the name of the layout.

remove(interval_or_offset[, size])

Removes layout entries matching a specified interval.

renameLayout(name)

Renames the layout.

saveIfModified()

Saves the layout to the current project if the layout was modified.

setModified(b)

Sets the modified status of the layout.

toXml()

Exports the layout to XML.

add(interval_or_offset: Union[Pro.Core.LayoutInterval, int], data_or_size: Union[Pro.Core.LayoutData, int], data: Optional[Pro.Core.LayoutData] = None)None

Associates LayoutData to an interval.

Parameters
  • interval_or_offset (Union[LayoutInterval, int]) – Either the interval or the start offset of the interval.

  • data_or_size (Union[LayoutData, int]) – Either the data to associate or the size of the interval.

  • data (Optional[LayoutData]) – The data to associate.

See also count(), remove() and at().

at(i_or_interval_or_lp: Union[Pro.Core.LayoutInterval, Pro.Core.LayoutPair, int])Union[Pro.Core.LayoutPair, int]

Retrieves the index of the layout entry if an interval or layout pair are specified; otherwise returns a layout pair if an index is specified.

Parameters

i_or_interval_or_lp (Union[LayoutInterval, LayoutPair, int]) – Either the index of the layout entry, the interval or the layout pair.

Returns

Returns the index of the layout entry if an interval or layout pair are specified and successful; otherwise returns 0. Alternatively, returns a layout pair if an index is specified and successful; otherwise returns an invalid layout pair.

Return type

Union[LayoutPair, int]

See also count(), add() and remove().

clear()None

Clears the current layout.

See also isValid() and fromXml().

count()int
Returns

Returns the number of layout entries.

Return type

int

See also add(), remove() and at().

fromXml(xstr: str)bool

Imports a layout from XML data.

Parameters

xstr (str) – The XML string.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also toXml().

getMatches(offset: int, size: int)Pro.Core.LayoutPairList

Retrieves a list of layout pairs which match exactly the specified interval.

Parameters
  • offset (int) – The start offset of the interval.

  • size (int) – The size of the interval.

Returns

Returns a list of layout pairs.

Return type

LayoutPairList

See also getOverlappingWith().

getOverlappingWith(offset: int, size: int)Pro.Core.LayoutPairList

Retrieves a list of layout pairs which overlap with the specified interval.

Parameters
  • offset (int) – The start offset of the interval.

  • size (int) – The size of the interval.

Returns

Returns a list of layout pairs.

Return type

LayoutPairList

See also getMatches().

isModified()bool
Returns

Returns True if the layout was modified; otherwise returns False.

Return type

bool

See also setModified().

isNull()bool
Returns

Returns True if the layout is invalid; otherwise returns False.

Return type

bool

See also isValid().

isValid()bool
Returns

Returns True if the layout is valid; otherwise returns False.

Return type

bool

See also isNull().

layoutName()str
Returns

Returns the name of the layout.

Return type

str

See also renameLayout().

remove(interval_or_offset: Union[Pro.Core.LayoutInterval, int], size: Optional[int] = None)None

Removes layout entries matching a specified interval.

Parameters
  • interval_or_offset (Union[LayoutInterval, int]) – Either the interval or the start offset of the interval.

  • size (Optional[int]) – The size of the interval.

See also add(), at() and count().

renameLayout(name: str)bool

Renames the layout.

Parameters

name (str) – The new name of the layout.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also layoutName().

saveIfModified()None

Saves the layout to the current project if the layout was modified.

See also isModified().

setModified(b: bool)None

Sets the modified status of the layout.

Parameters

b (bool) – If True, the layout is marked as modified.

See also isModified().

toXml()str

Exports the layout to XML.

Returns

Returns an XML string.

Return type

str

See also fromXml().

class LayoutData

This class contains the data of a layout entry.

See also Layout.

Methods:

arraySize()

Returns the size of the array of structures.

getColor()

Returns the background color of the netry.

getDescription()

Returns the description of the entry.

getHeader()

Returns the name of header which contains the referenced structure.

getType()

Returns the name of the associated structure.

setArraySize(n)

Sets the size of the array of structures.

setColor(rgba)

Sets the background color.

setDescription(description)

Sets the description of the entry.

setStruct(hdr, type)

Sets the associated structure.

setTypeOptions(opt)

Sets the options for the associated structure.

typeOptions()

Returuns the options for associated structure.

arraySize()int
Returns

Returns the size of the array of structures.

Return type

int

See also setArraySize().

getColor()int
Returns

Returns the background color of the netry.

Return type

int

See also setColor().

getDescription()str
Returns

Returns the description of the entry.

Return type

str

See also setDescription().

getHeader()str
Returns

Returns the name of header which contains the referenced structure.

Return type

str

See also setStruct().

getType()str
Returns

Returns the name of the associated structure.

Return type

str

See also setStruct().

setArraySize(n: int)None

Sets the size of the array of structures.

Parameters

n (int) – The size of the array.

See also arraySize().

setColor(rgba: int)None

Sets the background color.

Parameters

rgba (int) – The background color.

See also getColor().

setDescription(description: str)None

Sets the description of the entry.

Parameters

description (str) – The description of the entry.

See also getDescription().

setStruct(hdr: str, type: str)None

Sets the associated structure.

Parameters
  • hdr (str) – The name of the header file which contains the structure.

  • type (str) – The name of the structure.

See also getHeader() and getType().

setTypeOptions(opt: int)None

Sets the options for the associated structure.

Parameters

opt (int) – The options for the associated structure (e.g., CFFSO_Pack1).

See also typeOptions() and setStruct().

typeOptions()int
Returns

Returuns the options for associated structure.

Return type

int

See also setTypeOptions() and setStruct().

class LayoutInterval

This class represents a layout interval.

See also Layout.

Attributes:

end

The end offset of the interval.

start

The start offset of the interval.

end

The end offset of the interval.

start

The start offset of the interval.

class LayoutPair(t1: Optional[Pro.Core.LayoutInterval] = None, t2: Optional[Pro.Core.LayoutData] = None)

Pair of (LayoutInterval, LayoutData) elements.

Parameters
  • t1 (Optional[LayoutInterval]) – The first element of the pair.

  • t2 (Optional[LayoutData]) – The second element of the pair.

Methods:

first()

Returns the first element in the pair.

second()

Returns the second element in the pair.

setFirst(v)

Sets the first element in the pair.

setSecond(v)

Sets the second element in the pair.

first()Pro.Core.LayoutInterval
Returns

Returns the first element in the pair.

Return type

LayoutInterval

See also second() and setFirst().

second()Pro.Core.LayoutData
Returns

Returns the second element in the pair.

Return type

LayoutData

See also first() and setSecond().

setFirst(v: Pro.Core.LayoutInterval)None

Sets the first element in the pair.

Parameters

v (LayoutInterval) – The value of the element.

See also first() and setSecond().

setSecond(v: Pro.Core.LayoutData)None

Sets the second element in the pair.

Parameters

v (LayoutData) – The value of the element.

See also second() and setFirst().

class LayoutPairList

List of LayoutPair elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.LayoutPair)None

Inserts value at the end of the list.

Parameters

value (LayoutPair) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.LayoutPair

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

LayoutPair

clear()None

Removes all items from the list.

contains(value: Pro.Core.LayoutPair)bool

Checks the presence of an element in the list.

Parameters

value (LayoutPair) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.LayoutPair)int

Returns the number of occurrences of value in the list.

Parameters

value (LayoutPair) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.LayoutPair, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (LayoutPair) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.LayoutPair)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (LayoutPair) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.LayoutPairListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

LayoutPairListIt

removeAll(value: Pro.Core.LayoutPair)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (LayoutPair) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.LayoutPair

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

LayoutPair

See also removeAt().

class LayoutPairListIt(obj: Pro.Core.LayoutPairList)

Iterator class for LayoutPairList.

Parameters

obj (LayoutPairList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.LayoutPair
Returns

Returns the next item and advances the iterator by one position.

Return type

LayoutPair

See also hasNext() and previous().

previous()Pro.Core.LayoutPair
Returns

Returns the previous item and moves the iterator back by one position.

Return type

LayoutPair

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class LocalSystem

Bases: Pro.Core.CommonSystem

CommonSystem derived class used to perform local file system scans.

See also CommonSystem and ProCoreContext.getSystem().

MB_SIZE: Final[int]

This constant defines the size of a megabyte.

See also KB_SIZE, GB_SIZE and TB_SIZE.

METAFLAG_STRING: Final[int]

Specifies the string nature of the meta-data.

See also ScanMetaDataEntry.flags and ScanProvider.addMetaDataString().

MethodNameFromSimpleSignature(signature: str)str

Extracts the function or method name from a simple signature. A simple method signature doesn’t include a return type or other specifiers before the method name.

When working with mangled symbols, the simple signature must first be obtained by calling DemangleSymbolName() with DSNF_SimpleSignature.

Parameters

signature (str) – The simple signature.

Returns

Returns the method name.

Return type

str

See also DemangleSymbolName().

NATURE_BYTEARRAY: Final[int]

Byte-array type nature.

See also CFFObject.GetTypeNature().

NATURE_NUMBER: Final[int]

Integer number type nature.

See also CFFObject.GetTypeNature().

NATURE_REAL: Final[int]

Real number type nature.

See also CFFObject.GetTypeNature().

NATURE_STRING: Final[int]

String type nature.

See also CFFObject.GetTypeNature().

NATURE_UNKNOWN: Final[int]

Unknown type nature.

See also CFFObject.GetTypeNature().

class NTAddressSpace

This class is used to apply address spaces to containers.

See also NTContainer.addAddressSpace(), createAddressSpace() and createSparseAddressSpace().

Methods:

addSparseRange(address, size[, offset, flags])

Adds a sparse range to the address space.

addressRange()

Returns the start and end address of the address space.

cacheEnabled()

Returns True if address translation caching is enabled; otherwise returns False.

flags()

Returns the flags for the address space (e.g., NT_ASF_IgnoreInvalidPages).

getPageFlagsLabels(pflags[, all])

Converts page flags into a list of strings.

isNull()

Returns True if the address space is invalid; otherwise returns False.

pageFlags(c, address)

Returns the page flags for the specified address.

pageSize()

Returns the page size of the address space.

setCacheEnabled(b)

Sets the status of address translation caching.

setFlags(f)

Sets the flags for the address space.

size()

Returns the size of the address space.

stdPageFlags(c, address)

Returns standard page flags such as NT_ASPSF_EXECUTE for a specified address.

toAddress(c, offset)

Converts an offset to an address.

toOffset(c, address)

Converts an address to an offset.

toStdPageFlags(pflags)

Converts address specific page flags retrieved by calling pageFlags() into standard page flags (e.g., NT_ASPSF_EXECUTE).

addSparseRange(address: int, size: int, offset: int = INVALID_STREAM_OFFSET, flags: int = - 1)None

Adds a sparse range to the address space.

Parameters
  • address (int) – The address of the range.

  • size (int) – The size of the range.

  • offset (int) – The offset at which to map the address.

  • flags (int) – Optional page flags for the range (e.g., NT_ASPSF_EXECUTE).

See also createSparseAddressSpace().

addressRange()tuple
Returns

Returns the start and end address of the address space.

Return type

tuple[int, int]

See also size().

cacheEnabled()bool
Returns

Returns True if address translation caching is enabled; otherwise returns False.

Return type

bool

See also setCacheEnabled().

flags()int
Returns

Returns the flags for the address space (e.g., NT_ASF_IgnoreInvalidPages).

Return type

int

See also setFlags().

getPageFlagsLabels(pflags: int, all: bool = False)Pro.Core.NTStringList

Converts page flags into a list of strings.

Parameters
  • pflags (int) – The page flags.

  • all (bool) – If True, includes every known flag.

Returns

Returns a list of flag labels.

Return type

NTStringList

See also pageFlags().

isNull()bool
Returns

Returns True if the address space is invalid; otherwise returns False.

Return type

bool

pageFlags(c: Pro.Core.NTContainer, address: int)tuple

Returns the page flags for the specified address.

The returned flags can be platform specific and may not be standard page flags such as NT_ASPSF_EXECUTE. To convert the returned flags into standard page flags, use toStdPageFlags(). Alternatively, stdPageFlags() can be called instead of this method to retrieve standard page flags for a specified address.

Parameters
  • c (NTContainer) – The source container.

  • address (int) – The address for which to retrieve the page flags.

Returns

Returns the result of the operation (possible values are NT_ASR_UNSUPPORTED, NT_ASR_INVALID and NT_ASR_OK) and the page flags if the first value is NT_ASR_OK.

Return type

tuple[int, int]

See also getPageFlagsLabels(), toStdPageFlags() and stdPageFlags().

pageSize()int
Returns

Returns the page size of the address space.

Return type

int

setCacheEnabled(b: bool)None

Sets the status of address translation caching.

Caching is automatically enabled for address spaces with a page size which is equal or greater than 1 KB.

Parameters

b (bool) – If True, enables address translation caching.

See also cacheEnabled().

setFlags(f: int)None

Sets the flags for the address space.

Parameters

f (int) – The flags to set (e.g., NT_ASF_IgnoreInvalidPages).

See also flags().

size()int
Returns

Returns the size of the address space.

Return type

int

See also addressRange().

stdPageFlags(c: Pro.Core.NTContainer, address: int)tuple

Returns standard page flags such as NT_ASPSF_EXECUTE for a specified address.

Parameters
  • c (NTContainer) – The source container.

  • address (int) – The address for which to retrieve the standard page flags.

Returns

Returns the result of the operation (possible values are NT_ASR_UNSUPPORTED, NT_ASR_INVALID and NT_ASR_OK) and the standard page flags if the first value is NT_ASR_OK.

Return type

tuple[int, int]

See also pageFlags() and toStdPageFlags().

toAddress(c: Pro.Core.NTContainer, offset: int)int

Converts an offset to an address.

Note

Not all address spaces support this functionality.

Parameters
  • c (NTContainer) – The source container.

  • offset (int) – The offset to convert.

Returns

Returns the address if successful; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also toOffset().

toOffset(c: Pro.Core.NTContainer, address: int)int

Converts an address to an offset.

Parameters
  • c (NTContainer) – The source container.

  • address (int) – The address to convert.

Returns

Returns the offset if successful; otherwise returns INVALID_STREAM_OFFSET.

Return type

int

See also toAddress().

toStdPageFlags(pflags: int)int

Converts address specific page flags retrieved by calling pageFlags() into standard page flags (e.g., NT_ASPSF_EXECUTE).

Parameters

pflags (int) – The page flags to convert.

Returns

Returns the standard page flags.

Return type

int

See also pageFlags() and stdPageFlags().

class NTBuffer

Base class for buffered read operations.

This class will throw an IndexError exception on error.

See also NTContainerBuffer and CFFBuffer.

Methods:

_d64([endianness])

Reads a C double backwards.

_f32([endianness])

Reads a C float backwards.

_i16([endianness])

Reads an int16 backwards.

_i32([endianness])

Reads an int32 backwards.

_i64([endianness])

Reads an int64 backwards.

_i8()

Reads an int8 backwards.

_u16([endianness])

Reads an uint16 backwards.

_u32([endianness])

Reads an uint32 backwards.

_u64([endianness])

Reads an uint64 backwards.

_u8()

Reads an uint8 backwards.

d64([endianness])

Reads a C double.

defaultEndianness()

Returns the default endianness for the buffer.

f32([endianness])

Reads a C float.

getBitPosition()

Returns the current bit position.

getOffset()

Returns the current offset.

i16([endianness])

Reads an int16.

i32([endianness])

Reads an int32.

i64([endianness])

Reads an int64.

i8()

Reads an int8.

isNull()

Returns True if the buffer is uninitialized; otherwise returns False.

isValid()

Returns True if the buffer is initialized; otherwise returns False.

read(n)

Reads a number of bytes from the buffer.

setBufferSize(size)

Sets the internal buffer size.

setDefaultEndianness(endianness)

Sets the default endianness for the buffer.

setOffset(offset)

Sets the current offset for the buffer.

size()

Returns the size of the object referenced by the buffer.

u16([endianness])

Reads an uint16.

u32([endianness])

Reads an uint32.

u64([endianness])

Reads an uint64.

u8()

Reads an uint8.

ubits(nbits)

Reads an amount of bits.

_d64(endianness: Optional[int] = None)float

Reads a C double backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

float

See also d64().

_f32(endianness: Optional[int] = None)float

Reads a C float backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

float

See also f32().

_i16(endianness: Optional[int] = None)int

Reads an int16 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also i16().

_i32(endianness: Optional[int] = None)int

Reads an int32 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also i32().

_i64(endianness: Optional[int] = None)int

Reads an int64 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also i64().

_i8()int

Reads an int8 backwards.

Returns

Returns the numeric value.

Return type

int

See also i8().

_u16(endianness: Optional[int] = None)int

Reads an uint16 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also u16().

_u32(endianness: Optional[int] = None)int

Reads an uint32 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also u32().

_u64(endianness: Optional[int] = None)int

Reads an uint64 backwards.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also u64().

_u8()int

Reads an uint8 backwards.

Returns

Returns the numeric value.

Return type

int

See also u8().

d64(endianness: Optional[int] = None)float

Reads a C double.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

float

See also _d64().

defaultEndianness()int
Returns

Returns the default endianness for the buffer.

Return type

int

See also setDefaultEndianness(), ENDIANNESS_LITTLE and ENDIANNESS_BIG.

f32(endianness: Optional[int] = None)float

Reads a C float.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

float

See also _f32().

getBitPosition()int
Returns

Returns the current bit position.

Return type

int

See also ubits().

getOffset()int
Returns

Returns the current offset.

Return type

int

See also setOffset().

i16(endianness: Optional[int] = None)int

Reads an int16.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _i16().

i32(endianness: Optional[int] = None)int

Reads an int32.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _i32().

i64(endianness: Optional[int] = None)int

Reads an int64.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _i64().

i8()int

Reads an int8.

Returns

Returns the numeric value.

Return type

int

See also _i8().

isNull()bool
Returns

Returns True if the buffer is uninitialized; otherwise returns False.

Return type

bool

See also isValid().

isValid()bool
Returns

Returns True if the buffer is initialized; otherwise returns False.

Return type

bool

See also isNull().

read(n: int)bytes

Reads a number of bytes from the buffer.

Parameters

n (int) – The number of bytes to read.

Returns

Returns the bytes read.

Return type

bytes

See also setBufferSize().

setBufferSize(size: int)None

Sets the internal buffer size. This method must be called before any read operation are performed. If not called, the size will default 1 KB.

Parameters

size (int) – The size of the internal buffer.

setDefaultEndianness(endianness: int)None

Sets the default endianness for the buffer.

Parameters

endianness (int) – The default endianness for the buffer (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

See also defaultEndianness().

setOffset(offset: int)None

Sets the current offset for the buffer.

Parameters

offset (int) – The current offset.

See also getOffset().

size()int
Returns

Returns the size of the object referenced by the buffer.

Return type

int

See also getOffset().

u16(endianness: Optional[int] = None)int

Reads an uint16.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _u16().

u32(endianness: Optional[int] = None)int

Reads an uint32.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _u32().

u64(endianness: Optional[int] = None)int

Reads an uint64.

Parameters

endianness (Optional[int]) – The endianness of the value (ENDIANNESS_LITTLE or ENDIANNESS_BIG).

Returns

Returns the numeric value.

Return type

int

See also _u64().

u8()int

Reads an uint8.

Returns

Returns the numeric value.

Return type

int

See also _u8().

ubits(nbits: int)int

Reads an amount of bits.

Parameters

nbits (int) – The number of bits to read.

Returns

Returns the bits read.

Return type

int

See also getBitPosition().

class NTByteArrayList

List of bytes elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: bytes)None

Inserts value at the end of the list.

Parameters

value (bytes) – The value to add to the list.

See also insert().

at(i: int)bytes

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

bytes

clear()None

Removes all items from the list.

contains(value: bytes)bool

Checks the presence of an element in the list.

Parameters

value (bytes) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: bytes)int

Returns the number of occurrences of value in the list.

Parameters

value (bytes) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: bytes, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (bytes) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: bytes)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (bytes) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTByteArrayListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTByteArrayListIt

removeAll(value: bytes)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (bytes) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)bytes

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

bytes

See also removeAt().

class NTByteArrayListIt(obj: Pro.Core.NTByteArrayList)

Iterator class for NTByteArrayList.

Parameters

obj (NTByteArrayList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()bytes
Returns

Returns the next item and advances the iterator by one position.

Return type

bytes

See also hasNext() and previous().

previous()bytes
Returns

Returns the previous item and moves the iterator back by one position.

Return type

bytes

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTContainer

This is a generic container used to encapsulate data such as files and memory.

Containers can be created through functions such as createContainerFromFile() and newContainer().

See also createContainerFromFile(), newContainer(), NTContainerBuffer and NTAddressSpace.

Attributes:

ByteArrayList

Type of data internally referenced by the container.

Bytes

Type of data internally referenced by the container.

BytesTree

Type of data internally referenced by the container.

File

Type of data internally referenced by the container.

Filled

Type of data internally referenced by the container.

Filter

Type of data internally referenced by the container.

Memory

Type of data internally referenced by the container.

NoType

Type of data internally referenced by the container.

Process

Type of data internally referenced by the container.

Stream

Type of data internally referenced by the container.

String

Type of data internally referenced by the container.

StringList

Type of data internally referenced by the container.

StringTree

Type of data internally referenced by the container.

SubContainer

Type of data internally referenced by the container.

Methods:

addAddressSpace(aspace)

Adds an address space to the current container and returns a new container as the result.

align(align_to)

Aligns the container to the specified size.

append(bytes)

Appends data to the container.

appendTo(dst_or_offset[, size, dst])

Appends this container to another container.

clear()

Deferences the data currently being referenced by this container.

clone()

Returns a container holding a new reference to the internal data.

compare(offset, bytes_or_size[, b])

Compares the specified data to the one in the container.

copyTo(offset, size, dst[, dst_offset])

Copies a part of the current container to another container.

copyToEx(wait, offset, size, dst[, dst_offset])

Copies a part of the current container to another container.

copyToNewContainer()

Copies the data referenced by the current container to a new container.

copyToNewContainerEx(wait[, offset, size])

Copies the data referenced by the current container to a new container.

dataType()

Returns the internal data type referenced by the container.

diskFileName()

Returns a file name if the container directly references a file on disk; otherwise returns an empty string.

equals(s)

Checks whether the current container references the same data as the specified container.

fill(offset, b, size)

Fills a portion of the container with the specified byte.

find(cb, ud, pattern[, offset, size, down])

Searches for a specified pattern.

findFirst(pattern[, offset, size, down])

Searches for the first occurrence of a specified pattern.

findMulti(cb, ud, patterns[, offset, size])

Searches for any pattern in a specified list.

findMultiFirst(patterns[, offset, size])

Searches for the first occurrence of any pattern in a specified list.

getAddressSpace()

Returns the address space of the container if present; otherwise returns an invalid address space.

getRange()

Returns a tuple containing a boolean and two integers. If the boolean is True, then the container has a range and the two integers are the offset and the size of the range.

getSubContainer()

Returns the internal container referenced by the current container if any; otherwise returns an invalid container.

hasAddressSpace()

Returns True if the current container has an address space; otherwise returns False.

hasRange()

Returns True if the current container has a range; otherwise returns False.

hasReferenceContainer()

Returns True if the current container has a reference container; otherwise returns False.

isNull()

Returns True if the current container is invalid; otherwise returns False.

isResizable()

Returns True if the current container is resizable; otherwise returns False.

isValid()

Returns True if the current container is valid; otherwise returns False.

isValidAddress(address)

Checks whether the specified address is valid in the context of the current container.

name()

Returns the internal name of the container. A container may have a name only if created from a named object like a file.

read(offset, size)

Reads data from the container.

readU16BE(offset)

Reads a big-endian 16-bit unsigned integer from the container.

readU16LE(offset)

Reads a little-endian 16-bit unsigned integer from the container.

readU32BE(offset)

Reads a big-endian 32-bit unsigned integer from the container.

readU32LE(offset)

Reads a little-endian 32-bit unsigned integer from the container.

readU64BE(offset)

Reads a big-endian 64-bit unsigned integer from the container.

readU64LE(offset)

Reads a little-endian 64-bit unsigned integer from the container.

readU8(offset)

Reads an 8-bit unsigned integer from the container.

referenceContainer()

Returns the reference container if any; otherwise returns None.

resetRange()

Resets the range of the container.

resize(new_size[, zero])

Resizes the container.

save(fname[, offset, size])

Copies the container, or part of it, to a specified file.

setData(data[, own_or_size])

Sets the internal data referenced by the container.

setRange(offset, size[, optimize_for_speed])

Sets the internal range for the container.

setResizable(b)

Sets the resizable status of the container.

setSubContainer(c)

Sets the internally referenced container.

setTag(t)

Sets an internal tag name for debugging purposes.

shift(size)

Appends size bytes at the end of the container and sets them to zero.

size()

Returns the size of the container. This might be the size of the underlying data referenced by the container, the size specified by setRange() or the size returned by the address space of the container if present.

supportsConcurrency()

Returns True if the data referenced by the container supports concurrent I/O operation; otherwise returns False.

tag()

Returns the tag name set for debugging purposes if present; otherwise returns an empty string.

toByteArrayList()

Returns the internal byte-array list referenced by the container.

toBytes()

Returns the internal bytes referenced by the container if the dataType() is Bytes; otherwise returns and empty bytes object.

toContiguousProcess()

If the container references a process, this method applies an address space that makes the memory of the process appear contiguous.

toFile()

Returns the internal file referenced by the container if the dataType() is File; otherwise returns None.

toProcess()

Returns the internal process referenced by the container if the dataType() is Process; otherwise returns None.

toString()

Returns the internal string referenced by the container if the dataType() is String; otherwise returns an empty string.

toStringList()

Returns the internal string list referenced by the container.

validRange(offset, size)

Checks the validity of a range in the context of the container.

validRawRange(offset, size)

Checks the validity of a range in the context of the container ignoring the range set on the container through setRange().

write(offset, bytes_or_c)

Write data to the container.

writeU16BE(offset, n)

Writes a big-endian 16-bit unsigned integer to the container.

writeU16LE(offset, n)

Writes a little-endian 16-bit unsigned integer to the container.

writeU32BE(offset, n)

Writes a big-endian 32-bit unsigned integer to the container.

writeU32LE(offset, n)

Writes a little-endian 32-bit unsigned integer to the container.

writeU64BE(offset, n)

Writes a big-endian 64-bit unsigned integer to the container.

writeU64LE(offset, n)

Writes a little-endian 64-bit unsigned integer to the container.

writeU8(offset, n)

Writes an 8-bit unsigned integer to the container.

ByteArrayList: Final[int]

Type of data internally referenced by the container.

See also dataType().

Bytes: Final[int]

Type of data internally referenced by the container.

See also dataType().

BytesTree: Final[int]

Type of data internally referenced by the container.

See also dataType().

File: Final[int]

Type of data internally referenced by the container.

See also dataType().

Filled: Final[int]

Type of data internally referenced by the container.

See also dataType().

Filter: Final[int]

Type of data internally referenced by the container.

See also dataType().

Memory: Final[int]

Type of data internally referenced by the container.

See also dataType().

NoType: Final[int]

Type of data internally referenced by the container.

See also dataType().

Process: Final[int]

Type of data internally referenced by the container.

See also dataType().

Stream: Final[int]

Type of data internally referenced by the container.

See also dataType().

String: Final[int]

Type of data internally referenced by the container.

See also dataType().

StringList: Final[int]

Type of data internally referenced by the container.

See also dataType().

StringTree: Final[int]

Type of data internally referenced by the container.

See also dataType().

SubContainer: Final[int]

Type of data internally referenced by the container.

See also dataType().

addAddressSpace(aspace: Pro.Core.NTAddressSpace)Pro.Core.NTContainer

Adds an address space to the current container and returns a new container as the result.

Parameters

aspace (NTAddressSpace) – The address space.

Returns

Returns the new container.

Return type

NTContainer

See also hasAddressSpace(), getAddressSpace() and getSubContainer().

align(align_to: int)bool

Aligns the container to the specified size.

The container must be resizable for this method to succeed.

Parameters

align_to (int) – The alignment.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setResizable(), isResizable(), shift() and append().

append(bytes: bytes)bool

Appends data to the container.

The container must be resizable for this method to succeed.

Parameters

bytes (bytes) – The data to append.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setResizable(), isResizable(), shift() and align().

appendTo(dst_or_offset: Union[Pro.Core.NTContainer, int], size: Optional[int] = None, dst: Optional[Pro.Core.NTContainer] = None)bool

Appends this container to another container.

The other container must be resizable for this method to succeed.

Parameters
  • dst_or_offset (Union[NTContainer, int]) – Either the destination container or the start offset of the current container.

  • size (Optional[int]) – The size of the data to append.

  • dst (Optional[NTContainer]) – The destination container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setResizable(), copyTo() and copyToEx().

clear()None

Deferences the data currently being referenced by this container.

If no other container holds references to the data, the data is freed.

See also setData(), isValid() and isNull().

clone()Pro.Core.NTContainer
Returns

Returns a container holding a new reference to the internal data.

Return type

NTContainer

See also copyToNewContainer().

compare(offset: int, bytes_or_size: Union[bytes, int], b: Optional[int] = None)bool

Compares the specified data to the one in the container.

Parameters
  • offset (int) – The start offset for the comparison.

  • bytes_or_size (Union[bytes, int]) – Either the data to compare or the size to compare.

  • b (Optional[int]) – If the previous parameter is the size to compare, this parameter is the byte which to compare the data to.

Returns

Returns True if the data matches; otherwise returns False.

Return type

bool

See also read().

copyTo(offset: int, size: int, dst: Pro.Core.NTContainer, dst_offset: int = 0)bool

Copies a part of the current container to another container.

Parameters
  • offset (int) – The offset of the data to copy.

  • size (int) – The size of the data to copy.

  • dst (NTContainer) – The destination container.

  • dst_offset (int) – The offset at which to write the data to in the destination container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also copyToEx(), appendTo() and save().

copyToEx(wait: Pro.Core.NTIWait, offset: int, size: int, dst: Pro.Core.NTContainer, dst_offset: int = 0)bool

Copies a part of the current container to another container.

Parameters
  • wait (NTIWait) – The wait interface.

  • offset (int) – The offset of the data to copy.

  • size (int) – The size of the data to copy.

  • dst (NTContainer) – The destination container.

  • dst_offset (int) – The offset at which to write the data to in the destination container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also copyTo(), appendTo() and save().

copyToNewContainer()Pro.Core.NTContainer

Copies the data referenced by the current container to a new container.

This method performs a deep copy, unlike clone() which only creates a new reference.

Returns

Returns the new container if successful; otherwise returns an invalid container.

Return type

NTContainer

See also clone() and copyToNewContainerEx().

copyToNewContainerEx(wait: Pro.Core.NTIWait, offset: Optional[int] = None, size: Optional[int] = None)Pro.Core.NTContainer

Copies the data referenced by the current container to a new container.

This method performs a deep copy, unlike clone() which only creates a new reference.

Parameters
  • wait (NTIWait) – The wait interface.

  • offset (Optional[int]) – The offset of the data to copy.

  • size (Optional[int]) – The size of the data to copy.

Returns

Returns the new container if successful; otherwise returns an invalid container.

Return type

NTContainer

See also clone() and copyToNewContainer().

dataType()int
Returns

Returns the internal data type referenced by the container.

Return type

int

See also NoType, Stream, SubContainer and File.

diskFileName()str
Returns

Returns a file name if the container directly references a file on disk; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.

See also name().

equals(s: Pro.Core.NTContainer)bool

Checks whether the current container references the same data as the specified container.

Parameters

s (NTContainer) – The other container.

Returns

Returns True if container reference the same data; otherwise returns False.

Return type

bool

See also clone().

fill(offset: int, b: int, size: int)bool

Fills a portion of the container with the specified byte.

Parameters
  • offset (int) – The offset of the range to fill.

  • b (int) – The 8-bit value used for the fill operation.

  • size (int) – The size of the range to fill.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also write().

find(cb: object, ud: object, pattern: bytes, offset: int = 0, size: int = INVALID_STREAM_OFFSET, down: bool = True)bool

Searches for a specified pattern.

Example:

from Pro.Core import *

def findCallback(offset, pattern, ud):
    print(offset)
    return 0

c = NTContainer()
c.setData(b"FooBarFooBarFooBar")
c.find(findCallback, None, b"Bar")
Parameters
  • cb (object) – The callback for each match. This callback must return a value equal or bigger than zero to continue the search. To stop the search it must return a negative value.

  • ud (object) – The user data passed to the callback.

  • pattern (bytes) – The pattern to search for.

  • offset (int) – The offset of the range to search.

  • size (int) – The size of the range to search.

  • down (bool) – The search direction. If True, the search is downwards; otherwise it’s upwards.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also findFirst(), findMulti() and findMultiFirst().

findFirst(pattern: bytes, offset: int = 0, size: int = INVALID_STREAM_OFFSET, down: bool = True)Pro.Core.KROffset

Searches for the first occurrence of a specified pattern.

Example:

from Pro.Core import *

c = NTContainer()
c.setData(b"FooBarFooBarFooBar")
m = c.findFirst(b"Bar")
if m.offset != INVALID_STREAM_OFFSET:
    print(m.offset)
Parameters
  • pattern (bytes) – The pattern to search for.

  • offset (int) – The offset of the range to search.

  • size (int) – The size of the range to search.

  • down (bool) – The search direction. If True, the search is downwards; otherwise it’s upwards.

Returns

Returns the first match if any; otherwise KROffset.offset is INVALID_STREAM_OFFSET.

Return type

KROffset

See also find(), findMulti() and findMultiFirst().

findMulti(cb: object, ud: object, patterns: Pro.Core.NTByteArrayList, offset: int = 0, size: int = INVALID_STREAM_OFFSET)bool

Searches for any pattern in a specified list.

The patterns in the specified list must have the same length.

Example:

from Pro.Core import *

def findCallback(offset, pattern, ud):
    # pattern is the index of the matched pattern into the passed list of patterns
    print("offset:", offset, "pattern:", pattern)
    return 0

c = NTContainer()
c.setData(b"FooBarFooBarFooBar")

patterns = NTByteArrayList()
patterns.append(b"Foo")
patterns.append(b"Bar")
c.findMulti(findCallback, None, patterns)
Parameters
  • cb (object) – The callback for each match. This callback must return a value equal or bigger than zero to continue the search. To stop the search it must return a negative value.

  • ud (object) – The user data passed to the callback.

  • patterns (NTByteArrayList) – The list of patterns to search for.

  • offset (int) – The offset of the range to search.

  • size (int) – The size of the range to search.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also find(), findFirst() and findMultiFirst().

findMultiFirst(patterns: Pro.Core.NTByteArrayList, offset: int = 0, size: int = INVALID_STREAM_OFFSET)Pro.Core.KROffset

Searches for the first occurrence of any pattern in a specified list.

The patterns in the specified list must have the same length.

Example:

from Pro.Core import *

c = NTContainer()
c.setData(b"FooBarFooBarFooBar")

patterns = NTByteArrayList()
patterns.append(b"Foo")
patterns.append(b"Bar")
m = c.findMultiFirst(patterns)
if m.offset != INVALID_STREAM_OFFSET:
    print(m.offset, m.pattern)
Parameters
  • patterns (NTByteArrayList) – The list of patterns to search for.

  • offset (int) – The offset of the range to search.

  • size (int) – The size of the range to search.

Returns

Returns the first match if any; otherwise KROffset.offset is INVALID_STREAM_OFFSET.

Return type

KROffset

See also find(), findFirst() and findMulti().

getAddressSpace()Pro.Core.NTAddressSpace
Returns

Returns the address space of the container if present; otherwise returns an invalid address space.

Return type

NTAddressSpace

See also addAddressSpace() and hasAddressSpace().

getRange()tuple
Returns

Returns a tuple containing a boolean and two integers. If the boolean is True, then the container has a range and the two integers are the offset and the size of the range.

Return type

tuple[bool, int, int]

See also hasRange(), setRange() and resetRange().

getSubContainer()Pro.Core.NTContainer
Returns

Returns the internal container referenced by the current container if any; otherwise returns an invalid container.

Return type

NTContainer

See also setSubContainer().

hasAddressSpace()bool
Returns

Returns True if the current container has an address space; otherwise returns False.

Return type

bool

See also getAddressSpace() and addAddressSpace().

hasRange()bool
Returns

Returns True if the current container has a range; otherwise returns False.

Return type

bool

See also getRange(), setRange() and resetRange().

hasReferenceContainer()bool
Returns

Returns True if the current container has a reference container; otherwise returns False.

Return type

bool

See also referenceContainer().

isNull()bool
Returns

Returns True if the current container is invalid; otherwise returns False.

Return type

bool

See also isValid().

isResizable()bool
Returns

Returns True if the current container is resizable; otherwise returns False.

Return type

bool

See also setResizable().

isValid()bool
Returns

Returns True if the current container is valid; otherwise returns False.

Return type

bool

See also isNull().

isValidAddress(address: int)bool

Checks whether the specified address is valid in the context of the current container.

Parameters

address (int) – The address to check.

Returns

Returns True if the address is valid; otherwise returns False.

Return type

bool

See also validRange() and validRawRange().

name()str
Returns

Returns the internal name of the container. A container may have a name only if created from a named object like a file.

Return type

str

See also diskFileName(), dataType() and setData().

read(offset: int, size: int)bytes

Reads data from the container.

Parameters
  • offset (int) – The offset of the data to read.

  • size (int) – The size of the data to read.

Returns

Returns the requested data if successful; otherwise returns an empty bytes object.

Return type

bytes

See also write().

readU16BE(offset: int)tuple

Reads a big-endian 16-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU16LE() and writeU16BE().

readU16LE(offset: int)tuple

Reads a little-endian 16-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU16BE() and writeU16LE().

readU32BE(offset: int)tuple

Reads a big-endian 32-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU32LE() and writeU32BE().

readU32LE(offset: int)tuple

Reads a little-endian 32-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU32BE() and writeU32LE().

readU64BE(offset: int)tuple

Reads a big-endian 64-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU64LE() and writeU64BE().

readU64LE(offset: int)tuple

Reads a little-endian 64-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also readU64BE() and writeU64LE().

readU8(offset: int)tuple

Reads an 8-bit unsigned integer from the container.

Parameters

offset (int) – The offset of the value to read.

Returns

Returns a tuple consisting of the value and a boolean which indicates the success of the operation.

Return type

tuple[int, bool]

See also read().

referenceContainer()Pro.Core.NTContainer
Returns

Returns the reference container if any; otherwise returns None.

Return type

NTContainer

See also hasReferenceContainer().

resetRange()None

Resets the range of the container.

See also hasRange(), getRange() and setRange().

resize(new_size: int, zero: bool = True)bool

Resizes the container.

The container must be resizable for this method to succeed.

Parameters
  • new_size (int) – The new size of the container.

  • zero (bool) – If True, makes sure that additionally allocated size is initialized to zero.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

save(fname: str, offset: int = 0, size: int = INVALID_STREAM_OFFSET)bool

Copies the container, or part of it, to a specified file.

Parameters
  • fname (str) – The file name.

  • offset (int) – The offset of the range to save.

  • size (int) – The size of the range to save.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also appendTo(), copyTo() and copyToNewContainer().

setData(data: Union[NTByteArrayList, NTContainer, NTStringList, NT_FILE, NT_PROCESS, bytes, int, str], own_or_size: Union[bool, int] = True)None

Sets the internal data referenced by the container.

Parameters
  • data (Union[NTByteArrayList, NTContainer, NTStringList, NT_FILE, NT_PROCESS, bytes, int, str]) – The data to set.

  • own_or_size (Union[bool, int]) – If the data set is an NT_FILE, then the own parameter if True ensures that the file handle is automatically closed when the internal reference counter of the container reaches zero. If the data set is an 8-bit integer, then the size parameter determines how many times the 8-bit integer will be repeated.

See also dataType().

setRange(offset: int, size: int, optimize_for_speed: bool = True)None

Sets the internal range for the container.

Example:

from Pro.Core import *

c = NTContainer()
c.setData(b"Hello, world!")
# increase the reference count of c
c2 = c.clone()
# set a new range for c2
c2.setRange(7, 5)
# prints out "Hello, world!"
print(c.read(0, c.size()).decode("utf-8"))
# prints out "world"
print(c2.read(0, c2.size()).decode("utf-8"))

This is usually an inexpensive operation, unless the container has an address space and optimize_for_speed is True. In that case, the memory might be copied to allow faster I/O operations on it.

Parameters
  • offset (int) – The offset of the range.

  • size (int) – The size of the range.

  • optimize_for_speed (bool) – If True, might cause a deep copy under certain circumstances.

See also hasRange(), getRange() and resetRange().

setResizable(b: bool)None

Sets the resizable status of the container.

By default containers are not resizable.

Parameters

b (bool) – If True, the container becomes resizable.

See also isResizable().

setSubContainer(c: Pro.Core.NTContainer)None

Sets the internally referenced container.

Parameters

c (NTContainer) – The sub-container to set.

See also getSubContainer().

setTag(t: str)None

Sets an internal tag name for debugging purposes.

Parameters

t (str) – The tag name.

See also tag().

shift(size: int)bool

Appends size bytes at the end of the container and sets them to zero.

The container must be resizable for this method to succeed.

Parameters

size (int) – The amount of bytes to append.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also align(), append() and resize().

size()int
Returns

Returns the size of the container. This might be the size of the underlying data referenced by the container, the size specified by setRange() or the size returned by the address space of the container if present.

Return type

int

See also getRange() and addAddressSpace().

supportsConcurrency()bool
Returns

Returns True if the data referenced by the container supports concurrent I/O operation; otherwise returns False.

Return type

bool

See also setData().

tag()str
Returns

Returns the tag name set for debugging purposes if present; otherwise returns an empty string.

Return type

str

See also setTag().

toByteArrayList()Pro.Core.NTByteArrayList
Returns

Returns the internal byte-array list referenced by the container.

Return type

NTByteArrayList

See also dataType().

toBytes()bytes
Returns

Returns the internal bytes referenced by the container if the dataType() is Bytes; otherwise returns and empty bytes object.

Return type

bytes

See also dataType().

toContiguousProcess()Pro.Core.NTContainer

If the container references a process, this method applies an address space that makes the memory of the process appear contiguous.

Returns

Returns the contiguous memory of the process.

Return type

NTContainer

See also setData().

toFile()NT_FILE
Returns

Returns the internal file referenced by the container if the dataType() is File; otherwise returns None.

Return type

NT_FILE

Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.

See also dataType().

toProcess()NT_PROCESS
Returns

Returns the internal process referenced by the container if the dataType() is Process; otherwise returns None.

Return type

NT_PROCESS

Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.

See also dataType().

toString()str
Returns

Returns the internal string referenced by the container if the dataType() is String; otherwise returns an empty string.

Return type

str

See also dataType().

toStringList()Pro.Core.NTStringList
Returns

Returns the internal string list referenced by the container.

Return type

NTStringList

See also dataType().

validRange(offset: int, size: int)bool

Checks the validity of a range in the context of the container.

Parameters
  • offset (int) – The offset of the range to check.

  • size (int) – The size of the range to check.

Returns

Returns True if the range is valid; otherwise returns False.

Return type

bool

See also validRawRange() and isValidAddress().

validRawRange(offset: int, size: int)bool

Checks the validity of a range in the context of the container ignoring the range set on the container through setRange().

Parameters
  • offset (int) – The offset of the range to check.

  • size (int) – The size of the range to check.

Returns

Returns True if the range is valid; otherwise returns False.

Return type

bool

See also validRange() and isValidAddress().

write(offset: int, bytes_or_c: Union[Pro.Core.NTContainer, bytes])bool

Write data to the container.

Parameters
  • offset (int) – The offset at which to write the data.

  • bytes_or_c (Union[NTContainer, bytes]) – The data to write. Can be a bytes object or a container.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also read().

writeU16BE(offset: int, n: int)bool

Writes a big-endian 16-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU16LE() and readU16BE().

writeU16LE(offset: int, n: int)bool

Writes a little-endian 16-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU16BE() and readU16LE().

writeU32BE(offset: int, n: int)bool

Writes a big-endian 32-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU32LE() and readU32BE().

writeU32LE(offset: int, n: int)bool

Writes a little-endian 32-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU32BE() and readU32LE().

writeU64BE(offset: int, n: int)bool

Writes a big-endian 64-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU64LE() and readU64BE().

writeU64LE(offset: int, n: int)bool

Writes a little-endian 64-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also writeU64BE() and readU64LE().

writeU8(offset: int, n: int)bool

Writes an 8-bit unsigned integer to the container.

Parameters
  • offset (int) – The offset at which to write the value.

  • n (int) – The value to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also write().

class NTContainerBuffer(container: Pro.Core.NTContainer, endianness: int, offset: int, method: int = Bufferize_Forwards)

Bases: Pro.Core.NTBuffer

This class provides buffered read capability for NTContainer.

Parameters

See also NTBuffer and CFFBuffer.

class NTDate(y: Optional[int] = None, m: Optional[int] = None, d: Optional[int] = None)

This class provides date functions.

Optionally initializes a date from the input parameters.

Parameters
  • y (Optional[int]) – The year.

  • m (Optional[int]) – The month.

  • d (Optional[int]) – The day.

See also NTTime and NTDateTime.

Methods:

addDays(ndays)

Returns an NTDate object containing a date ndays later than the date of this object (or earlier if ndays is negative).

addMonths(nmonths)

Returns an NTDate object containing a date nmonths later than the date of this object (or earlier if nmonths is negative).

addYears(nyears)

Returns an NTDate object containing a date nyears later than the date of this object (or earlier if nyears is negative).

currentDate()

Returns the current date, as reported by the system clock.

day()

Returns the day of the month for this date.

dayOfWeek()

Returns the weekday (1 = NTMonday to 7 = NTSunday) for this date.

dayOfYear()

Returns the day of the year (1 for the first day) for this date.

daysInMonth()

Returns the number of days in the month for this date.

daysInYear()

Returns the number of days in the year for this date.

daysTo(d)

Returns the number of days from this date to d (which is negative if d is earlier than this date).

fromJulianDay(jd)

Converts the Julian day jd to an NTDate object.

fromString(string[, format])

Converts a string to an NTDate object.

isLeapYear(year)

Checks if the specified year is a leap year in the Gregorian calendar.

isNull()

Returns True if the date is null; otherwise returns False.

isValid()

Checks the validity of the current date.

month()

Returns the month-number for the date (1 = January) if the date is valid; otherwise returns 0.

setDate(year, month, day)

Sets this to represent the date, in the Gregorian calendar, with the given year, month and day numbers.

toJulianDay()

Converts the date to a Julian day.

toString([format])

Returns the date as a string.

weekNumber()

Returns the ISO 8601 week number (1 to 53).

year()

Returns the year of this date if the date is valid; otherwise returns 0.

addDays(ndays: int)Pro.Core.NTDate

Returns an NTDate object containing a date ndays later than the date of this object (or earlier if ndays is negative).

Returns a null date if the current date is invalid or the new date is out of range.

Parameters

ndays (int) – The days to add.

Returns

Returns a valid date if successful; otherwise returns a null date.

Return type

NTDate

See also addMonths(), addYears() and daysTo().

addMonths(nmonths: int)Pro.Core.NTDate

Returns an NTDate object containing a date nmonths later than the date of this object (or earlier if nmonths is negative).

Note

If the ending day/month combination does not exist in the resulting month/year, this function will return a date that is the latest valid date in the selected month.

Parameters

nmonths (int) – The months to add.

Returns

Returns a valid date if successful; otherwise returns a null date.

Return type

NTDate

See also addDays() and addYears().

addYears(nyears: int)Pro.Core.NTDate

Returns an NTDate object containing a date nyears later than the date of this object (or earlier if nyears is negative).

Note

If the ending day/month combination does not exist in the resulting year (e.g., for the Gregorian calendar, if the date was Feb 29 and the final year is not a leap year), this function will return a date that is the latest valid date in the given month (in the example, Feb 28).

Parameters

nyears (int) – The years to add.

Returns

Returns a valid date if successful; otherwise returns a null date.

Return type

NTDate

See also addMonths() and addYears().

static currentDate()Pro.Core.NTDate
Returns

Returns the current date, as reported by the system clock.

Return type

NTDate

See also NTTime.currentTime() and NTDateTime.currentDateTime().

day()int
Returns

Returns the day of the month for this date.

Return type

int

See also year(), month() and dayOfWeek().

dayOfWeek()int
Returns

Returns the weekday (1 = NTMonday to 7 = NTSunday) for this date.

Return type

int

See also day() and dayOfYear().

dayOfYear()int
Returns

Returns the day of the year (1 for the first day) for this date.

Return type

int

See also day() and dayOfWeek().

daysInMonth()int
Returns

Returns the number of days in the month for this date.

Return type

int

See also day() and daysInYear().

daysInYear()int
Returns

Returns the number of days in the year for this date.

Return type

int

See also day() and daysInMonth().

daysTo(d: Pro.Core.NTDate)int

Returns the number of days from this date to d (which is negative if d is earlier than this date).

Parameters

d (NTDate) – The date for which to compute the difference in days.

Returns

Returns the number of days or 0 if either date is invalid.

Return type

int

See also addDays().

static fromJulianDay(jd: int)Pro.Core.NTDate

Converts the Julian day jd to an NTDate object.

Parameters

jd (int) – The Julian day.

Returns

Returns the date object.

Return type

NTDate

See also toJulianDay().

static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate)NTDate

Converts a string to an NTDate object.

Parameters
  • string (str) – The string to convert.

  • format (Union[NTDateFormat, str]) – The format of the string.

Returns

Returns the converted date if successful; otherwise returns an invalid date.

Return type

NTDate

See also toString(), NTDate.fromString() and NTDateTime.fromString().

static isLeapYear(year: int)bool

Checks if the specified year is a leap year in the Gregorian calendar.

Parameters

year (int) – The year to check.

Returns

Returns True if the specified year is a leap year in the Gregorian calendar; otherwise returns False.

Return type

bool

isNull()bool
Returns

Returns True if the date is null; otherwise returns False.

Return type

bool

See also isValid().

isValid()bool

Checks the validity of the current date.

Returns

Returns True if the date is valid; otherwise returns False.

Return type

bool

See also isNull().

month()int
Returns

Returns the month-number for the date (1 = January) if the date is valid; otherwise returns 0.

Return type

int

See also year() and day().

setDate(year: int, month: int, day: int)bool

Sets this to represent the date, in the Gregorian calendar, with the given year, month and day numbers.

Parameters
  • year (int) – The year.

  • month (int) – The month.

  • day (int) – The day.

Returns

Returns True if the resulting date is valid; otherwise returns False.

Return type

bool

See also isValid().

toJulianDay()int

Converts the date to a Julian day.

Returns

Returns the Julian day.

Return type

int

See also fromJulianDay().

toString(format: Union[NTDateFormat, str] = NTTextDate)str

Returns the date as a string. The format parameter determines the format of the string.

Parameters

format (Union[NTDateFormat, str]) – Optionally specify the format of the string.

Returns

Returns the date string if successful; otherwise returns an empty string.

Return type

str

See also fromString().

weekNumber()int

Returns the ISO 8601 week number (1 to 53).

Returns

Returns the week number if the date is valid; otherwise returns 0.

Return type

int

See also isValid().

year()int
Returns

Returns the year of this date if the date is valid; otherwise returns 0.

Return type

int

See also month() and day().

class NTDateTime(date: Optional[NTDate] = None, time: Optional[NTTime] = None, spec: NTTimeSpec = NTLocalTime)

This class provides date and time functions.

Optionally constructs the NTDateTime from an NTTime and an NTDate.

Parameters
  • date (Optional[NTDate]) – The date object.

  • time (Optional[NTTime]) – The time object.

  • spec (NTTimeSpec) – Time specification. The default is NTLocalTime.

See also NTTime and NTDate.

Methods:

addDays(ndays)

Returns an NTDateTime object containing a datetime ndays days later than the datetime of this object (or earlier if ndays is negative).

addMSecs(msecs)

Returns an NTDateTime object containing a datetime msecs milliseconds later than the datetime of this object (or earlier if msecs is negative).

addMonths(nmonths)

Returns an NTDateTime object containing a datetime nmonths months later than the datetime of this object (or earlier if nmonths is negative).

addSecs(s)

Returns an NTDateTime object containing a datetime s seconds later than the datetime of this object (or earlier if s is negative).

addYears(nyears)

Returns an NTDateTime object containing a datetime nyears years later than the datetime of this object (or earlier if nyears is negative).

currentDateTime()

Returns the current datetime, as reported by the system clock, in the local time zone.

currentDateTimeUtc()

Returns the current datetime, as reported by the system clock, in UTC.

currentMSecsSinceEpoch()

Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. This number is like the POSIX time_t variable, but expressed in milliseconds instead.

date()

Returns the date part of the datetime.

daysTo(other)

Returns the number of days from this datetime to the other datetime.

fromMSecsSinceEpoch(msecs[, spec, offsetSeconds])

Returns a datetime whose date and time are the number of milliseconds, msecs, that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC), and converted to NTLocalTime.

fromString(string[, format])

Returns the datetime represented by string using the format format.

fromTime_t(seconds[, spec, offsetSeconds])

Returns a datetime whose date and time are the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC).

isDaylightTime()

Returns True if this datetime falls in Daylight-Saving Time; otherwise returns False.

isNull()

Returns True if both the date and the time are null; otherwise returns False.

isValid()

Returns True if both the date and the time are valid and they are valid in the current NTTimeSpec; otherwise returns False.

msecsTo(other)

Returns the number of milliseconds from this datetime to the other datetime.

offsetFromUtc()

Returns this datetime’s Offset From UTC in seconds.

secsTo(other)

Returns the number of seconds from this datetime to the other datetime.

setDate(date)

Sets the date part of this datetime to date.

setMSecsSinceEpoch(msecs)

Sets the date and time given the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC).

setOffsetFromUtc(offsetSeconds)

Sets the timeSpec() to NTOffsetFromUTC and the offset to offsetSeconds.

setTime(time)

Sets the time part of this datetime to time.

setTimeSpec(spec)

Sets the time specification used in this datetime to spec.

setTime_t(seconds)

Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC).

swap(other)

Swaps this datetime with other.

time()

Returns the time part of the datetime.

timeSpec()

Returns the time specification of the datetime.

timeZoneAbbreviation()

Returns the Time Zone Abbreviation for the datetime.

toLocalTime()

Returns a datetime containing the date and time information in this datetime, but specified using the NTLocalTime definition.

toMSecsSinceEpoch()

Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC).

toOffsetFromUtc(offsetSeconds)

Returns a copy of this datetime converted to a specification of NTOffsetFromUTC with the given offsetSeconds.

toString([format])

Returns the datetime as a string in the given format.

toTimeSpec(spec)

Returns a copy of this datetime converted to the given time spec.

toTime_t()

Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC).

toUTC()

Returns a datetime containing the date and time information in this datetime, but specified using the NTUTC definition.

addDays(ndays: int)Pro.Core.NTDateTime

Returns an NTDateTime object containing a datetime ndays days later than the datetime of this object (or earlier if ndays is negative).

Note

If the timeSpec() is NTLocalTime and the resulting date and time fall in the Standard Time to Daylight-Saving Time transition hour then the result will be adjusted accordingly, i.e. if the transition is at 2am and the clock goes forward to 3am and the result falls between 2am and 3am then the result will be adjusted to fall after 3am.

Parameters

ndays (int) – The days to add.

Returns

Returns a valid datetime if successful; otherwise returns a null datetime.

Return type

NTDateTime

See also daysTo(), addMonths(), addYears() and addSecs().

addMSecs(msecs: int)Pro.Core.NTDateTime

Returns an NTDateTime object containing a datetime msecs milliseconds later than the datetime of this object (or earlier if msecs is negative).

Parameters

msecs (int) – The milliseconds to add.

Returns

Returns a valid datetime if successful; otherwise returns a null datetime.

Return type

NTDateTime

See also msecsTo(), addSecs(), addDays(), addMonths() and addYears().

addMonths(nmonths: int)Pro.Core.NTDateTime

Returns an NTDateTime object containing a datetime nmonths months later than the datetime of this object (or earlier if nmonths is negative).

Note

If the timeSpec() is NTLocalTime and the resulting date and time fall in the Standard Time to Daylight-Saving Time transition hour then the result will be adjusted accordingly, i.e. if the transition is at 2am and the clock goes forward to 3am and the result falls between 2am and 3am then the result will be adjusted to fall after 3am.

Parameters

nmonths (int) – The months to add.

Returns

Returns a valid datetime if successful; otherwise returns a null datetime.

Return type

NTDateTime

See also daysTo(), addDays(), addYears() and addSecs().

addSecs(s: int)Pro.Core.NTDateTime

Returns an NTDateTime object containing a datetime s seconds later than the datetime of this object (or earlier if s is negative).

Parameters

s (int) – The seconds to add.

Returns

Returns a valid datetime if successful; otherwise returns a null datetime.

Return type

NTDateTime

See also addMSecs(), secsTo(), addDays(), addMonths() and addYears().

addYears(nyears: int)Pro.Core.NTDateTime

Returns an NTDateTime object containing a datetime nyears years later than the datetime of this object (or earlier if nyears is negative).

Parameters

nyears (int) – The years to add.

Returns

Returns a valid datetime if successful; otherwise returns a null datetime.

Return type

NTDateTime

See also daysTo(), addDays(), addMonths() and addSecs().

static currentDateTime()Pro.Core.NTDateTime
Returns

Returns the current datetime, as reported by the system clock, in the local time zone.

Return type

NTDateTime

See also currentDateTimeUtc(), NTTime.currentTime(), NTDate.currentDate() and toTimeSpec().

static currentDateTimeUtc()Pro.Core.NTDateTime
Returns

Returns the current datetime, as reported by the system clock, in UTC.

Return type

NTDateTime

See also currentDateTime(), NTTime.currentTime(), NTDate.currentDate() and toTimeSpec().

static currentMSecsSinceEpoch()int
Returns

Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. This number is like the POSIX time_t variable, but expressed in milliseconds instead.

Return type

int

See also currentDateTime(), currentDateTimeUtc(), toTime_t() and toTimeSpec().

date()Pro.Core.NTDate
Returns

Returns the date part of the datetime.

Return type

NTDate

See also setDate(), time() and timeSpec().

daysTo(other: Pro.Core.NTDateTime)int

Returns the number of days from this datetime to the other datetime.

The number of days is counted as the number of times midnight is reached between this datetime to the other datetime. This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day.

If the other datetime is earlier than this datetime, the value returned is negative.

Parameters

other (NTDateTime) – The datetime for which to compute the difference in days.

Returns

Returns the computed difference in days or 0 if either datetime is invalid.

Return type

int

See also addDays(), secsTo() and msecsTo().

static fromMSecsSinceEpoch(msecs: int, spec: Optional[NTTimeSpec] = None, offsetSeconds: int = 0)NTDateTime

Returns a datetime whose date and time are the number of milliseconds, msecs, that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC), and converted to NTLocalTime. On systems that do not support time zones, the time will be set as if local time were NTUTC.

Parameters
  • msecs (int) – The milliseconds to convert.

  • spec (Optional[NTTimeSpec]) – The time specification.

  • offsetSeconds (int) – If this value is not NTOffsetFromUTC then offsetSeconds will be ignored. If this value is NTOffsetFromUTC and offsetSeconds is 0 then this value will be set to NTUTC, i.e. an offset of 0 seconds.

Returns

Returns the computed datetime if successful; otherwise returns an invalid datetime.

Return type

NTDateTime

See also toMSecsSinceEpoch() and setMSecsSinceEpoch().

static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate)NTDateTime

Returns the datetime represented by string using the format format.

Parameters
  • string (str) – The datetime string.

  • format (Union[NTDateFormat, str]) – The format.

Returns

Returns the converted datetime if successful; otherwise returns an invalid datetime.

Return type

NTDateTime

See also toString().

static fromTime_t(seconds: int, spec: Optional[NTTimeSpec] = None, offsetSeconds: int = 0)NTDateTime

Returns a datetime whose date and time are the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC). On systems that do not support time zones, the time will be set as if local time were NTUTC.

Parameters
  • seconds (int) – The seconds to convert.

  • spec (Optional[NTTimeSpec]) – The time specification.

  • offsetSeconds (int) – If this value is not NTOffsetFromUTC then offsetSeconds will be ignored. If this value is NTOffsetFromUTC and offsetSeconds is 0 then this value will be set to NTUTC, i.e. an offset of 0 seconds.

Returns

Returns the converted datetime if successful; otherwise returns an invalid datetime.

Return type

NTDateTime

See also toTime_t() and setTime_t().

isDaylightTime()bool
Returns

Returns True if this datetime falls in Daylight-Saving Time; otherwise returns False.

Return type

bool

See also timeSpec().

isNull()bool
Returns

Returns True if both the date and the time are null; otherwise returns False.

Return type

bool

See also isValid(), NTTime.isNull() and NTDate.isNull().

isValid()bool
Returns

Returns True if both the date and the time are valid and they are valid in the current NTTimeSpec; otherwise returns False.

Return type

bool

See also isNull(), NTTime.isValid() and NTDate.isValid().

msecsTo(other: Pro.Core.NTDateTime)int

Returns the number of milliseconds from this datetime to the other datetime. If the other datetime is earlier than this datetime, the value returned is negative.

Before performing the comparison, the two datetimes are converted to NTUTC to ensure that the result is correct if daylight-saving (DST) applies to one of the two datetimes but not the other.

Parameters

other (NTDateTime) – The datetime for which to compute the difference in milliseconds.

Returns

Returns the computed difference in milliseconds or 0 if either datetime is invalid.

Return type

int

See also addMSecs(), daysTo() and NTTime.msecsTo().

offsetFromUtc()int

Returns this datetime’s Offset From UTC in seconds.

The result depends on timeSpec():

  • NTUTC - The offset is 0.

  • NTOffsetFromUTC - The offset is the value originally set.

  • NTLocalTime - The local time’s offset from UTC is returned.

  • NTTimeZone - The offset used by the time-zone is returned.

For the last two, the offset at this date and time will be returned, taking account of Daylight-Saving Offset unless the date precedes the start of 1970. The offset is the difference between the local time or time in the given time-zone and UTC time; it is positive in time-zones ahead of UTC (East of The Prime Meridian), negative for those behind UTC (West of The Prime Meridian).

Returns

Returns the offset from UTC in seconds.

Return type

int

See also setOffsetFromUtc().

secsTo(other: Pro.Core.NTDateTime)int

Returns the number of seconds from this datetime to the other datetime. If the other datetime is earlier than this datetime, the value returned is negative.

Before performing the comparison, the two datetimes are converted to NTUTC to ensure that the result is correct if daylight-saving (DST) applies to one of the two datetimes but not the other.

Parameters

other (NTDateTime) – The datetime for which to compute the difference in seconds.

Returns

Returns the computed difference in seconds or 0 if either datetime is invalid.

Return type

int

See also addSecs(), daysTo() and NTTime.secsTo().

setDate(date: Pro.Core.NTDate)None

Sets the date part of this datetime to date. If no time is set yet, it is set to midnight. If date is invalid, this datetime becomes invalid.

Parameters

date (NTDate) – The date to set.

See also date(), setTime() and setTimeSpec().

setMSecsSinceEpoch(msecs: int)None

Sets the date and time given the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC). On systems that do not support time zones this function will behave as if local time were NTUTC.

Parameters

msecs (int) – The milliseconds to set.

See also toMSecsSinceEpoch() and fromMSecsSinceEpoch().

setOffsetFromUtc(offsetSeconds: int)None

Sets the timeSpec() to NTOffsetFromUTC and the offset to offsetSeconds. The datetime will refer to a different point in time.

The maximum and minimum offset is 14 positive or negative hours. If offsetSeconds is larger or smaller than that, then the result is undefined.

If offsetSeconds is 0 then the timeSpec() will be set to NTUTC.

Parameters

offsetSeconds (int) – The offset in seconds from UTC.

See also isValid() and offsetFromUtc().

setTime(time: Pro.Core.NTTime)None

Sets the time part of this datetime to time. If time is not valid, this function sets it to midnight.

Parameters

time (NTTime) – The time to set.

See also time(), setDate() and setTimeSpec().

setTimeSpec(spec: NTTimeSpec)None

Sets the time specification used in this datetime to spec. The datetime will refer to a different point in time.

If spec is NTOffsetFromUTC then the timeSpec() will be set to NTUTC, i.e. an effective offset of 0.

If spec is NTTimeZone then the spec will be set to NTLocalTime, i.e. the current system time zone.

Parameters

spec (NTTimeSpec) – The time specification to set.

See also timeSpec(), setDate() and setTime().

setTime_t(seconds: int)None

Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC). On systems that do not support time zones this function will behave as if local time were NTUTC.

Parameters

seconds (int) – The seconds to convert.

See also toTime_t().

swap(other: Pro.Core.NTDateTime)None

Swaps this datetime with other.

Parameters

other (NTDateTime) – The datetime to swap with.

time()Pro.Core.NTTime
Returns

Returns the time part of the datetime.

Return type

NTTime

See also setTime(), date() and timeSpec().

timeSpec()NTTimeSpec
Returns

Returns the time specification of the datetime.

Return type

NTTimeSpec

See also setTimeSpec(), date() and time().

timeZoneAbbreviation()str
Returns

Returns the Time Zone Abbreviation for the datetime.

Return type

str

See also timeSpec().

toLocalTime()Pro.Core.NTDateTime
Returns

Returns a datetime containing the date and time information in this datetime, but specified using the NTLocalTime definition.

Return type

NTDateTime

See also toTimeSpec().

toMSecsSinceEpoch()int

Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (NTUTC).

On systems that do not support time zones, this function will behave as if local time were NTUTC.

Returns

Returns the number of milliseconds.

Return type

int

See also fromMSecsSinceEpoch() and setMSecsSinceEpoch().

toOffsetFromUtc(offsetSeconds: int)Pro.Core.NTDateTime

Returns a copy of this datetime converted to a specification of NTOffsetFromUTC with the given offsetSeconds.

If the offsetSeconds equals 0 then a UTC datetime will be returned

Parameters

offsetSeconds (int) – The offset from UTC in seconds.

Returns

Returns the computed datetime.

Return type

NTDateTime

See also setOffsetFromUtc(), offsetFromUtc() and toTimeSpec().

toString(format: Union[NTDateFormat, str] = NTTextDate)str

Returns the datetime as a string in the given format.

Parameters

format (Union[NTDateFormat, str]) – The format of the string.

Returns

Returns the datetime as a string if it could be converted; otherwise returns an empty string.

Return type

str

See also fromString(), NTTime.toString() and NTDate.toString().

toTimeSpec(spec: NTTimeSpec)NTDateTime

Returns a copy of this datetime converted to the given time spec.

If spec is NTOffsetFromUTC then it is set to NTUTC. To set to a spec of NTOffsetFromUTC use toOffsetFromUtc().

If spec is NTTimeZone then it is set to NTLocalTime, i.e. the local Time Zone.

Parameters

spec (NTTimeSpec) – The time specification.

Returns

Returns the converted datetime.

Return type

NTDateTime

See also timeSpec() and toOffsetFromUtc().

toTime_t()int
Returns

Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (NTUTC).

Return type

int

See also fromTime_t() and setTime_t().

toUTC()Pro.Core.NTDateTime
Returns

Returns a datetime containing the date and time information in this datetime, but specified using the NTUTC definition.

Return type

NTDateTime

See also toTimeSpec().

NTDefaultLocaleLongDate: Final[int]

The long date format used by the application’s locale.

See also NTTime, NTDate and NTDateTime.

NTDefaultLocaleShortDate: Final[int]

The short date format specified by the application’s locale.

See also NTTime, NTDate and NTDateTime.

class NTDoubleList

List of float elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: float)None

Inserts value at the end of the list.

Parameters

value (float) – The value to add to the list.

See also insert().

at(i: int)float

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

float

clear()None

Removes all items from the list.

contains(value: float)bool

Checks the presence of an element in the list.

Parameters

value (float) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: float)int

Returns the number of occurrences of value in the list.

Parameters

value (float) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: float, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (float) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: float)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (float) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTDoubleListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTDoubleListIt

removeAll(value: float)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (float) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)float

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

float

See also removeAt().

class NTDoubleListIt(obj: Pro.Core.NTDoubleList)

Iterator class for NTDoubleList.

Parameters

obj (NTDoubleList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()float
Returns

Returns the next item and advances the iterator by one position.

Return type

float

See also hasNext() and previous().

previous()float
Returns

Returns the previous item and moves the iterator back by one position.

Return type

float

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTDoubleVector

Vector list of float elements. The difference with normal lists is that vector lists are contiguous in memory.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: float)None

Inserts value at the end of the vector.

Parameters

value (float) – The value to add to the list.

See also insert().

at(i: int)float

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

float

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: float)bool

Checks the presence of an element in the vector.

Parameters

value (float) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: float)int

Returns the number of occurrences of value in the vector.

Parameters

value (float) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: float, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (float) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: float)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (float) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTDoubleVectorIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

NTDoubleVectorIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class NTDoubleVectorIt(obj: Pro.Core.NTDoubleVector)

Iterator class for NTDoubleVector.

Parameters

obj (NTDoubleVector) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()float
Returns

Returns the next item and advances the iterator by one position.

Return type

float

See also hasNext() and previous().

previous()float
Returns

Returns the previous item and moves the iterator back by one position.

Return type

float

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTFileEnum(path: Optional[str] = None)

This class enumerates files from a specified path.

Example:

from Pro.Core import NTFileEnum

fe = NTFileEnum(".")
while True:
    res, name = fe.next()
    if not res:
        break
    print(name)
Parameters

path (Optional[str]) – The input path.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

Methods:

getPath()

Returns the input path.

init(path)

Sets a new input path.

next()

Retrieves the next file name.

nextFullPath()

Retrieves the next file name with its full path.

getPath()str
Returns

Returns the input path.

Return type

str

init(path: str)None

Sets a new input path.

Parameters

path (str) – The input path.

See also next() and nextFullPath().

next()tuple

Retrieves the next file name.

Returns

Returns a tuple containing a boolean and a string. If the boolean is False, the enumeration has finished. The string represents the returned file name.

Return type

tuple[bool, str]

See also nextFullPath().

nextFullPath()tuple

Retrieves the next file name with its full path.

Returns

Returns a tuple containing a boolean and a string. If the boolean is False, the enumeration has finished. The string represents the returned full path file name.

Return type

tuple[bool, str]

See also next().

NTFileOpt_CreateNew: Final[int]

Creates the file only if it doesn’t already exist.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also NT_CreateFile().

NTFileOpt_ReadOnly: Final[int]

Read-only file access.

See also NT_OpenFile() and NT_CreateFile().

NTFileOpt_ShareWrite: Final[int]

Shared write file access. This option may not be supported by all systems.

See also NT_OpenFile() and NT_CreateFile().

NTFileOpt_Write: Final[int]

Read/write file access.

See also NT_OpenFile() and NT_CreateFile().

NTFlagOutput_IgnoreUnknown: Final[int]

Ignores unknown flags and options.

See also CFFFlags.Output().

NTFriday: Final[int]

Fifth day of the week.

See also NTDate.dayOfWeek().

NTISODate: Final[int]

ISO 8601 extended date format: either yyyy-MM-dd for dates or yyyy-MM-ddTHH:mm:ss (e.g. 2017-07-24T15:46:29), or with a time-zone suffix (Z for UTC otherwise an offset as [+|-]HH:mm) where appropriate for combined dates and times.

See also NTTime, NTDate and NTDateTime.

class NTIWait

Interface for wait objects.

Derived classes may only implement a limited number of methods.

This class is implemented by the UI module to provide a wait-dialog.

See also NTSimpleWait.

Attributes:

HasMessage2

Shows a secondary message of the wait-dialog.

HasProgress2

Shows a secondary progress-bar of the wait-dialog.

NoAbort

Hides the abort button of the wait-dialog.

NoMessage

Hides the primary message of the wait-dialog.

NoProgress

Hides the primary progress-bar of the wait-dialog.

Methods:

abort()

Aborts the wait operation.

isWaiting()

Checks whether a wait operation is in progress.

log(t)

Logs a message.

logMsg(str)

Logs a message.

message(t)

Sets the primary message of the wait-dialog.

message2(t)

Sets the secondary message of the wait-dialog.

messageInferior(t)

Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.

msg(str)

Sets the primary message of the wait-dialog.

msg2(str)

Sets the secondary message of the wait-dialog.

msgInferior(str)

Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.

processEvents()

Processes pending thread events.

progress(i)

Sets the value of the primary progress-bar of the wait-dialog.

progress2(i)

Sets the value of the secondary progress-bar of the wait-dialog.

progressInferior(i)

Sets the value of the secondary progress-bar of the wait-dialog if present; otherwise sets the value of the primary progress-bar.

returnCode()

Retrieves the return code for the wait operation.

setRange(min, max)

Sets the range for the primary progress-bar of the wait-dialog.

setRange2(min, max)

Sets the range for the secondary progress-bar of the wait-dialog.

setRangeInferior(min, max)

Sets the range for the secondary progress-bar of the wait-dialog if present; otherwise sets the range for the primary progress-bar.

setReturnCode(code)

Sets the return code for the wait object.

start(str[, flags])

Starts the wait operation.

stop()

Stops the wait operation gracefully.

waitFlags()

Returns the wait flags set on the wait object.

wasAborted()

Checks whether the wait operation was aborted.

HasMessage2: Final[int]

Shows a secondary message of the wait-dialog.

HasProgress2: Final[int]

Shows a secondary progress-bar of the wait-dialog.

NoAbort: Final[int]

Hides the abort button of the wait-dialog.

NoMessage: Final[int]

Hides the primary message of the wait-dialog.

NoProgress: Final[int]

Hides the primary progress-bar of the wait-dialog.

abort()None

Aborts the wait operation.

Note

This method can be overwritten by derived classes.

See also wasAborted(), stop() and isWaiting().

isWaiting()bool

Checks whether a wait operation is in progress.

Note

This method can be overwritten by derived classes.

Returns

Returns True if waiting; otherwise returns False.

Return type

bool

See also stop(), abort() and wasAborted().

log(t: str)None

Logs a message.

When implemented, it calls proPrintnl() internally.

Parameters

t (str) – The message to log.

See also message().

logMsg(str: str)None

Logs a message.

Note

This method can be overwritten by derived classes.

Does the same as log().

When implemented, it calls proPrintnl() internally.

Parameters

str (str) – The message to log.

See also log() and message().

message(t: str)None

Sets the primary message of the wait-dialog.

Parameters

t (str) – The message to set.

See also message2() and messageInferior().

message2(t: str)None

Sets the secondary message of the wait-dialog.

Parameters

t (str) – The message to set.

See also message() and messageInferior().

messageInferior(t: str)None

Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.

Parameters

t (str) – The message to set.

See also message() and message2().

msg(str: str)None

Sets the primary message of the wait-dialog.

Note

This method can be overwritten by derived classes.

Does the same as message().

Parameters

str (str) – The message to set.

See also message().

msg2(str: str)None

Sets the secondary message of the wait-dialog.

Note

This method can be overwritten by derived classes.

Does the same as message2().

Parameters

str (str) – The message to set.

See also message2().

msgInferior(str: str)None

Sets the secondary message of the wait-dialog if present; otherwise sets the primary message.

Does the same as messageInferior().

Parameters

str (str) – The message to set.

See also messageInferior().

processEvents()None

Processes pending thread events.

Note

This method can be overwritten by derived classes.

When implemented, it calls proProcessEvents() at safe intervals using NTTimer.

See also proProcessEvents().

progress(i: int)None

Sets the value of the primary progress-bar of the wait-dialog.

Note

This method can be overwritten by derived classes.

Parameters

i (int) – The value to set.

See also progress2() and progressInferior().

progress2(i: int)None

Sets the value of the secondary progress-bar of the wait-dialog.

Note

This method can be overwritten by derived classes.

Parameters

i (int) – The value to set.

See also progress() and progressInferior().

progressInferior(i: int)None

Sets the value of the secondary progress-bar of the wait-dialog if present; otherwise sets the value of the primary progress-bar.

Parameters

i (int) – The value to set.

See also progress() and progress2().

returnCode()int

Retrieves the return code for the wait operation.

Note

This method can be overwritten by derived classes.

Returns

Returns the return code set by calling setReturnCode().

Return type

int

See also setReturnCode().

setRange(min: int, max: int)None

Sets the range for the primary progress-bar of the wait-dialog.

Note

This method can be overwritten by derived classes.

Parameters
  • min (int) – The minimum value.

  • max (int) – The maximum value.

See also setRange2() and setRangeInferior().

setRange2(min: int, max: int)None

Sets the range for the secondary progress-bar of the wait-dialog.

Note

This method can be overwritten by derived classes.

Parameters
  • min (int) – The minimum value.

  • max (int) – The maximum value.

See also setRange() and setRangeInferior().

setRangeInferior(min: int, max: int)None

Sets the range for the secondary progress-bar of the wait-dialog if present; otherwise sets the range for the primary progress-bar.

Parameters
  • min (int) – The minimum value.

  • max (int) – The maximum value.

See also setRange() and setRange2().

setReturnCode(code: int)None

Sets the return code for the wait object.

Note

This method can be overwritten by derived classes.

Parameters

code (int) – The return code to set.

See also returnCode().

start(str: str, flags: int = 0)None

Starts the wait operation.

Parameters
  • str (str) – The primary message of the wait object.

  • flags (int) – The flags of the wait object (e.g., NoAbort).

Available since Cerbero Suite 6.0 and Cerbero Engine 3.0.

See also stop(), isWaiting(), abort() and wasAborted().

stop()None

Stops the wait operation gracefully.

Note

This method can be overwritten by derived classes.

See also start(), isWaiting(), abort() and wasAborted().

waitFlags()int
Returns

Returns the wait flags set on the wait object.

Return type

int

wasAborted()bool

Checks whether the wait operation was aborted.

Note

This method can be overwritten by derived classes.

Returns

Returns True if the wait operation was aborted; otherwise returns False.

Return type

bool

See also abort(), isWaiting() and stop().

class NTIntList

List of int elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: int)None

Inserts value at the end of the list.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all items from the list.

contains(value: int)bool

Checks the presence of an element in the list.

Parameters

value (int) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the list.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTIntListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTIntListIt

removeAll(value: int)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (int) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)int

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

int

See also removeAt().

class NTIntListIt(obj: Pro.Core.NTIntList)

Iterator class for NTIntList.

Parameters

obj (NTIntList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTIntVariantHash

Dictionary of int -> BasicType elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: int)bool

Checks whether key is present in the hash.

Parameters

key (int) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: int)int

Counts the numbers of values associated with key in the hash.

Parameters

key (int) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: int, value: Optional[Union[int, float, bool, bytes, str]])None

Inserts a new item with key and a value of value.

Parameters
  • key (int) – The key.

  • value (BasicType) – The value.

See also insertMulti().

insertMulti(key: int, value: Optional[Union[int, float, bool, bytes, str]])None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (int) – The key.

  • value (BasicType) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTIntVariantHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTIntVariantHashIt

remove(key: int)int

Removes all the items that have key from the hash.

Parameters

key (int) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: int)Optional[Union[int, float, bool, bytes, str]]

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (int) – The key.

Returns

Returns the removed value.

Return type

BasicType

See also remove().

value(key: int, defaultValue: Optional[Union[int, float, bool, bytes, str]] = None)Optional[Union[int, float, bool, bytes, str]]

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (int) – The key.

  • defaultValue (Optional[BasicType]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

BasicType

See also contains().

class NTIntVariantHashIt(obj: Pro.Core.NTIntVariantHash)

Iterator class for NTIntVariantHash.

Parameters

obj (NTIntVariantHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()int
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

int

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[int, BasicType]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[int, BasicType]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()Optional[Union[int, float, bool, bytes, str]]
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

BasicType

See also key().

class NTIntVector

Vector list of int elements. The difference with normal lists is that vector lists are contiguous in memory.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: int)None

Inserts value at the end of the vector.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: int)bool

Checks the presence of an element in the vector.

Parameters

value (int) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the vector.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTIntVectorIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

NTIntVectorIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class NTIntVectorIt(obj: Pro.Core.NTIntVector)

Iterator class for NTIntVector.

Parameters

obj (NTIntVector) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

NTLocalTime: Final[int]

Local time, controlled by a system time-zone setting.

See also NTDateTime.

class NTMaxUIntList

List of int elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: int)None

Inserts value at the end of the list.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all items from the list.

contains(value: int)bool

Checks the presence of an element in the list.

Parameters

value (int) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the list.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTMaxUIntListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTMaxUIntListIt

removeAll(value: int)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (int) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)int

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

int

See also removeAt().

class NTMaxUIntListIt(obj: Pro.Core.NTMaxUIntList)

Iterator class for NTMaxUIntList.

Parameters

obj (NTMaxUIntList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTMaxUIntTree

Tree of NTMaxUIntTreeNode nodes.

Methods:

appendChild(parent, value)

Adds a node to the children of the specified parent node.

children(parent)

Returns the number of child nodes for the specified parent node.

childrenList(parent)

Returns the list of child nodes for the specified parent node.

clear()

Removes all nodes from the tree.

clearChildren(parent)

Removes all the child nodes of the specified parent node.

enableIDs(b)

Enables id-based look-up for nodes.

insertChild(parent, pos, value)

Inserts a new node into the list of child nodes of the specified parent node at a given position.

nextSibling(node)

Returns the next sibling of a node.

node(nid_or_parent[, pos])

Returns a node given a parent and a child index or, alternatively, given a node id.

nodeId(node)

Returns the node id for the specified node.

parentNode(node)

Retrieves the parent node for the specified node.

position(node)

Returns the position of the specified node related its siblings.

prependChild(parent, value)

Prepends a node to the children of the specified parent node.

previousSibling(node)

Returns the previous sibling of a node.

remove(node)

Removes a node from the tree.

removeChild(parent, pos)

Removes a child node at a specified position.

siblings(node)

Returns the number of siblings of the specified node.

swap(node, newPos)

Swaps two sibling nodes.

appendChild(parent: Pro.Core.NTMaxUIntTreeNode, value: int)Pro.Core.NTMaxUIntTreeNode

Adds a node to the children of the specified parent node.

Parameters
  • parent (NTMaxUIntTreeNode) – The parent node. This value can be None to add a root-level node.

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTMaxUIntTreeNode

See also prependChild() and insertChild().

children(parent: Pro.Core.NTMaxUIntTreeNode)int

Returns the number of child nodes for the specified parent node.

Parameters

parent (NTMaxUIntTreeNode) – The parent node. This value can be None to retrieve the number of root-level nodes.

Returns

Returns the number of child nodes.

Return type

int

See also childrenList(), siblings() and parentNode().

childrenList(parent: Pro.Core.NTMaxUIntTreeNode)Pro.Core.NTMaxUIntTreeNodeList

Returns the list of child nodes for the specified parent node.

Parameters

parent (NTMaxUIntTreeNode) – The parent node. This value can be None to retrieve the list of root-level nodes.

Returns

Returns the list of child nodes.

Return type

NTMaxUIntTreeNodeList

See also children(), siblings() and parentNode().

clear()None

Removes all nodes from the tree.

See also clearChildren().

clearChildren(parent: Pro.Core.NTMaxUIntTreeNode)None

Removes all the child nodes of the specified parent node.

Parameters

parent (NTMaxUIntTreeNode) – The parent node.

See also clear().

enableIDs(b: bool)None

Enables id-based look-up for nodes. This method must be called before adding nodes to the tree. By default id-based look-up is not enabled.

Parameters

b (bool) – Must be True to enable id-based look-up.

See also node() and nodeId().

insertChild(parent: Pro.Core.NTMaxUIntTreeNode, pos: int, value: int)Pro.Core.NTMaxUIntTreeNode

Inserts a new node into the list of child nodes of the specified parent node at a given position.

Parameters
  • parent (NTMaxUIntTreeNode) – The parent node. This value can be None to insert a root-level node.

  • pos (int) – The position where to insert the child node. An value of 0 is the same as calling prependChild(). A value of children() is the same as calling appendChild().

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTMaxUIntTreeNode

See also appendChild() and prependChild().

nextSibling(node: Pro.Core.NTMaxUIntTreeNode)Pro.Core.NTMaxUIntTreeNode

Returns the next sibling of a node.

Parameters

node (NTMaxUIntTreeNode) – The node for which to retrieve the sibling.

Returns

Returns the sibling node if available; otherwise returns None.

Return type

NTMaxUIntTreeNode

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also previousSibling().

node(nid_or_parent: Union[Pro.Core.NTMaxUIntTreeNode, int], pos: Optional[int] = None)Pro.Core.NTMaxUIntTreeNode

Returns a node given a parent and a child index or, alternatively, given a node id. To retrieve nodes by id, enableIDs() must have been called first.

Parameters
  • nid_or_parent (Union[NTMaxUIntTreeNode, int]) – Can be either a parent node or a node id.

  • pos (Optional[int]) – The child index. This parameter can be used only when a parent node is specified.

Returns

Returns the requested node. If the node couldn’t be found, the return value is None.

Return type

NTMaxUIntTreeNode

See also enableIDs().

nodeId(node: Pro.Core.NTMaxUIntTreeNode)int

Returns the node id for the specified node. enableIDs() must have been called first in order for nodes to have valid ids.

Parameters

node (NTMaxUIntTreeNode) – The node for which to retrieve the node id.

Returns

Returns the node id.

Return type

int

See also enableIDs() and node().

parentNode(node: Pro.Core.NTMaxUIntTreeNode)Pro.Core.NTMaxUIntTreeNode

Retrieves the parent node for the specified node.

Parameters

node (NTMaxUIntTreeNode) – The node for which to retrieve the parent node.

Returns

Returns the parent node. If the specified node is a root-level node, then the method returns None.

Return type

NTMaxUIntTreeNode

See also childrenList() and node().

position(node: Pro.Core.NTMaxUIntTreeNode)int

Returns the position of the specified node related its siblings.

Parameters

node (NTMaxUIntTreeNode) – The node for which to retrieve the position. This value can be None to retrieve the position of a root-level node.

Returns

Returns the index position.

Return type

int

See also children() and siblings().

prependChild(parent: Pro.Core.NTMaxUIntTreeNode, value: int)Pro.Core.NTMaxUIntTreeNode

Prepends a node to the children of the specified parent node.

Parameters
  • parent (NTMaxUIntTreeNode) – The parent node. This value can be None to prepend a root-level node.

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTMaxUIntTreeNode

See also appendChild() and insertChild().

previousSibling(node: Pro.Core.NTMaxUIntTreeNode)Pro.Core.NTMaxUIntTreeNode

Returns the previous sibling of a node.

Parameters

node (NTMaxUIntTreeNode) – The node for which to retrieve the sibling.

Returns

Returns the sibling node if available; otherwise returns None.

Return type

NTMaxUIntTreeNode

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also nextSibling().

remove(node: Pro.Core.NTMaxUIntTreeNode)None

Removes a node from the tree.

Parameters

node (NTMaxUIntTreeNode) – The node to remove.

See also removeChild().

removeChild(parent: Pro.Core.NTMaxUIntTreeNode, pos: int)None

Removes a child node at a specified position.

Parameters
  • parent (NTMaxUIntTreeNode) – The parent node. This value can be None to remove a root-level node.

  • pos (int) – The index of the child to remove.

See also remove().

siblings(node: Pro.Core.NTMaxUIntTreeNode)int

Returns the number of siblings of the specified node.

Parameters

node (NTMaxUIntTreeNode) – The node for which to get the number of siblings.

Returns

Returns the number of siblings.

Return type

int

See also children() and childrenList().

swap(node: Pro.Core.NTMaxUIntTreeNode, newPos: int)None

Swaps two sibling nodes.

Parameters
  • node (NTMaxUIntTreeNode) – One of the nodes to swap.

  • newPos (int) – The new position at which to place the specified node.

See also children() and siblings().

class NTMaxUIntTreeNode

This class represents a node of NTMaxUIntTree.

Attributes:

children

A NTMaxUIntTreeNodeList list of children nodes.”

nid

The node id.

parent

The parent node.

value

The int value of the node.

children

A NTMaxUIntTreeNodeList list of children nodes.”

See also NTMaxUIntTree.childrenList().

nid

The node id.

See also NTMaxUIntTree.nodeId() and NTMaxUIntTree.enableIDs().

parent

The parent node.

See also NTMaxUIntTree.parentNode().

value

The int value of the node.

class NTMaxUIntTreeNodeList

List of NTMaxUIntTreeNode elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NTMaxUIntTreeNode)None

Inserts value at the end of the list.

Parameters

value (NTMaxUIntTreeNode) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NTMaxUIntTreeNode

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTMaxUIntTreeNode

clear()None

Removes all items from the list.

contains(value: Pro.Core.NTMaxUIntTreeNode)bool

Checks the presence of an element in the list.

Parameters

value (NTMaxUIntTreeNode) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NTMaxUIntTreeNode)int

Returns the number of occurrences of value in the list.

Parameters

value (NTMaxUIntTreeNode) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NTMaxUIntTreeNode, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTMaxUIntTreeNode) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NTMaxUIntTreeNode)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTMaxUIntTreeNode) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTMaxUIntTreeNodeListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTMaxUIntTreeNodeListIt

removeAll(value: Pro.Core.NTMaxUIntTreeNode)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTMaxUIntTreeNode) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NTMaxUIntTreeNode

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTMaxUIntTreeNode

See also removeAt().

class NTMaxUIntTreeNodeListIt(obj: Pro.Core.NTMaxUIntTreeNodeList)

Iterator class for NTMaxUIntTreeNodeList.

Parameters

obj (NTMaxUIntTreeNodeList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NTMaxUIntTreeNode
Returns

Returns the next item and advances the iterator by one position.

Return type

NTMaxUIntTreeNode

See also hasNext() and previous().

previous()Pro.Core.NTMaxUIntTreeNode
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NTMaxUIntTreeNode

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTMaxUIntVector

Vector list of int elements. The difference with normal lists is that vector lists are contiguous in memory.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: int)None

Inserts value at the end of the vector.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: int)bool

Checks the presence of an element in the vector.

Parameters

value (int) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the vector.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTMaxUIntVectorIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

NTMaxUIntVectorIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class NTMaxUIntVectorIt(obj: Pro.Core.NTMaxUIntVector)

Iterator class for NTMaxUIntVector.

Parameters

obj (NTMaxUIntVector) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTMemoryInfoList

List of NTMemoryInfo elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NT_MEMORY_INFO)None

Inserts value at the end of the list.

Parameters

value (NTMemoryInfo) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NT_MEMORY_INFO

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTMemoryInfo

clear()None

Removes all items from the list.

contains(value: Pro.Core.NT_MEMORY_INFO)bool

Checks the presence of an element in the list.

Parameters

value (NTMemoryInfo) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NT_MEMORY_INFO)int

Returns the number of occurrences of value in the list.

Parameters

value (NTMemoryInfo) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NT_MEMORY_INFO, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTMemoryInfo) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NT_MEMORY_INFO)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTMemoryInfo) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTMemoryInfoListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTMemoryInfoListIt

removeAll(value: Pro.Core.NT_MEMORY_INFO)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTMemoryInfo) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NT_MEMORY_INFO

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTMemoryInfo

See also removeAt().

class NTMemoryInfoListIt(obj: Pro.Core.NTMemoryInfoList)

Iterator class for NTMemoryInfoList.

Parameters

obj (NTMemoryInfoList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NT_MEMORY_INFO
Returns

Returns the next item and advances the iterator by one position.

Return type

NT_MEMORY_INFO

See also hasNext() and previous().

previous()Pro.Core.NT_MEMORY_INFO
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NT_MEMORY_INFO

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTModuleInfoList

List of NTModuleInfo elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NT_MODULE_INFO)None

Inserts value at the end of the list.

Parameters

value (NTModuleInfo) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NT_MODULE_INFO

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTModuleInfo

clear()None

Removes all items from the list.

contains(value: Pro.Core.NT_MODULE_INFO)bool

Checks the presence of an element in the list.

Parameters

value (NTModuleInfo) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NT_MODULE_INFO)int

Returns the number of occurrences of value in the list.

Parameters

value (NTModuleInfo) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NT_MODULE_INFO, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTModuleInfo) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NT_MODULE_INFO)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTModuleInfo) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTModuleInfoListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTModuleInfoListIt

removeAll(value: Pro.Core.NT_MODULE_INFO)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTModuleInfo) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NT_MODULE_INFO

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTModuleInfo

See also removeAt().

class NTModuleInfoListIt(obj: Pro.Core.NTModuleInfoList)

Iterator class for NTModuleInfoList.

Parameters

obj (NTModuleInfoList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NT_MODULE_INFO
Returns

Returns the next item and advances the iterator by one position.

Return type

NT_MODULE_INFO

See also hasNext() and previous().

previous()Pro.Core.NT_MODULE_INFO
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NT_MODULE_INFO

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

NTMonday: Final[int]

First day of the week.

See also NTDate.dayOfWeek().

NTOffsetFromUTC: Final[int]

An offset in seconds from Coordinated Universal Time.

See also NTDateTime.

class NTOffsetRange

This class defines a generic offset-size range.

Attributes:

offset

The start offset of the range.

size

The size of the range.

offset

The start offset of the range.

size

The size of the range.

class NTOffsetRangeList

List of NTOffsetRange elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NTOffsetRange)None

Inserts value at the end of the list.

Parameters

value (NTOffsetRange) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NTOffsetRange

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTOffsetRange

clear()None

Removes all items from the list.

contains(value: Pro.Core.NTOffsetRange)bool

Checks the presence of an element in the list.

Parameters

value (NTOffsetRange) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NTOffsetRange)int

Returns the number of occurrences of value in the list.

Parameters

value (NTOffsetRange) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NTOffsetRange, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTOffsetRange) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NTOffsetRange)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTOffsetRange) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTOffsetRangeListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTOffsetRangeListIt

removeAll(value: Pro.Core.NTOffsetRange)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTOffsetRange) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NTOffsetRange

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTOffsetRange

See also removeAt().

class NTOffsetRangeListIt(obj: Pro.Core.NTOffsetRangeList)

Iterator class for NTOffsetRangeList.

Parameters

obj (NTOffsetRangeList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NTOffsetRange
Returns

Returns the next item and advances the iterator by one position.

Return type

NTOffsetRange

See also hasNext() and previous().

previous()Pro.Core.NTOffsetRange
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NTOffsetRange

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTProcessInfoList

List of NTProcessInfo elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NT_PROCESS_INFO)None

Inserts value at the end of the list.

Parameters

value (NTProcessInfo) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NT_PROCESS_INFO

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTProcessInfo

clear()None

Removes all items from the list.

contains(value: Pro.Core.NT_PROCESS_INFO)bool

Checks the presence of an element in the list.

Parameters

value (NTProcessInfo) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NT_PROCESS_INFO)int

Returns the number of occurrences of value in the list.

Parameters

value (NTProcessInfo) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NT_PROCESS_INFO, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTProcessInfo) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NT_PROCESS_INFO)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTProcessInfo) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTProcessInfoListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTProcessInfoListIt

removeAll(value: Pro.Core.NT_PROCESS_INFO)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTProcessInfo) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NT_PROCESS_INFO

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTProcessInfo

See also removeAt().

class NTProcessInfoListIt(obj: Pro.Core.NTProcessInfoList)

Iterator class for NTProcessInfoList.

Parameters

obj (NTProcessInfoList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NT_PROCESS_INFO
Returns

Returns the next item and advances the iterator by one position.

Return type

NT_PROCESS_INFO

See also hasNext() and previous().

previous()Pro.Core.NT_PROCESS_INFO
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NT_PROCESS_INFO

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

NTProcessMemoryAccess_Execute: Final[int]

Executable memory flag.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.flags.

NTProcessMemoryAccess_Guard: Final[int]

Guarded memory flag.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.flags.

NTProcessMemoryAccess_Read: Final[int]

Readable memory flag.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.flags.

NTProcessMemoryAccess_UserMode: Final[int]

User-mode memory flag.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.flags.

NTProcessMemoryAccess_Write: Final[int]

Writable memory flag.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.flags.

NTProcessMemoryState_Commit: Final[int]

Committed memory state.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.state.

NTProcessMemoryState_Free: Final[int]

Freed memory state.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.state.

NTProcessMemoryState_Reserve: Final[int]

Reserved memory state.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.state.

NTProcessMemoryType_Image: Final[int]

Image memory type.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.type.

NTProcessMemoryType_Mapped: Final[int]

Mapped memory type.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.type.

NTProcessMemoryType_Private: Final[int]

Private memory type.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MEMORY_INFO.type.

class NTProcessRegionsEnumerator(pid: int)

This class implements an enumerator for memory regions.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetMemoryRegions().

Parameters

pid (int) – The process id.

Methods:

next(mi)

Retrieves the next memory region.

next(mi: Pro.Core.NT_MEMORY_INFO)bool

Retrieves the next memory region.

Parameters

mi (NT_MEMORY_INFO) – The memory region information.

Returns

Returns True if a memory region could be retrieved; otherwise returns False.

Return type

bool

NTRFC2822Date: Final[int]

RFC 2822, RFC 850 and RFC 1036 date format.

See also NTTime, NTDate and NTDateTime.

NTSaturday: Final[int]

Sixth day of the week.

See also NTDate.dayOfWeek().

class NTSimpleWait

Bases: Pro.Core.NTIWait

Basic implementation of NTIWait.

This class implements only the basic functionality of a wait object. No graphical functionality is provided.

See also NTIWait.

Methods:

reset()

Resets the state of the wait object.

reset()None

Resets the state of the wait object.

class NTStringList

List of str elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: str)None

Inserts value at the end of the list.

Parameters

value (str) – The value to add to the list.

See also insert().

at(i: int)str

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

str

clear()None

Removes all items from the list.

contains(value: str)bool

Checks the presence of an element in the list.

Parameters

value (str) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: str)int

Returns the number of occurrences of value in the list.

Parameters

value (str) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: str, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (str) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: str)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (str) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTStringListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTStringListIt

removeAll(value: str)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (str) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)str

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

str

See also removeAt().

class NTStringListIt(obj: Pro.Core.NTStringList)

Iterator class for NTStringList.

Parameters

obj (NTStringList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()str
Returns

Returns the next item and advances the iterator by one position.

Return type

str

See also hasNext() and previous().

previous()str
Returns

Returns the previous item and moves the iterator back by one position.

Return type

str

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTStringStringHash

Dictionary of str -> str elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: str)bool

Checks whether key is present in the hash.

Parameters

key (str) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: str)int

Counts the numbers of values associated with key in the hash.

Parameters

key (str) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: str, value: str)None

Inserts a new item with key and a value of value.

Parameters
  • key (str) – The key.

  • value (str) – The value.

See also insertMulti().

insertMulti(key: str, value: str)None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (str) – The key.

  • value (str) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTStringStringHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTStringStringHashIt

remove(key: str)int

Removes all the items that have key from the hash.

Parameters

key (str) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: str)str

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (str) – The key.

Returns

Returns the removed value.

Return type

str

See also remove().

value(key: str, defaultValue: Optional[str] = None)str

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (str) – The key.

  • defaultValue (Optional[str]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

str

See also contains().

class NTStringStringHashIt(obj: Pro.Core.NTStringStringHash)

Iterator class for NTStringStringHash.

Parameters

obj (NTStringStringHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()str
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

str

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[str, str]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[str, str]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()str
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

str

See also key().

class NTStringStringHashList

List of NTStringStringHash elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NTStringStringHash)None

Inserts value at the end of the list.

Parameters

value (NTStringStringHash) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NTStringStringHash

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTStringStringHash

clear()None

Removes all items from the list.

contains(value: Pro.Core.NTStringStringHash)bool

Checks the presence of an element in the list.

Parameters

value (NTStringStringHash) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NTStringStringHash)int

Returns the number of occurrences of value in the list.

Parameters

value (NTStringStringHash) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NTStringStringHash, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTStringStringHash) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NTStringStringHash)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTStringStringHash) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTStringStringHashListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTStringStringHashListIt

removeAll(value: Pro.Core.NTStringStringHash)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTStringStringHash) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NTStringStringHash

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTStringStringHash

See also removeAt().

class NTStringStringHashListIt(obj: Pro.Core.NTStringStringHashList)

Iterator class for NTStringStringHashList.

Parameters

obj (NTStringStringHashList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NTStringStringHash
Returns

Returns the next item and advances the iterator by one position.

Return type

NTStringStringHash

See also hasNext() and previous().

previous()Pro.Core.NTStringStringHash
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NTStringStringHash

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTStringVariantHash

Dictionary of str -> BasicType elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: str)bool

Checks whether key is present in the hash.

Parameters

key (str) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: str)int

Counts the numbers of values associated with key in the hash.

Parameters

key (str) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: str, value: Optional[Union[int, float, bool, bytes, str]])None

Inserts a new item with key and a value of value.

Parameters
  • key (str) – The key.

  • value (BasicType) – The value.

See also insertMulti().

insertMulti(key: str, value: Optional[Union[int, float, bool, bytes, str]])None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (str) – The key.

  • value (BasicType) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTStringVariantHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTStringVariantHashIt

remove(key: str)int

Removes all the items that have key from the hash.

Parameters

key (str) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: str)Optional[Union[int, float, bool, bytes, str]]

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (str) – The key.

Returns

Returns the removed value.

Return type

BasicType

See also remove().

value(key: str, defaultValue: Optional[Union[int, float, bool, bytes, str]] = None)Optional[Union[int, float, bool, bytes, str]]

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (str) – The key.

  • defaultValue (Optional[BasicType]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

BasicType

See also contains().

class NTStringVariantHashIt(obj: Pro.Core.NTStringVariantHash)

Iterator class for NTStringVariantHash.

Parameters

obj (NTStringVariantHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()str
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

str

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[str, BasicType]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[str, BasicType]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()Optional[Union[int, float, bool, bytes, str]]
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

BasicType

See also key().

NTSunday: Final[int]

Seventh day of the week.

See also NTDate.dayOfWeek().

NTSystemLocaleLongDate: Final[int]

The long date format used by the operating system.

See also NTTime, NTDate and NTDateTime.

NTSystemLocaleShortDate: Final[int]

The short date format used by the operating system.

See also NTTime, NTDate and NTDateTime.

class NTTextBuffer

Bases: Pro.Core.NTTextStream

This is a class derived from NTTextStream.

Internally this class uses a utf-8 string as buffer.

See also NTTextStream, NTTextStringBuffer and NTVoidBuffer.

Attributes:

buffer

The string buffer.

buffer

The string buffer.

NTTextDate: Final[int]

Date format equivalent to using the date format string "ddd MMM d yyyy".

See also NTTime, NTDate and NTDateTime.

class NTTextStream

An interface for outputting text and mnemonics.

Each derived class uses a different output destination.

See also NTTextBuffer, NTTextStringBuffer and NTVoidBuffer.

Attributes:

HexPrint_Ascii

Prints the ascii column when passed to printHex().

HexPrint_Unicode

Prints the unicode column when passed to printHex().

Methods:

_print(s)

Prints a string.

clearPrefix()

Clears the prefix set by setPrefix().

disasmOptions()

Returns the disassembly options.

doIndent()

Outputs indentation if necessary.

doNewLines()

Outputs new-lines if necessary.

doPrefix()

Outputs the prefix if necessary.

enableIndent(b)

Enables or disables indentation.

enablePrefix(b)

Enables or disables prefix output.

flush()

Appends pending new-lines.

iadd(i)

Adds i indentation units.

iget()

Retrieves the current number of indentation units.

indentSize()

Returns the size of a single indentation unit. The default is 1 space.

ireset()

Resets the current amount of indentation units.

iset(i)

Sets the current amount of indentation units.

isub(i)

Subtracts i indentation units.

lineLength()

Returns the length of the last outputted line including indentation and prefix if any.

maxOpcodes()

Returns the maximum amount of opcodes to be outputted.

nl([i])

Outputs one or more new-lines.

printHex(bytes[, flags, base_offset])

Prints bytes as hex view data.

printOpcodes(b, instr_size, max_opcodes)

Prints instr_size or max_opcodes or maxOpcodes(), whichever is less, opcodes out of a NTBuffer instance.

reset()

Resets the internal state of the text stream.

setDisasmOptions(options)

Sets the disassembly options.

setIndentSize(g)

Sets the size of a single indentation unit.

setMaxOpcodes(n)

Sets the maximum number of opcodes to output.

setPrefix(p)

Sets the prefix for each outputted line.

stateId()

Returns the current state id.

HexPrint_Ascii: Final[int]

Prints the ascii column when passed to printHex().

See also printHex().

HexPrint_Unicode: Final[int]

Prints the unicode column when passed to printHex().

See also printHex().

_print(s: str)None

Prints a string.

This method automatically handles new-lines when indentation or a prefix are set.

Parameters

s (str) – The string to print.

See also printHex() and iadd().

clearPrefix()None

Clears the prefix set by setPrefix().

See also setPrefix().

disasmOptions()int
Returns

Returns the disassembly options.

Return type

int

See also setDisasmOptions().

doIndent()None

Outputs indentation if necessary.

This method is called internally and should not be called from the outside.

doNewLines()None

Outputs new-lines if necessary.

This method is called internally and should not be called from the outside.

doPrefix()None

Outputs the prefix if necessary.

This method is called internally and should not be called from the outside.

enableIndent(b: bool)None

Enables or disables indentation.

Indentation is enabled by default.

Parameters

b (bool) – If False, disables indentation.

See also enablePrefix().

enablePrefix(b: bool)None

Enables or disables prefix output.

Output prefix is enabled by default.

Parameters

b (bool) – If False, disables output prefix.

See also enableIndent().

flush()None

Appends pending new-lines.

iadd(i: int)None

Adds i indentation units.

This must not be confused with the size of a single indentation unit (see setIndentSize()).

Parameters

i (int) – The number of indentation units to add.

See also isub(), iget(), iset(), ireset() and setIndentSize().

iget()int

Retrieves the current number of indentation units.

This must not be confused with the size of a single indentation unit (see indentSize()).

Returns

Returns the current number of indentation units.

Return type

int

See also iset(), iadd(), isub(), ireset() and indentSize().

indentSize()int
Returns

Returns the size of a single indentation unit. The default is 1 space.

Return type

int

See also setIndentSize().

ireset()None

Resets the current amount of indentation units.

See also iset(), iget(), iadd(), isub() and setIndentSize().

iset(i: int)None

Sets the current amount of indentation units.

This must not be confused with the size of a single indentation unit (see setIndentSize()).

Parameters

i (int) – The amount of indentation units to set.

See also iget(), iadd(), isub(), ireset() and setIndentSize().

isub(i: int)None

Subtracts i indentation units.

This must not be confused with the size of a single indentation unit (see setIndentSize()).

Parameters

i (int) – The number of indentation units to subtract.

See also iadd(), iget(), iset(), ireset() and setIndentSize().

lineLength()int
Returns

Returns the length of the last outputted line including indentation and prefix if any.

Return type

int

See also _print().

maxOpcodes()int
Returns

Returns the maximum amount of opcodes to be outputted.

Return type

int

See also setMaxOpcodes().

nl(i: Optional[int] = None)None

Outputs one or more new-lines.

Parameters

i (Optional[int]) – The number of new-lines to output.

See also _print().

printHex(bytes: bytes, flags: int = HexPrint_Ascii, base_offset: int = 0)None

Prints bytes as hex view data.

Parameters

See also _print(), HexPrint_Ascii and HexPrint_Unicode.

printOpcodes(b: Pro.Core.NTBuffer, instr_size: int, max_opcodes: int)bool

Prints instr_size or max_opcodes or maxOpcodes(), whichever is less, opcodes out of a NTBuffer instance.

Parameters
  • b (NTBuffer) – The data buffer.

  • instr_size (int) – The instruction size.

  • max_opcodes (int) – The maximum number of opcodes to print.

Returns

Returns True if all the opcodes of the instruction could be printed; otherwise returns False.

Return type

bool

See also setMaxOpcodes().

reset()None

Resets the internal state of the text stream.

setDisasmOptions(options: int)None

Sets the disassembly options.

These options are to be honoured by methods which output mnemonics to a text stream.

Parameters

options (int) – The options to set.

See also disasmOptions(), DisasmOpt_Opcodes and DisasmOpt_FileOffsets.

setIndentSize(g: int)None

Sets the size of a single indentation unit.

The default is 1 space.

Parameters

g (int) – The size of a single indentation unit.

See also indentSize().

setMaxOpcodes(n: int)None

Sets the maximum number of opcodes to output.

This setting is to be honoured by methods which output opcodes to a text stream.

Parameters

n (int) – The maximum number of opcodes.

See also maxOpcodes().

setPrefix(p: str)None

Sets the prefix for each outputted line.

Parameters

p (str) – The prefix.

See also clearPrefix().

stateId()int

Returns the current state id.

The state id changes after each output. This is a simple way to check whether any data has been printed to a text stream.

Returns

Returns the current state id.

Return type

int

See also _print().

class NTTextStringBuffer

Bases: Pro.Core.NTTextStream

This is a class derived from NTTextStream.

Internally this class uses a utf-16 string as buffer.

See also NTTextStream, NTTextBuffer and NTVoidBuffer.

Attributes:

buffer

The string buffer.

buffer

The string buffer.

NTThursday: Final[int]

Fourth day of the week.

See also NTDate.dayOfWeek().

class NTTime(h: Optional[int] = None, m: Optional[int] = None, s: int = 0, ms: int = 0)

This class provides clock time functionality.

Optionally initializes a time object from the input parameters.

Parameters
  • h (Optional[int]) – The hour.

  • m (Optional[int]) – The minute.

  • s (int) – The second.

  • ms (int) – The milliseconds.

See also NTDate and NTDateTime.

Methods:

addMSecs(ms)

Adds ms milliseconds to the time of this class.

addSecs(s)

Adds s seconds to the time of this class.

currentTime()

Returns the current time as reported by the system clock.

elapsed()

fromMSecsSinceStartOfDay(msecs)

Returns a new NTTime instance with the time set to the number of milliseconds since the start of the day, i.e. since 00:00:00.

fromString(string[, format])

Returns the time represented in the string as an NTTime using the format given, or an invalid time if this is not possible.

hour()

Returns the hour part (0 to 23) of the time. Returns -1 if the time is invalid.

isNull()

Returns True if the time is invalid; otherwise returns False.

isValid()

Checks the validity of the current time object.

minute()

Returns the minute part (0 to 59) of the time. Returns -1 if the time is invalid.

msec()

Returns the millisecond part (0 to 999) of the time. Returns -1 if the time is invalid.

msecsSinceStartOfDay()

Returns the number of msecs since the start of the day, i.e. since 00:00:00.

msecsTo(t)

Returns the number of milliseconds from this time to t.

restart()

second()

Returns the second part (0 to 59) of the time. Returns -1 if the time is invalid.

secsTo(t)

Returns the number of seconds from this time to t.

setHMS(h, m, s[, ms])

Sets the time given hour, minute, second and millisecond parameters.

start()

toString([format])

Converts the time to a string.

addMSecs(ms: int)Pro.Core.NTTime

Adds ms milliseconds to the time of this class.

Parameters

ms (int) – The number of milliseconds to add. This value can be negative.

Returns

Returns a new NTTime instance.

Return type

NTTime

See also addSecs(), msecsTo() and NTDateTime.addMSecs().

addSecs(s: int)Pro.Core.NTTime

Adds s seconds to the time of this class.

Parameters

s (int) – The number of seconds to add. This value can be negative.

Returns

Returns a new NTTime instance.

Return type

NTTime

See also addMSecs(), secsTo() and NTDateTime.addSecs().

static currentTime()Pro.Core.NTTime
Returns

Returns the current time as reported by the system clock.

Return type

NTTime

See also NTDateTime.currentDateTime() and NTDateTime.currentDateTimeUtc().

elapsed()int

Warning

This method is deprecated. Use the faster NTTimer class instead.

Measures the number of milliseconds that have elapsed since the last time start() or restart() was called.

Returns

Returns the number of milliseconds that have elapsed

Return type

int

See also start() and restart().

static fromMSecsSinceStartOfDay(msecs: int)Pro.Core.NTTime

Returns a new NTTime instance with the time set to the number of milliseconds since the start of the day, i.e. since 00:00:00.

Parameters

msecs (int) – The number of milliseconds.

Returns

Returns a new NTTime instance.

Return type

NTTime

See also msecsSinceStartOfDay().

static fromString(string: str, format: Union[NTDateFormat, str] = NTTextDate)NTTime

Returns the time represented in the string as an NTTime using the format given, or an invalid time if this is not possible.

Parameters
  • string (str) – The time string.

  • format (Union[NTDateFormat, str]) – The format of the time string.

Returns

Returns a new NTTime instance.

Return type

NTTime

See also toString().

hour()int
Returns

Returns the hour part (0 to 23) of the time. Returns -1 if the time is invalid.

Return type

int

See also minute(), second() and msec().

isNull()bool
Returns

Returns True if the time is invalid; otherwise returns False.

Return type

bool

See also isValid().

isValid()bool

Checks the validity of the current time object.

Returns

Returns True if the time is valid; otherwise returns False.

Return type

bool

See also isNull().

minute()int
Returns

Returns the minute part (0 to 59) of the time. Returns -1 if the time is invalid.

Return type

int

See also hour(), second() and msec().

msec()int
Returns

Returns the millisecond part (0 to 999) of the time. Returns -1 if the time is invalid.

Return type

int

See also hour(), minute() and second().

msecsSinceStartOfDay()int
Returns

Returns the number of msecs since the start of the day, i.e. since 00:00:00.

Return type

int

See also fromMSecsSinceStartOfDay().

msecsTo(t: Pro.Core.NTTime)int

Returns the number of milliseconds from this time to t. If t is earlier than this time, the number of milliseconds returned is negative.

Because NTTime measures time within a day and there are 86400 seconds in a day, the result is always between -86400000 and 86400000 ms.

Returns 0 if either time is invalid.

Parameters

t (NTTime) – The time to measure the difference in milliseconds from.

Returns

Returns the difference of time in milliseconds.

Return type

int

See also secsTo(), addMSecs() and NTDateTime.msecsTo().

restart()int

Warning

This method is deprecated. Use the faster NTTimer class instead.

Sets this time to the current time and returns the number of milliseconds that have elapsed since the last time start() or restart() was called.

This function is guaranteed to be atomic and is thus very handy for repeated measurements. Call start() to start the first measurement, and restart() for each later measurement.

Note that the counter wraps to zero 24 hours after the last call to start() or restart().

Returns

Returns the elapsed time in milliseconds from when start() was called.

Return type

int

See also start(), elapsed() and currentTime().

second()int
Returns

Returns the second part (0 to 59) of the time. Returns -1 if the time is invalid.

Return type

int

See also hour(), minute() and msec().

secsTo(t: Pro.Core.NTTime)int

Returns the number of seconds from this time to t. If t is earlier than this time, the number of seconds returned is negative.

Because NTTime measures time within a day and there are 86400 seconds in a day, the result is always between -86400 and 86400.

This method does not take into account any milliseconds.

Returns 0 if either time is invalid.

Parameters

t (NTTime) – The time to measure the difference in seconds from.

Returns

Returns the difference of time in seconds.

Return type

int

See also addSecs(), and NTDateTime.secsTo().

setHMS(h: int, m: int, s: int, ms: int = 0)bool

Sets the time given hour, minute, second and millisecond parameters.

Parameters
  • h (int) – The hour. Must be in the range 0 to 23.

  • m (int) – The minute. Must be in the range 0 to 59.

  • s (int) – The second. Must be in the range 0 to 59.

  • ms (int) – The millisecond. Must be in the range 0 to 999.

Returns

Returns True if the set time is valid; otherwise returns False.

Return type

bool

See also isValid().

start()None

Warning

This method is deprecated for timing purposes. Use the faster NTTimer class instead.

Sets this time to the current time.

See also restart() and elapsed().

toString(format: Union[NTDateFormat, str] = NTTextDate)str

Converts the time to a string. The format parameter determines the format of the string.

Parameters

format (Union[NTDateFormat, str]) – The format of the time.

Returns

Returns the time as a string.

Return type

str

See also fromString(), NTDate.toString() and NTDateTime.toString().

NTTimeZone: Final[int]

A named time zone.

See also NTDateTime.

class NTTimer

This class implements a fast milliseconds timer based on NT_GetTickCount().

Available since Cerbero Suite 6.1 and Cerbero Engine 3.1.

Methods:

elapsed()

Returns the time passed up until now in milliseconds.

restart()

Restarts the timer.

start()

Starts the timer.

elapsed()int
Returns

Returns the time passed up until now in milliseconds.

Return type

int

See also start() and restart().

restart()int

Restarts the timer.

Returns

Returns the time passed up until now in milliseconds.

Return type

int

See also start() and elapsed().

start()None

Starts the timer.

See also elapsed() and restart().

NTTuesday: Final[int]

Second day of the week.

See also NTDate.dayOfWeek().

class NTUInt64List

List of int elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: int)None

Inserts value at the end of the list.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all items from the list.

contains(value: int)bool

Checks the presence of an element in the list.

Parameters

value (int) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the list.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUInt64ListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTUInt64ListIt

removeAll(value: int)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (int) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)int

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

int

See also removeAt().

class NTUInt64ListIt(obj: Pro.Core.NTUInt64List)

Iterator class for NTUInt64List.

Parameters

obj (NTUInt64List) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTUInt64UIntHash

Dictionary of int -> int elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: int)bool

Checks whether key is present in the hash.

Parameters

key (int) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: int)int

Counts the numbers of values associated with key in the hash.

Parameters

key (int) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: int, value: int)None

Inserts a new item with key and a value of value.

Parameters
  • key (int) – The key.

  • value (int) – The value.

See also insertMulti().

insertMulti(key: int, value: int)None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (int) – The key.

  • value (int) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUInt64UIntHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTUInt64UIntHashIt

remove(key: int)int

Removes all the items that have key from the hash.

Parameters

key (int) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: int)int

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (int) – The key.

Returns

Returns the removed value.

Return type

int

See also remove().

value(key: int, defaultValue: Optional[int] = None)int

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (int) – The key.

  • defaultValue (Optional[int]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

int

See also contains().

class NTUInt64UIntHashIt(obj: Pro.Core.NTUInt64UIntHash)

Iterator class for NTUInt64UIntHash.

Parameters

obj (NTUInt64UIntHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()int
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

int

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[int, int]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[int, int]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()int
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

int

See also key().

class NTUIntList

List of int elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: int)None

Inserts value at the end of the list.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all items from the list.

contains(value: int)bool

Checks the presence of an element in the list.

Parameters

value (int) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the list.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUIntListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTUIntListIt

removeAll(value: int)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (int) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)int

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

int

See also removeAt().

class NTUIntListIt(obj: Pro.Core.NTUIntList)

Iterator class for NTUIntList.

Parameters

obj (NTUIntList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTUIntTree

Tree of NTUIntTreeNode nodes.

Methods:

appendChild(parent, value)

Adds a node to the children of the specified parent node.

children(parent)

Returns the number of child nodes for the specified parent node.

childrenList(parent)

Returns the list of child nodes for the specified parent node.

clear()

Removes all nodes from the tree.

clearChildren(parent)

Removes all the child nodes of the specified parent node.

enableIDs(b)

Enables id-based look-up for nodes.

insertChild(parent, pos, value)

Inserts a new node into the list of child nodes of the specified parent node at a given position.

nextSibling(node)

Returns the next sibling of a node.

node(nid_or_parent[, pos])

Returns a node given a parent and a child index or, alternatively, given a node id.

nodeId(node)

Returns the node id for the specified node.

parentNode(node)

Retrieves the parent node for the specified node.

position(node)

Returns the position of the specified node related its siblings.

prependChild(parent, value)

Prepends a node to the children of the specified parent node.

previousSibling(node)

Returns the previous sibling of a node.

remove(node)

Removes a node from the tree.

removeChild(parent, pos)

Removes a child node at a specified position.

siblings(node)

Returns the number of siblings of the specified node.

swap(node, newPos)

Swaps two sibling nodes.

appendChild(parent: Pro.Core.NTUIntTreeNode, value: int)Pro.Core.NTUIntTreeNode

Adds a node to the children of the specified parent node.

Parameters
  • parent (NTUIntTreeNode) – The parent node. This value can be None to add a root-level node.

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTUIntTreeNode

See also prependChild() and insertChild().

children(parent: Pro.Core.NTUIntTreeNode)int

Returns the number of child nodes for the specified parent node.

Parameters

parent (NTUIntTreeNode) – The parent node. This value can be None to retrieve the number of root-level nodes.

Returns

Returns the number of child nodes.

Return type

int

See also childrenList(), siblings() and parentNode().

childrenList(parent: Pro.Core.NTUIntTreeNode)Pro.Core.NTUIntTreeNodeList

Returns the list of child nodes for the specified parent node.

Parameters

parent (NTUIntTreeNode) – The parent node. This value can be None to retrieve the list of root-level nodes.

Returns

Returns the list of child nodes.

Return type

NTUIntTreeNodeList

See also children(), siblings() and parentNode().

clear()None

Removes all nodes from the tree.

See also clearChildren().

clearChildren(parent: Pro.Core.NTUIntTreeNode)None

Removes all the child nodes of the specified parent node.

Parameters

parent (NTUIntTreeNode) – The parent node.

See also clear().

enableIDs(b: bool)None

Enables id-based look-up for nodes. This method must be called before adding nodes to the tree. By default id-based look-up is not enabled.

Parameters

b (bool) – Must be True to enable id-based look-up.

See also node() and nodeId().

insertChild(parent: Pro.Core.NTUIntTreeNode, pos: int, value: int)Pro.Core.NTUIntTreeNode

Inserts a new node into the list of child nodes of the specified parent node at a given position.

Parameters
  • parent (NTUIntTreeNode) – The parent node. This value can be None to insert a root-level node.

  • pos (int) – The position where to insert the child node. An value of 0 is the same as calling prependChild(). A value of children() is the same as calling appendChild().

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTUIntTreeNode

See also appendChild() and prependChild().

nextSibling(node: Pro.Core.NTUIntTreeNode)Pro.Core.NTUIntTreeNode

Returns the next sibling of a node.

Parameters

node (NTUIntTreeNode) – The node for which to retrieve the sibling.

Returns

Returns the sibling node if available; otherwise returns None.

Return type

NTUIntTreeNode

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also previousSibling().

node(nid_or_parent: Union[Pro.Core.NTUIntTreeNode, int], pos: Optional[int] = None)Pro.Core.NTUIntTreeNode

Returns a node given a parent and a child index or, alternatively, given a node id. To retrieve nodes by id, enableIDs() must have been called first.

Parameters
  • nid_or_parent (Union[NTUIntTreeNode, int]) – Can be either a parent node or a node id.

  • pos (Optional[int]) – The child index. This parameter can be used only when a parent node is specified.

Returns

Returns the requested node. If the node couldn’t be found, the return value is None.

Return type

NTUIntTreeNode

See also enableIDs().

nodeId(node: Pro.Core.NTUIntTreeNode)int

Returns the node id for the specified node. enableIDs() must have been called first in order for nodes to have valid ids.

Parameters

node (NTUIntTreeNode) – The node for which to retrieve the node id.

Returns

Returns the node id.

Return type

int

See also enableIDs() and node().

parentNode(node: Pro.Core.NTUIntTreeNode)Pro.Core.NTUIntTreeNode

Retrieves the parent node for the specified node.

Parameters

node (NTUIntTreeNode) – The node for which to retrieve the parent node.

Returns

Returns the parent node. If the specified node is a root-level node, then the method returns None.

Return type

NTUIntTreeNode

See also childrenList() and node().

position(node: Pro.Core.NTUIntTreeNode)int

Returns the position of the specified node related its siblings.

Parameters

node (NTUIntTreeNode) – The node for which to retrieve the position. This value can be None to retrieve the position of a root-level node.

Returns

Returns the index position.

Return type

int

See also children() and siblings().

prependChild(parent: Pro.Core.NTUIntTreeNode, value: int)Pro.Core.NTUIntTreeNode

Prepends a node to the children of the specified parent node.

Parameters
  • parent (NTUIntTreeNode) – The parent node. This value can be None to prepend a root-level node.

  • value (int) – The value of the new node.

Returns

Returns the newly created node.

Return type

NTUIntTreeNode

See also appendChild() and insertChild().

previousSibling(node: Pro.Core.NTUIntTreeNode)Pro.Core.NTUIntTreeNode

Returns the previous sibling of a node.

Parameters

node (NTUIntTreeNode) – The node for which to retrieve the sibling.

Returns

Returns the sibling node if available; otherwise returns None.

Return type

NTUIntTreeNode

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also nextSibling().

remove(node: Pro.Core.NTUIntTreeNode)None

Removes a node from the tree.

Parameters

node (NTUIntTreeNode) – The node to remove.

See also removeChild().

removeChild(parent: Pro.Core.NTUIntTreeNode, pos: int)None

Removes a child node at a specified position.

Parameters
  • parent (NTUIntTreeNode) – The parent node. This value can be None to remove a root-level node.

  • pos (int) – The index of the child to remove.

See also remove().

siblings(node: Pro.Core.NTUIntTreeNode)int

Returns the number of siblings of the specified node.

Parameters

node (NTUIntTreeNode) – The node for which to get the number of siblings.

Returns

Returns the number of siblings.

Return type

int

See also children() and childrenList().

swap(node: Pro.Core.NTUIntTreeNode, newPos: int)None

Swaps two sibling nodes.

Parameters
  • node (NTUIntTreeNode) – One of the nodes to swap.

  • newPos (int) – The new position at which to place the specified node.

See also children() and siblings().

class NTUIntTreeNode

This class represents a node of NTUIntTree.

Attributes:

children

A NTUIntTreeNodeList list of children nodes.”

nid

The node id.

parent

The parent node.

value

The int value of the node.

children

A NTUIntTreeNodeList list of children nodes.”

See also NTUIntTree.childrenList().

nid

The node id.

See also NTUIntTree.nodeId() and NTUIntTree.enableIDs().

parent

The parent node.

See also NTUIntTree.parentNode().

value

The int value of the node.

class NTUIntTreeNodeList

List of NTUIntTreeNode elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.NTUIntTreeNode)None

Inserts value at the end of the list.

Parameters

value (NTUIntTreeNode) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.NTUIntTreeNode

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

NTUIntTreeNode

clear()None

Removes all items from the list.

contains(value: Pro.Core.NTUIntTreeNode)bool

Checks the presence of an element in the list.

Parameters

value (NTUIntTreeNode) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.NTUIntTreeNode)int

Returns the number of occurrences of value in the list.

Parameters

value (NTUIntTreeNode) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.NTUIntTreeNode, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (NTUIntTreeNode) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.NTUIntTreeNode)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (NTUIntTreeNode) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUIntTreeNodeListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTUIntTreeNodeListIt

removeAll(value: Pro.Core.NTUIntTreeNode)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (NTUIntTreeNode) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.NTUIntTreeNode

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

NTUIntTreeNode

See also removeAt().

class NTUIntTreeNodeListIt(obj: Pro.Core.NTUIntTreeNodeList)

Iterator class for NTUIntTreeNodeList.

Parameters

obj (NTUIntTreeNodeList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.NTUIntTreeNode
Returns

Returns the next item and advances the iterator by one position.

Return type

NTUIntTreeNode

See also hasNext() and previous().

previous()Pro.Core.NTUIntTreeNode
Returns

Returns the previous item and moves the iterator back by one position.

Return type

NTUIntTreeNode

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTUIntVector

Vector list of int elements. The difference with normal lists is that vector lists are contiguous in memory.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: int)None

Inserts value at the end of the vector.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: int)bool

Checks the presence of an element in the vector.

Parameters

value (int) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the vector.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUIntVectorIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

NTUIntVectorIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class NTUIntVectorIt(obj: Pro.Core.NTUIntVector)

Iterator class for NTUIntVector.

Parameters

obj (NTUIntVector) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTUShortUShortHash

Dictionary of int -> int elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: int)bool

Checks whether key is present in the hash.

Parameters

key (int) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: int)int

Counts the numbers of values associated with key in the hash.

Parameters

key (int) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: int, value: int)None

Inserts a new item with key and a value of value.

Parameters
  • key (int) – The key.

  • value (int) – The value.

See also insertMulti().

insertMulti(key: int, value: int)None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (int) – The key.

  • value (int) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUShortUShortHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTUShortUShortHashIt

remove(key: int)int

Removes all the items that have key from the hash.

Parameters

key (int) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: int)int

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (int) – The key.

Returns

Returns the removed value.

Return type

int

See also remove().

value(key: int, defaultValue: Optional[int] = None)int

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (int) – The key.

  • defaultValue (Optional[int]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

int

See also contains().

class NTUShortUShortHashIt(obj: Pro.Core.NTUShortUShortHash)

Iterator class for NTUShortUShortHash.

Parameters

obj (NTUShortUShortHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()int
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

int

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[int, int]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[int, int]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()int
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

int

See also key().

class NTUShortVector

Vector list of int elements. The difference with normal lists is that vector lists are contiguous in memory.

Methods:

append(value)

Inserts value at the end of the vector.

at(i)

Returns the item at index position i in the vector.

clear()

Removes all the elements from the vector and releases the memory used by the vector.

contains(value)

Checks the presence of an element in the vector.

count(value)

Returns the number of occurrences of value in the vector.

indexOf(value[, start])

Searches for an element in the vector.

insert(i, value)

Inserts value at index position i in the vector.

isEmpty()

Checks whether the vector is empty.

iterator()

Creates an iterator for the vector.

reserve(alloc)

Reserve space for alloc elements.

resize(size)

Sets the size of the vector to size.

size()

Returns the number of items in the vector.

append(value: int)None

Inserts value at the end of the vector.

Parameters

value (int) – The value to add to the list.

See also insert().

at(i: int)int

Returns the item at index position i in the vector. i must be a valid index position in the vector (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

int

clear()None

Removes all the elements from the vector and releases the memory used by the vector.

contains(value: int)bool

Checks the presence of an element in the vector.

Parameters

value (int) – The value to check for.

Returns

Returns True if the vector contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: int)int

Returns the number of occurrences of value in the vector.

Parameters

value (int) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: int, start: int = 0)int

Searches for an element in the vector.

Parameters
  • value (int) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the vector. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: int)None

Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.

Parameters
  • i (int) – The position at which to add the value.

  • value (int) – The value to add.

See also append().

isEmpty()bool

Checks whether the vector is empty.

Returns

Returns True if the vector contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUShortVectorIt

Creates an iterator for the vector.

Returns

Returns the iterator.

Return type

NTUShortVectorIt

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the vector.

Parameters

alloc (int) – The amount of elements to reserve space for.

resize(size: int)None

Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.

Parameters

size (int) – The new size of the vector.

See also size().

size()int
Returns

Returns the number of items in the vector.

Return type

int

See also isEmpty().

class NTUShortVectorIt(obj: Pro.Core.NTUShortVector)

Iterator class for NTUShortVector.

Parameters

obj (NTUShortVector) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()int
Returns

Returns the next item and advances the iterator by one position.

Return type

int

See also hasNext() and previous().

previous()int
Returns

Returns the previous item and moves the iterator back by one position.

Return type

int

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

NTUTC: Final[int]

Coordinated Universal Time.

See also NTDateTime.

class NTUTF8StringHash

Dictionary of str -> str elements.

Methods:

clear()

Removes all items from the hash.

contains(key)

Checks whether key is present in the hash.

count(key)

Counts the numbers of values associated with key in the hash.

insert(key, value)

Inserts a new item with key and a value of value.

insertMulti(key, value)

Inserts a new item with key and a value of value.

isEmpty()

Checks whether the hash is empty.

iterator()

Creates an iterator for the hash.

remove(key)

Removes all the items that have key from the hash.

reserve(alloc)

Ensures that the internal hash table consists of at least size buckets.

size()

Returns the number of items in the hash.

take(key)

Removes the item with key from the hash and returns the value associated with it.

value(key[, defaultValue])

Returns the value associated with key.

clear()None

Removes all items from the hash.

contains(key: str)bool

Checks whether key is present in the hash.

Parameters

key (str) – The key value to check for.

Returns

Returns True if the hash contains an item with the key; otherwise returns False.

Return type

bool

See also count().

count(key: str)int

Counts the numbers of values associated with key in the hash.

Parameters

key (str) – The key value.

Returns

Returns the number of items associated with the key.

Return type

int

See also contains().

insert(key: str, value: str)None

Inserts a new item with key and a value of value.

Parameters
  • key (str) – The key.

  • value (str) – The value.

See also insertMulti().

insertMulti(key: str, value: str)None

Inserts a new item with key and a value of value.

If there is already an item with the same key in the hash, this method will simply create a new one. (This behaviour is different from insert(), which overwrites the value of an existing item.)

Parameters
  • key (str) – The key.

  • value (str) – The value.

See also insert().

isEmpty()bool

Checks whether the hash is empty.

Returns

Returns True if the hash contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUTF8StringHashIt

Creates an iterator for the hash.

Returns

Returns the iterator.

Return type

NTUTF8StringHashIt

remove(key: str)int

Removes all the items that have key from the hash.

Parameters

key (str) – The key to remove.

Returns

Returns the number of items removed which is usually 1 but will be 0 if the key isn’t in the hash, or greater than 1 if insertMulti() has been used with the key.

Return type

int

See also clear() and take().

reserve(alloc: int)None

Ensures that the internal hash table consists of at least size buckets.

Parameters

alloc (int) – The allocation size.

size()int
Returns

Returns the number of items in the hash.

Return type

int

See also isEmpty() and count().

take(key: str)str

Removes the item with key from the hash and returns the value associated with it.

If the item does not exist in the hash, the method simply returns a default-constructed value. If there are multiple items for key in the hash, only the most recently inserted one is removed.

If you don’t use the return value, remove() is more efficient.

Parameters

key (str) – The key.

Returns

Returns the removed value.

Return type

str

See also remove().

value(key: str, defaultValue: Optional[str] = None)str

Returns the value associated with key. If the hash contains no item with key, the method returns a default-constructed value if defaultValue is not provided. If there are multiple items for key in the hash, the value of the most recently inserted one is returned.

Parameters
  • key (str) – The key.

  • defaultValue (Optional[str]) – The default value to return if key is not present in the hash.

Returns

Returns the value associated with key.

Return type

str

See also contains().

class NTUTF8StringHashIt(obj: Pro.Core.NTUTF8StringHash)

Iterator class for NTUTF8StringHash.

Parameters

obj (NTUTF8StringHash) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

key()

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

value()

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

key()str
Returns

Returns the key of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

str

See also value().

next()None
Returns

Returns the next item and advances the iterator by one position.

Return type

tuple[str, str]

See also hasNext() and previous().

previous()None
Returns

Returns the previous item and moves the iterator back by one position.

Return type

tuple[str, str]

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

value()str
Returns

Returns the value of the last item that was jumped over using one of the traversal functions (previous(), next()).

Return type

str

See also key().

class NTUTF8StringList

List of str elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: str)None

Inserts value at the end of the list.

Parameters

value (str) – The value to add to the list.

See also insert().

at(i: int)str

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

str

clear()None

Removes all items from the list.

contains(value: str)bool

Checks the presence of an element in the list.

Parameters

value (str) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: str)int

Returns the number of occurrences of value in the list.

Parameters

value (str) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: str, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (str) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: str)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (str) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTUTF8StringListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTUTF8StringListIt

removeAll(value: str)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (str) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)str

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

str

See also removeAt().

class NTUTF8StringListIt(obj: Pro.Core.NTUTF8StringList)

Iterator class for NTUTF8StringList.

Parameters

obj (NTUTF8StringList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()str
Returns

Returns the next item and advances the iterator by one position.

Return type

str

See also hasNext() and previous().

previous()str
Returns

Returns the previous item and moves the iterator back by one position.

Return type

str

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTVariantList

List of BasicType elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Optional[Union[int, float, bool, bytes, str]])None

Inserts value at the end of the list.

Parameters

value (BasicType) – The value to add to the list.

See also insert().

at(i: int)Optional[Union[int, float, bool, bytes, str]]

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

BasicType

clear()None

Removes all items from the list.

contains(value: Optional[Union[int, float, bool, bytes, str]])bool

Checks the presence of an element in the list.

Parameters

value (BasicType) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Optional[Union[int, float, bool, bytes, str]])int

Returns the number of occurrences of value in the list.

Parameters

value (BasicType) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Optional[Union[int, float, bool, bytes, str]], start: int = 0)int

Searches for an element in the list.

Parameters
  • value (BasicType) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Optional[Union[int, float, bool, bytes, str]])None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (BasicType) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.NTVariantListIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

NTVariantListIt

removeAll(value: Optional[Union[int, float, bool, bytes, str]])int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (BasicType) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Optional[Union[int, float, bool, bytes, str]]

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

BasicType

See also removeAt().

class NTVariantListIt(obj: Pro.Core.NTVariantList)

Iterator class for NTVariantList.

Parameters

obj (NTVariantList) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Optional[Union[int, float, bool, bytes, str]]
Returns

Returns the next item and advances the iterator by one position.

Return type

BasicType

See also hasNext() and previous().

previous()Optional[Union[int, float, bool, bytes, str]]
Returns

Returns the previous item and moves the iterator back by one position.

Return type

BasicType

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class NTVoidBuffer

Bases: Pro.Core.NTTextStream

This is a class derived from NTTextStream.

Any data printed to this class is discarded. This class should be passed to methods which require an NTTextStream as argument, in the case that the caller is not interested in the output.

See also NTTextStream, NTTextBuffer and NTTextStringBuffer.

NTWednesday: Final[int]

Third day of the week.

See also NTDate.dayOfWeek().

class NTXml

XML parser class.

Code example:

from Pro.Core import *

x = NTXml()
ret = x.parse("<r><e t='test'></e></r>")
if ret == NTXml_ErrNone:
    n = x.findChild(None, "r")
    if n != None:
        n = x.findChild(n, "e")
        if n != None:
            a = x.findAttribute(n, "t")
            if a != None:
                print(x.value(a))

Methods:

_print([node_or_out, indent_or_node, indent])

Prints a node to an NTTextStream buffer or to a string.

appendAttribute(parent, child)

Appends an attribute to a node.

appendChild(parent, child)

Appends a child node to a parent node.

attributesToHash(node)

Converts all attributes and their values to string dictionary.

childPosition(node)

Computes the position of a node in relation to its siblings.

clear()

Clears the NTXml object and releases all allocated data.

clone(x[, to])

Clones an entire XML document to a new node.

cloneNode(node[, to])

Clones an input node and all its children to a new node.

countChildren([parent])

Counts the children of a node.

createAttribute([name, value])

Creates a new attribute.

createNode([name, value])

Creates a new node.

deleteAllAttributes(node)

Deletes all the attributes of a node.

deleteAllNodes(node)

Deletes all the child nodes of parent node.

deleteAttribute(node, attr)

Delete the specified attribute from a node.

deleteFirstAttribute(node)

Deletes the first attribute of a node.

deleteFirstChild([parent])

Deletes the first child node of a node.

deleteLastAttribute(node)

Deletes the last attribute of a node.

deleteLastChild([parent])

Deletes the last child node of a node.

deleteNode(node)

Deletes a node.

depth(node)

Calculates the depth of a node.

enableThreadSafety(b)

Enables thread safety for the current instance.

findAttribute(attr_or_node, name)

Finds an attribute by its name.

findChild(parent, name[, options])

Finds a child node by its name.

findSibling(node, name[, options])

Finds a sibling node by its name.

firstAttribute(node)

Retrieves the first attribute of a node.

firstChild([parent])

Retrieves the first child node of a node.

getChild(parent, i)

Retrieves the child node of a node by its position.

insertAttribute(parent, sibling, attr)

Inserts an attribute before sibling.

insertChild(parent, sibling, node)

Inserts a a child node before sibling.

isCaseSensitive()

Returns True if the current instance is case-sensitive; otherwise returns False.

isEmpty()

Returns True if parse() wasn’t yet successfully invoked; otherwise returns False.

isModified()

Returns True if the current document was modified; otherwise returns False.

lastAttribute(node)

Retrieves the last attribute of a node.

lastChild([parent])

Retrieves the last child node of a node.

matchName(attr_or_node, name[, options])

Matches the name of a node or an attribute against a string.

name(attr_or_node[, options])

Returns the name of a node or an attribute.

nextAttribute(attr)

Returns the next sibling attribute of the specified attribute.

nextNode(current)

Retrieves the next node starting from current.

nextSibling(node)

Retrieves the next sibling of the specified node.

nodeToPath(node)

Converts the specified node into a path string.

overwriteValue(attr, value)

Overwrites the value of an attribute.

parentNode(node)

Retrieves the parent node of the specified node.

parse(utf8[, flags])

Parses an XML document from a string or a utf-8 byte-array.

pathToNode(path)

Converts a path string returned by nodeToPath() back to a node.

prependAttribute(parent, child)

Prepends an attribute to a node.

prependChild(parent, child)

Prepends a child node to a specified parent node.

previousAttribute(attr)

Returns the previous sibling attribute of the specified attribute.

previousSibling(node)

Returns the previous sibling node of the specified node.

printAndFlush([indent])

Uses _print() to convert the current document to a string and parses the string by calling parse().

setCaseSensitivity(b)

Sets whether the matching of names is case-sensitive.

setModified(b)

Sets or resets the modified status.

setName(attr_or_node, name)

Sets the name of a node or an attribute.

setValue(attr_or_node, value)

Sets the value of a node or an attribute.

value(attr_or_node)

Returns the value of a node or an attribute.

xmlText()

Returns the original XML data passed to parse().

_print(node_or_out: Union[NTTextStream, NTXmlNode] = None, indent_or_node: Union[NTXmlNode, bool] = None, indent: bool = False)Union[None, str]

Prints a node to an NTTextStream buffer or to a string.

The node parameter can be None to output the entire XML document.

Parameters
  • node_or_out (Union[NTTextStream, NTXmlNode]) – Either an NTTextStream buffer or an XML node.

  • indent_or_node (Union[NTXmlNode, bool]) – Either an XML node or a boolean indicating whether to indent the output.

  • indent (bool) – A boolean indicating whether to indent the output.

Returns

Returns the string if no NTTextStream buffer was provided; otherwise returns None.

Return type

Union[None, str]

See also NTTextStream.

appendAttribute(parent: NTXmlNode, child: NTXmlAttribute)None

Appends an attribute to a node.

Parameters
  • parent (NTXmlNode) – The parent node.

  • child (NTXmlAttribute) – The attribute to append.

See also appendChild().

appendChild(parent: NTXmlNode, child: NTXmlNode)None

Appends a child node to a parent node.

Parameters
  • parent (NTXmlNode) – The parent node.

  • child (NTXmlNode) – The child node.

See also appendAttribute().

attributesToHash(node: NTXmlNode)NTUTF8StringHash

Converts all attributes and their values to string dictionary.

Parameters

node (NTXmlNode) – The parent node.

Returns

Returns the string dictionary.

Return type

NTUTF8StringHash

See also name(), value(), firstAttribute() and nextAttribute().

childPosition(node: NTXmlNode)int

Computes the position of a node in relation to its siblings.

Parameters

node (NTXmlNode) – The input node.

Returns

Returns the relative position of the node if successful; otherwise returns -1.

Return type

int

See also countChildren().

clear()None

Clears the NTXml object and releases all allocated data.

clone(x: NTXml, to: NTXmlNode = None)NTXmlNode

Clones an entire XML document to a new node.

Parameters
  • x (NTXml) – The XML document to clone.

  • to (NTXmlNode) – The optional destination node.

Returns

Returns the destination root node if successful; otherwise returns None.

Return type

NTXmlNode

See also cloneNode().

cloneNode(node: NTXmlNode, to: NTXmlNode = None)NTXmlNode

Clones an input node and all its children to a new node.

Parameters
  • node (NTXmlNode) – The node to clone.

  • to (NTXmlNode) – The optional destination node.

Returns

Returns the destination root node if successful; otherwise returns None.

Return type

NTXmlNode

See also clone().

countChildren(parent: NTXmlNode = None)int

Counts the children of a node.

Parameters

parent (NTXmlNode) – The parent node.

Returns

Returns the number of children.

Return type

int

See also childPosition().

createAttribute(name: str = None, value: str = None)NTXmlAttribute

Creates a new attribute.

Parameters
  • name (str) – The optional name of the attribute.

  • value (str) – The optional value of the attribute.

Returns

Returns the created attribute.

Return type

NTXmlAttribute

See also deleteAttribute() and createNode().

createNode(name: str = None, value: str = None)NTXmlNode

Creates a new node.

Parameters
  • name (str) – The optional name of the node.

  • value (str) – The optional value of the node.

Returns

Returns the created node.

Return type

NTXmlNode

See also deleteNode() and createAttribute().

deleteAllAttributes(node: NTXmlNode)None

Deletes all the attributes of a node.

Parameters

node (NTXmlNode) – The input node.

See also deleteAttribute() and deleteAllNodes().

deleteAllNodes(node: NTXmlNode)None

Deletes all the child nodes of parent node.

Parameters

node (NTXmlNode) – The parent node.

See also deleteNode() and deleteAllAttributes().

deleteAttribute(node: NTXmlNode, attr: NTXmlAttribute)None

Delete the specified attribute from a node.

Parameters
  • node (NTXmlNode) – The parent node.

  • attr (NTXmlAttribute) – The attribute to delete.

See also deleteNode() and deleteAllAttributes().

deleteFirstAttribute(node: NTXmlNode)None

Deletes the first attribute of a node.

Parameters

node (NTXmlNode) – The parent node.

See also deleteLastAttribute(), deleteAttribute() and deleteAllAttributes().

deleteFirstChild(parent: NTXmlNode = None)None

Deletes the first child node of a node.

Parameters

parent (NTXmlNode) – The parent node.

See also deleteLastChild(), deleteNode() and deleteAllNodes().

deleteLastAttribute(node: NTXmlNode)None

Deletes the last attribute of a node.

Parameters

node (NTXmlNode) – The parent node.

See also deleteFirstAttribute(), deleteAttribute() and deleteAllAttributes().

deleteLastChild(parent: NTXmlNode = None)None

Deletes the last child node of a node.

Parameters

parent (NTXmlNode) – The parent node.

See also deleteFirstChild(), deleteNode() and deleteAllNodes().

deleteNode(node: NTXmlNode)None

Deletes a node.

Parameters

node (NTXmlNode) – The node to delete.

See also createNode() and deleteAllNodes().

depth(node: NTXmlNode)int

Calculates the depth of a node.

Parameters

node (NTXmlNode) – The input node.

Returns

Returns the depth of the input node.

Return type

int

enableThreadSafety(b: bool)None

Enables thread safety for the current instance.

This method must be called before calling other methods.

Parameters

b (bool) – If True, makes the object safe for use by parallel threads.

findAttribute(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str)NTXmlAttribute

Finds an attribute by its name.

Parameters
  • attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – Either the parent node or a sibling attribute.

  • name (str) – The name of the attribute to find.

Returns

Returns the attribute if present; otherwise returns None.

Return type

NTXmlAttribute

See also findChild() and findSibling().

findChild(parent: NTXmlNode, name: str, options: int = 0)NTXmlNode

Finds a child node by its name.

Parameters
  • parent (NTXmlNode) – The parent node.

  • name (str) – The name of the node to find.

  • options (int) – NTXml_IgnoreNS() can be specified to ignore namespaces.

Returns

Returns the child node if present; otherwise returns None.

Return type

NTXmlNode

See also findAttribute() and findSibling().

findSibling(node: NTXmlNode, name: str, options: int = 0)NTXmlNode

Finds a sibling node by its name.

Parameters
  • node (NTXmlNode) – The sibling from which to start the search.

  • name (str) – The name of the node to find.

  • options (int) – NTXml_IgnoreNS() can be specified to ignore namespaces.

Returns

Returns the sibling node if present; otherwise returns None.

Return type

NTXmlNode

See also findChild() and findAttribute().

firstAttribute(node: NTXmlNode)NTXmlAttribute

Retrieves the first attribute of a node.

Parameters

node (NTXmlNode) – The parent node.

Returns

Returns the first attribute if present; otherwise returns None.

Return type

NTXmlAttribute

See also nextAttribute() and firstChild().

firstChild(parent: NTXmlNode = None)NTXmlNode

Retrieves the first child node of a node.

Parameters

parent (NTXmlNode) – The parent node.

Returns

Returns the first child node if present; otherwise returns None.

Return type

NTXmlNode

See also nextSibling(), nextNode() and firstAttribute().

getChild(parent: NTXmlNode, i: int)NTXmlNode

Retrieves the child node of a node by its position.

Parameters
  • parent (NTXmlNode) – The parent node.

  • i (int) – The position of the child node to retrieve.

Returns

Returns the requested child node if available; otherwise returns None.

Return type

NTXmlNode

See also firstChild() and nextSibling().

insertAttribute(parent: NTXmlNode, sibling: NTXmlAttribute, attr: NTXmlAttribute)None

Inserts an attribute before sibling.

Parameters
  • parent (NTXmlNode) – The parent node.

  • sibling (NTXmlAttribute) – The sibling of the attribute to insert. This value can be None to insert the new attribute at the back.

  • attr (NTXmlAttribute) – The attribute to insert.

See also createAttribute(), deleteAttribute() and insertChild().

insertChild(parent: NTXmlNode, sibling: NTXmlNode, node: NTXmlNode)None

Inserts a a child node before sibling.

Parameters
  • parent (NTXmlNode) – The parent node.

  • sibling (NTXmlNode) – The sibling of the node to insert. This value can be None to insert the new node at the back.

  • node (NTXmlNode) – The node to insert.

See also createNode(), deleteNode() and insertAttribute().

isCaseSensitive()bool
Returns

Returns True if the current instance is case-sensitive; otherwise returns False.

Return type

bool

See also setCaseSensitivity().

isEmpty()bool
Returns

Returns True if parse() wasn’t yet successfully invoked; otherwise returns False.

Return type

bool

See also parse().

isModified()bool
Returns

Returns True if the current document was modified; otherwise returns False.

Return type

bool

See also setModified().

lastAttribute(node: NTXmlNode)NTXmlAttribute

Retrieves the last attribute of a node.

Parameters

node (NTXmlNode) – The parent node.

Returns

Returns the last attribute if present; otherwise returns None.

Return type

NTXmlAttribute

See also previousAttribute() and lastChild().

lastChild(parent: NTXmlNode = None)NTXmlNode

Retrieves the last child node of a node.

Parameters

parent (NTXmlNode) – The parent node.

Returns

Returns the last child node if present; otherwise returns None.

Return type

NTXmlNode

See also previousSibling() and lastAttribute().

matchName(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str, options: int = 0)bool

Matches the name of a node or an attribute against a string.

Parameters
  • attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute whose name to match.

  • name (str) – The name to match.

  • options (int) – NTXml_IgnoreNS() can be specified to ignore namespaces.

Returns

Returns True if the name matches; otherwise returns False.

Return type

bool

See also name().

name(attr_or_node: Union[NTXmlAttribute, NTXmlNode], options: int = 0)str

Returns the name of a node or an attribute.

Parameters
  • attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to retrieve the name.

  • options (int) – NTXml_IgnoreNS() can be specified to discard the namespace.

Returns

Returns the name of the specified node or attribute.

Return type

str

See also value(), matchName() and setName().

nextAttribute(attr: NTXmlAttribute)NTXmlAttribute

Returns the next sibling attribute of the specified attribute.

Parameters

attr (NTXmlAttribute) – The attribute for which to retrieve the sibling.

Returns

Returns the next sibling attribute if present; otherwise returns None.

Return type

NTXmlAttribute

See also previousAttribute(), firstAttribute() and nextSibling().

nextNode(current: NTXmlNode)NTXmlNode

Retrieves the next node starting from current.

The difference with nextSibling() is that this method also enumerates child nodes.

Parameters

current (NTXmlNode) – The current node. This parameter can be None to start from the first root node of the document.

Returns

Returns the next node if present; otherwise returns None.

Return type

NTXmlNode

See also nextSibling(), firstChild() and parentNode().

nextSibling(node: NTXmlNode)NTXmlNode

Retrieves the next sibling of the specified node.

Parameters

node (NTXmlNode) – The node for which to retrieve the sibling.

Returns

Returns the next sibling node if present; otherwise returns None.

Return type

NTXmlNode

See also previousSibling(), firstChild() and parentNode().

nodeToPath(node: NTXmlNode)str

Converts the specified node into a path string.

Take this code snippet:

from Pro.Core import *

x = NTXml()
ret = x.parse("<r><unk0/><e><unk1/><unk2/><c/></e></r>")
if ret == NTXml_ErrNone:
    n = x.findChild(None, "r")
    if n != None:
        n = x.findChild(n, "e")
        if n != None:
            c = x.findChild(n, "c")
            if c != None:
                print(x.nodeToPath(c))

It will output the following path string: 0<r>1<e>2<c>

Each node in the path is preceded by its position as a child relative to its siblings. Since the r node is the root node, it is at position 0. The e node is the second child node of r and hence it is at position 1. The c node is the third child node of e and hence it is at position 2.

A path string can be converted back to a node by using pathToNode().

Parameters

node (NTXmlNode) – The node for which to create a path string.

Returns

Returns the path string.

Return type

str

See also pathToNode().

overwriteValue(attr: NTXmlAttribute, value: str)bool

Overwrites the value of an attribute.

The difference with setValue() is that this method overwrites the value in place without allocating additional memory. Therefore, the size of the new value must match the size of the old one in order for the method to succeed.

Parameters
  • attr (NTXmlAttribute) – The attribute whose value should be overwritten.

  • value (str) – The new value of the attribute.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setValue().

parentNode(node: NTXmlNode)NTXmlNode

Retrieves the parent node of the specified node.

Parameters

node (NTXmlNode) – The node for which to retrieve the parent.

Returns

Returns the parent node if present; otherwise returns None.

Return type

NTXmlNode

See also firstChild(), lastChild() and getChild().

parse(utf8: Union[bytes, str], flags: int = 0)int

Parses an XML document from a string or a utf-8 byte-array.

Parameters
  • utf8 (Union[bytes, str]) – The XML string or utf-8 byte-array.

  • flags (int) – Can be NTXml_FaultTolerant to parse malformed XML data.

Returns

Returns NTXml_ErrNone if successful; otherwise returns an error code.

Return type

int

See also nextNode(), firstChild() and nextSibling().

pathToNode(path: str)NTXmlNode

Converts a path string returned by nodeToPath() back to a node.

Parameters

path (str) – The path string.

Returns

Returns the converted node if successful; otherwise returns None.

Return type

NTXmlNode

See also nodeToPath().

prependAttribute(parent: NTXmlNode, child: NTXmlAttribute)None

Prepends an attribute to a node.

Parameters
  • parent (NTXmlNode) – The parent node.

  • child (NTXmlAttribute) – The attribute to prepend.

See also appendAttribute(), insertAttribute(), deleteAttribute() and prependChild().

prependChild(parent: NTXmlNode, child: NTXmlNode)None

Prepends a child node to a specified parent node.

Parameters
  • parent (NTXmlNode) – The parent node.

  • child (NTXmlNode) – The child node to prepend.

See also appendChild(), insertChild(), deleteNode() and prependAttribute().

previousAttribute(attr: NTXmlAttribute)NTXmlAttribute

Returns the previous sibling attribute of the specified attribute.

Parameters

attr (NTXmlAttribute) – The attribute for which to retrieve the sibling.

Returns

Returns the previous sibling attribute if present; otherwise returns None.

Return type

NTXmlAttribute

See also nextAttribute(), lastAttribute() and previousSibling().

previousSibling(node: NTXmlNode)NTXmlNode

Returns the previous sibling node of the specified node.

Parameters

node (NTXmlNode) – The node for which to retrieve the sibling.

Returns

Returns the previous sibling node if present; otherwise returns None.

Return type

NTXmlNode

See also nextSibling(), lastChild() and previousAttribute().

printAndFlush(indent: bool = False)str

Uses _print() to convert the current document to a string and parses the string by calling parse().

Parameters

indent (bool) – If True, converts the document to string with indentation.

Returns

Returns the string returned by _print().

Return type

str

See also _print() and parse().

setCaseSensitivity(b: bool)None

Sets whether the matching of names is case-sensitive.

The default is True.

Parameters

b (bool) – If False, the matching of names becomes case-insensitive.

See also isCaseSensitive().

setModified(b: bool)None

Sets or resets the modified status.

Parameters

b (bool) – If True, sets the modified status; otherwise resets it.

See also isModified().

setName(attr_or_node: Union[NTXmlAttribute, NTXmlNode], name: str)None

Sets the name of a node or an attribute.

Parameters
  • attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to set the name.

  • name (str) – The name to set.

See also name(), value() and setValue().

setValue(attr_or_node: Union[NTXmlAttribute, NTXmlNode], value: str)None

Sets the value of a node or an attribute.

Parameters
  • attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to set the value.

  • value (str) – The value to set.

See also value(), name() and setName().

value(attr_or_node: Union[NTXmlAttribute, NTXmlNode])str

Returns the value of a node or an attribute.

Parameters

attr_or_node (Union[NTXmlAttribute, NTXmlNode]) – The node or attribute for which to retrieve the value.

Returns

Returns the value of the node or attribute.

Return type

str

See also setValue(), name() and setName().

xmlText()str
Returns

Returns the original XML data passed to parse().

Return type

str

See also parse() and printAndFlush().

NTXml_ErrAlloc: Final[int]

Returned if an allocation error occurred.

See also NTXml.parse().

NTXml_ErrNone: Final[int]

Returned if no error occurred.

See also NTXml.parse().

NTXml_ErrParse: Final[int]

Returned if a parse error occurred.

See also NTXml.parse().

NTXml_ErrUnknown: Final[int]

Returned if an unknown error occurred.

See also NTXml.parse().

NTXml_FaultTolerant: Final[int]

Parses malformed XML data.

See also NTXml.parse().

NTXml_IgnoreNS: Final[int]

Ignores XML node namespaces.

See also NTXml.name(), NTXml.matchName(), NTXml.findChild() and NTXml.findSibling().

NTXml_InvalidFlags: Final[int]

Returned if invalid flags were specified.

See also NTXml.parse().

NTXml_InvalidNode: Final[int]

Returned if an invalid node was specified.

See also NTXml.parse().

NTXml_InvalidType: Final[int]

Returned if an invalid type was specified.

See also NTXml.parse().

NT_ASF_BlockIO: Final[int]

Address space flag for block I/O.

See also NTAddressSpace.setFlags().

NT_ASF_IgnoreInvalidPages: Final[int]

Address space flag to ignore invalid pages.

See also NTAddressSpace.setFlags().

NT_ASF_IsSparse: Final[int]

Address space flag for sparse address spaces.

See also NTAddressSpace.setFlags().

NT_ASF_Memory: Final[int]

Address space flag for process memory.

See also NTAddressSpace.setFlags().

NT_ASPSF_ALL: Final[int]

Address space standard flag which combines all supported flags.

See also NTAddressSpace.

NT_ASPSF_DIRTY: Final[int]

Address space standard flag for dirty pages.

See also NTAddressSpace.

NT_ASPSF_EXECUTE: Final[int]

Address space standard flag for executable pages.

See also NTAddressSpace.

NT_ASPSF_GUARD: Final[int]

Address space standard flag for guarded pages.

See also NTAddressSpace.

NT_ASPSF_PRESENCE: Final[int]

Address space standard flag for readable/present pages.

See also NTAddressSpace.

NT_ASPSF_TRANSITION: Final[int]

Address space standard flag for transitional pages.

See also NTAddressSpace.

NT_ASPSF_USER_MODE: Final[int]

Address space standard flag for user mode pages.

See also NTAddressSpace.

NT_ASPSF_WRITE: Final[int]

Address space standard flag for writable pages.

See also NTAddressSpace.

NT_ASR_INVALID: Final[int]

Address space result for unsuccessful operations.

See also NTAddressSpace.

NT_ASR_OK: Final[int]

Address space result for successful operations.

See also NTAddressSpace.

NT_ASR_UNSUPPORTED: Final[int]

Address space result for unsupported operations.

See also NTAddressSpace.

NT_AppendFile(src: NT_FILE, copySize: int, dst: NT_FILE)bool

Appends copySize bytes of src file to dst file.

Parameters
  • src (NT_FILE) – The source file.

  • copySize (int) – The amount of bytes to copy.

  • dst (NT_FILE) – The destination file.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_OpenFile() and NT_CreateFile().

NT_ApplyFileExt(fileName: str, filetype: NTFileExtensions)str

Appends the default extension type for the current system specified by filetype to fileName.

Parameters
  • fileName (str) – The input file name without extension.

  • filetype (NTFileExtensions) – The extension type to apply (i.e.: NT_FileExt_Exe, NT_FileExt_Dll, NT_FileExt_Link).

Returns

Returns the file name combined with specified extension type.

Return type

str

See also NT_FileExtFromName() and NT_StripFileExt().

NT_AutoDecodeBytes(raw: bytes)str

This function tries to decode raw bytes into a string using simple heuristics.

Parameters

raw (bytes) – The raw bytes to decode.

Returns

Returns a decoded string if possible; otherwise returns an empty string.

Return type

str

See also NT_DecodeAsciiBytes() and NT_DecodeAsciiBytes16().

NT_CloseFile(ntfile: NT_FILE)None

Closes an open file handle.

Parameters

ntfile (NT_FILE) – The file handle to close.

See also NT_OpenFile() and NT_CreateFile().

NT_CloseModuleHandle(ntmod: NT_MODULE)None

Closes the handle of a module without unloading the module.

Parameters

ntmod (NT_MODULE) – The handle to close.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_FreeModule() and NT_LoadModule().

NT_CloseProcess(proc: NT_PROCESS)None

Closes a process handle.

Parameters

proc (NT_PROCESS) – The process handle to close.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess().

NT_ColorFromString(str: str)int

Compute a color from an input string.

Hint

The computed color can be used in UI controls such as the hex view.

Parameters

str (str) – The input string.

Returns

Returns the computed color.

Return type

int

Available since Cerbero Suite 7.3 and Cerbero Engine 4.3.

NT_CopyFile(fileNameA: str, fileNameB: str)bool

Copies a file.

Parameters
  • fileNameA (str) – The name of the file to copy.

  • fileNameB (str) – The destination file name for the copy operation.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_CopyFileOpen() and NT_OpenFile().

NT_CopyFileOpen(fileNameA: str, fileNameB: str)NT_FILE

Copies a file. The difference with NT_CopyFile() is that this function returns a handle to the created file.

Parameters
  • fileNameA (str) – The name of the file to copy.

  • fileNameB (str) – The destination file name for the copy operation.

Returns

Returns the handle of the created file if successful; otherwise returns None.

Return type

NT_FILE

See also NT_CopyFile() and NT_OpenFile().

NT_CreateDirectory(dirName: str)bool

Creates a directory.

Parameters

dirName (str) – The name of the directory to create.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_CreateDirectoryTree() and NT_DeleteDirectory().

NT_CreateDirectoryTree(dirName: str)bool

Creates a directory and all the intermediate directories leading up to that directory if not yet present.

Parameters

dirName (str) – The name of the directory to create.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_CreateDirectory() and NT_DeleteDirectory().

NT_CreateFile(FileName: str, opt: int = NTFileOpt_Write)NT_FILE

Creates a file. If the file already exists, it will be overwritten unless NTFileOpt_CreateNew is specified.

Parameters
  • FileName (str) – The name of the file to create.

  • opt (int) – Access options. By default the file will have read/write access (NTFileOpt_Write) access.

Returns

Returns the handle of the created file if successful; otherwise returns None.

Return type

NT_FILE

See also NT_OpenFile(), NT_CloseFile(), NT_ReadFile() and NT_WriteFile().

Creates a link (e.g.: .lnk on Windows) file.

Currently this operation is supported only on Windows.

Parameters
  • fileName (str) – The file name for which to create a link file.

  • linkName (str) – The name of the link to create.

  • descr (str) – An optional description for the link.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_DeleteLink() and NT_ApplyFileExt().

NT_CreateTempFile(ext: str = str(), auto_delete: bool = True)NT_FILE

Creates a temporary file.

The file will be automatically deleted when closed using NT_CloseFile() unless auto_delete is set to False.

Parameters
  • ext (str) – Optional extension for the temporary file.

  • auto_delete (bool) – If True, the file is automatically deleted when closed. Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

Returns

Returns the handle of the created file if successful; otherwise returns None.

Return type

NT_FILE

See also NT_CloseFile() and NT_GetTempFileName().

NT_DecodeAsciiBytes(raw: bytes)str

This function tries to decode an ascii string using simple heuristics.

Parameters

raw (bytes) – The raw bytes to decode.

Returns

Returns a decoded string if possible; otherwise returns an empty string.

Return type

str

See also NT_AutoDecodeBytes() and NT_DecodeAsciiBytes16().

NT_DecodeAsciiBytes16(raw: bytes, endianness: int)str

This function tries to decode an ascii wide-char string using simple heuristics.

Parameters
  • raw (bytes) – The raw bytes to decode.

  • endianness (int) – The endianness of the string.

Returns

Returns a decoded string if possible; otherwise returns an empty string.

Return type

str

See also NT_AutoDecodeBytes() and NT_DecodeAsciiBytes().

NT_DeleteDirectory(dirName: str)bool

Deletes a directory.

Parameters

dirName (str) – The name of the directory to delete.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_CreateDirectory() and NT_DeleteFile().

NT_DeleteFile(FileName: str)bool

Deletes a file.

Parameters

FileName (str) – The name of the file to delete.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_TrashFile(), NT_CreateFile() and NT_DeleteDirectory().

Deletes a link (e.g.: .lnk on Windows) file.

Currently this operation is supported only on Windows.

Parameters

linkName (str) – The name of the link file to delete. The correct extension is automatically appended if missing.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_CreateFileLink() and NT_ApplyFileExt().

NT_DirectoryExists(dirName: str)bool

Checks the existence of a directory.

Parameters

dirName (str) – The name of the directory.

Returns

Returns True if the directory exists; otherwise returns False.

Return type

bool

See also NT_FileExists().

NT_FileAttr_Compressed: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileAttr_Encrypted: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileAttr_Hidden: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileAttr_ReadOnly: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileAttr_System: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileAttr_Temporary: Final[int]

File attribute flag.

See also NT_GetFileAttributes().

NT_FileExists(FileName: str)bool

Checks the existence of a file.

Important

This function doesn’t distinguish between files and directories. To know whether the file is a file or a directory, you must use NT_DirectoryExists().

Parameters

FileName (str) – The name of the file or directory.

Returns

Returns True if the file or directory exists; otherwise returns False.

Return type

bool

See also NT_DirectoryExists().

NT_FileExtFromName(fileName: str, include_dot: bool = True)str

Retrieves the extension of a file name (e.g.: ".exe").

Parameters
  • fileName (str) – The name of the file.

  • include_dot (bool) – If True, includes the dot separator in the returned extension (available since Cerbero Suite 5.7 and Cerbero Engine 2.7.).

Returns

Returns the file extension if present; otherwise returns an empty string.

Return type

str

See also NT_StripFileExt(), NT_ApplyFileExt(), NT_FileNameFromPath() and NT_PathFromFileName().

NT_FileExt_Dll: Final[int]

Applies a shared library extension to the file name (e.g.: ".dll" on Windows and ".dylib" on macOS).

See also NT_ApplyFileExt().

NT_FileExt_Exe: Final[int]

Applies a binary extension to the file name (i.e., ".exe" on Windows).

See also NT_ApplyFileExt().

Applies a link extension to the file name (i.e., ".lnk" on Windows).

See also NT_ApplyFileExt().

NT_FileNameFromPath(path: str)str

Retrieves the file name from a path.

Parameters

path (str) – The full path.

Returns

Returns the file name if present; otherwise returns an empty string.

Return type

str

See also NT_PathFromFileName() and NT_FileExtFromName().

NT_FileToBuffer(fileName: str, maxSize: int, readPartial: bool = False)bytes

Reads a file to a memory buffer.

Parameters
  • fileName (str) – The name of the file to read from.

  • maxSize (int) – The maximum amount of data to read.

  • readPartial (bool) – Specifies whether to accept a partial read. When False, the function will fail if the size of the file is bigger than the maximum amount of data to read.

Returns

Returns the buffer if successful; otherwise returns an empty buffer.

Return type

bytes

See also NT_OpenFile(), NT_ReadFile() and NT_GetFileSize().

NT_FloatToString(v: float)str

Converts a float value to string.

This function offers a coherent representation of float values across the application.

Parameters

v (float) – The float value to convert.

Returns

Returns the converted float value.

Return type

str

NT_Folder_App: Final[int]

Retrieves the application directory. On macOS it retrieves the path to Contents/Resources.

See also NT_GetSpecialFolder() and NT_Folder_AppExe.

NT_Folder_AppData: Final[int]

Retrieves the AppData directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_AppExe: Final[int]

Retrieves the application directory. On macOS it retrieves the path to Contents/MacOS.

See also NT_GetSpecialFolder() and NT_Folder_App.

NT_Folder_AppMenu: Final[int]

Retrieves the AppMenu directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_Applications: Final[int]

Retrieves the applications directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_Applications_x86: Final[int]

Retrieves the x86 applications directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_Common_AppMenu: Final[int]

Retrieves the shared AppMenu directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_Common_Desktop: Final[int]

Retrieves the shared desktop directory on Windows.

See also NT_GetSpecialFolder().

NT_Folder_Current: Final[int]

Retrieves the current working directory.

See also NT_GetSpecialFolder().

NT_Folder_Desktop: Final[int]

Retrieves the desktop directory.

See also NT_GetSpecialFolder().

NT_Folder_Documents: Final[int]

Retrieves the documents directory.

See also NT_GetSpecialFolder().

NT_Folder_Home: Final[int]

Retrieves the home directory.

See also NT_GetSpecialFolder().

NT_Folder_Root: Final[int]

Retrieves the root directory (i.e., "/" on Linux/macOS and "C:/" on Windows).

See also NT_GetSpecialFolder().

NT_Folder_Temp: Final[int]

Retrieves the temporary directory.

See also NT_GetSpecialFolder().

NT_FreeModule(ntmod: NT_MODULE)None

Unloads a module and closes its handle.

Parameters

ntmod (NT_MODULE) – The module to unload.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_CloseModuleHandle() and NT_LoadModule().

NT_GetCurrentDirectory()str
Returns

Returns the current working directory.

Return type

str

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also NT_SetCurrentDirectory().

NT_GetCurrentModuleFileName()str
Returns

Returns the name of the current module including its path.

Return type

str

See also NT_GetCurrentModulePath().

NT_GetCurrentModulePath()str
Returns

Returns the full path of the current module.

Return type

str

See also NT_GetCurrentModuleFileName().

NT_GetCurrentProcessId()int
Returns

Returns the current process id.

Return type

int

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetCurrentProcessPath().

NT_GetCurrentProcessPath()str
Returns

Returns the path of the executable of the current process.

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetCurrentProcessId().

NT_GetFileAttributes(fileName: str)int

Retrieves the attributes of a file.

Parameters

fileName (str) – The file name.

Returns

Returns the file attributes (e.g., NT_FileAttr_ReadOnly) if successful; otherwise returns 0.

Return type

int

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also NT_GetFileAttributesAsString().

NT_GetFileAttributesAsString(fileName: str)str

Retrieves the attributes of a file as a string.

Parameters

fileName (str) – The file name.

Returns

Returns the file attributes if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also NT_GetFileAttributes().

NT_GetFileName(ntfile: NT_FILE)str

Retrieves the name of a file from its handle.

Parameters

ntfile (NT_FILE) – The handle of the open file.

Returns

Returns the name of the file.

Return type

str

See also NT_OpenFile() and NT_CreateFile().

NT_GetFileOwner(fileName: str)str

Retrieves the file owner of a file.

Hint

Multiple owners are separated by new-lines.

Parameters

fileName (str) – The file name.

Returns

Returns the file owner if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

NT_GetFilePermissionsAsString(fileName: str)str

Retrieves the file permissions as a string.

Parameters

fileName (str) – The file name.

Returns

Returns the file permissions as a string if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

NT_GetFilePos(ntfile: NT_FILE)tuple[bool, int]

Gets the current file position.

Parameters

ntfile (NT_FILE) – The handle of the open file.

Returns

Returns a tuple consisting of a boolean that indicates the function succeeded and the current file position.

Return type

tuple[bool, int]

See also NT_SetFilePos().

NT_GetFileSize(ntfile: NT_FILE)int

Gets the size of a file.

Parameters

ntfile (NT_FILE) – The handle of the open file.

Returns

Returns the size of the file.

Return type

int

See also NT_SetFileSize().

NT_GetMemoryRegions(pid: int, allocated_only: bool = True, limit: int = NT_MEMORY_REGIONS_MAX_ADDR)Pro.Core.NTMemoryInfoList

Retrieves the list of memory regions allocated by the specified process.

Hint

Internally this function uses NTProcessRegionsEnumerator.

Parameters
  • pid (int) – The process id.

  • allocated_only (bool) – If True, only returns allocated regions.

  • limit (int) – The maximum address of enumerated regions.

Returns

Returns the list of memory regions.

Return type

NTMemoryInfoList

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NTProcessRegionsEnumerator and NT_MEMORY_INFO.

NT_GetModule(name: str)NT_MODULE

Retrieves a module from its name.

Hint

The module must already be loaded for it to be retrieved by name.

Parameters

name (str) – The name of the module to retrieve.

Returns

Returns the handle of the module if successful; otherwise returns None.

Return type

NT_MODULE

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_LoadModule().

NT_GetModuleList(pid: int)Pro.Core.NTModuleInfoList

Retrieves the list of modules loaded in the address space of a process.

Note

This function is not available on macOS.

Parameters

pid (int) – The process id.

Returns

Returns the list of loaded modules.

Return type

NTModuleInfoList

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_MODULE_INFO.

NT_GetProcessFileName(pid_or_proc: Union[NT_PROCESS, int])str

Retrieves the path of the executable of a specified process.

Parameters

pid_or_proc (Union[NT_PROCESS, int]) – The process id or handle.

Returns

Returns the path if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetCurrentProcessPath().

NT_GetProcessId(proc: NT_PROCESS)int

Retrieves the process id for a process handle.

Parameters

proc (NT_PROCESS) – The process handle.

Returns

Returns the process id.

Return type

int

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

NT_GetProcessList(only_accessible: bool = False)Pro.Core.NTProcessInfoList

Retrieves the current list of processes.

Parameters

only_accessible (bool) – If True, only processes that can be opened for read-access are included in the list.

Returns

Returns the current list of processes.

Return type

NTProcessInfoList

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_PROCESS_INFO.

NT_GetSpecialFolder(f: NTSpecialFolders)str

Retrieves a special system directory.

Parameters

f (NTSpecialFolders) – The directory to retrieve (e.g.: NT_Folder_App).

Returns

Returns the requested directory if available; otherwise returns an empty string.

Return type

str

See also NT_GetCurrentModulePath().

NT_GetSystemFileHandle(ntfile: NT_FILE)SystemHandle

Returns the internal system handle of a file.

Parameters

ntfile (NT_FILE) – The handle of the open file.

Returns

Returns the system handle of the file.

Return type

SystemHandle

NT_GetTempFileName(ext: str = str())str

Generates a temporary file name.

Warning

The use of NT_CreateTempFile() is recommended instead, since NT_GetTempFileName() can lead to concurrency issues.

Parameters

ext (str) – Optional extension for the temporary file name.

Returns

Returns the generated name if successful; otherwise returns an empty string.

Return type

str

See also NT_CreateTempFile().

NT_GetTickCount()int
Returns

Returns the time passed since system boot in milliseconds.

Return type

int

Available since Cerbero Suite 6.1 and Cerbero Engine 3.1.

See also NTTimer.

NT_HasProcessAPI()bool
Returns

Returns True if the process API is available on the current system; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

NT_HexCharToByte(ch: int)int

Converts a hex character into its corresponding integer value (e.g.: ord('F') -> 15).

Parameters

ch (int) – The hex character to convert.

Returns

Returns the converted hex character if successful; otherwise returns -1.

Return type

int

NT_IsCurrentModuleDLL()bool
Returns

Returns True if the current module is a shared library; otherwise returns False.

Return type

bool

Note

This function will return True only when called from the SDK of Cerbero Engine.

NT_IsRelativePath(path: str)bool

Checks whether a path is relative.

Parameters

path (str) – The path to check.

Returns

Returns True if the path is relative; otherwise returns False.

Return type

bool

NT_KillProcess(pid_or_proc: Union[NT_PROCESS, int], timeout: int = 0)bool

Terminates a process.

Parameters
  • pid_or_proc (Union[NT_PROCESS, int]) – The process id or handle.

  • timeout (int) – The time-out for the operation in milliseconds.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

NT_LoadModule(name: str)NT_MODULE

Loads a module from disk.

Parameters

name (str) – The name of the module to load.

Returns

Returns the handle of the loaded module if successful; otherwise returns None.

Return type

NT_MODULE

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetModule(), NT_ResolveSymbol(), NT_CloseModuleHandle() and NT_FreeModule().

class NT_MEMORY_INFO

This class represents a memory region.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetMemoryRegions() and NTProcessRegionsEnumerator.

Attributes:

flags

The flags of the memory region (e.g., NTProcessMemoryAccess_Read).

size

The size of the memory region.

start

The start address of the memory region.

state

The state of the memory region (e.g., NTProcessMemoryState_Commit).

type

The type of the memory region (e.g., NTProcessMemoryType_Image).

Methods:

isValid()

Returns True if the memory region is valid; otherwise returns False.

flags

The flags of the memory region (e.g., NTProcessMemoryAccess_Read).

isValid()bool
Returns

Returns True if the memory region is valid; otherwise returns False.

Return type

bool

size

The size of the memory region.

See also start.

start

The start address of the memory region.

See also size.

state

The state of the memory region (e.g., NTProcessMemoryState_Commit).

type

The type of the memory region (e.g., NTProcessMemoryType_Image).

NT_MEMORY_REGIONS_MAX_ADDR: Final[int]

Maximum memory address for memory regions.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetMemoryRegions().

class NT_MODULE_INFO

This class contains information about a loaded module.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetModuleList().

Attributes:

base

The start address of the module.

name

The name of the module.

path

The full path of the module.

size

The size of the module.

base

The start address of the module.

See also size.

name

The name of the module.

See also path.

path

The full path of the module.

See also name.

size

The size of the module.

See also base.

NT_MakeCString(str: str)str

Escapes a string for C (e.g.: "Hello,\nWorld!" becomes "Hello,\\nWorld!").

Parameters

str (str) – The string to escape.

Returns

Returns the escaped string.

Return type

str

See also NT_UnescapeCString().

NT_MakeFileExecutable(fileName: str)bool

Adds executable attributes to the specified file if they’re missing.

Note

On Windows this function merely checks the presence of the file.

Parameters

fileName (str) – The name of the file.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

NT_MatchFileName(fileNameA: str, fileNameB: str)bool

Compares two paths taking also into account the case sensitivity of the current file system.

Parameters
  • fileNameA (str) – The first file name.

  • fileNameB (str) – The second file name.

Returns

Returns True if the two file names match; otherwise returns False.

Return type

bool

See also NT_NormalizeFileName().

NT_MemorySizeToString(size: int, prec: int = 4)str

Converts a size in bytes to a string representation using byte, KB, MB or GB units.

Parameters
  • size (int) – The size to convert.

  • prec (int) – The precision of the resulting string.

Returns

Returns the string size representation.

Return type

str

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

NT_NormalizeFileName(fileName: str)str

Replaces any backslash in a file name with a forward slash.

Parameters

fileName (str) – The file name to normalize.

Returns

Returns the normalized file name.

Return type

str

See also NT_NormalizeFileName() and NT_NormalizeToNative().

NT_NormalizePath(path: str)str

Replaces any backslash in a path with a forward slash and makes sure that the path ends with a trailing forward slash.

Parameters

path (str) – The path to normalize.

Returns

Returns the normalized path.

Return type

str

See also NT_NormalizeFileName() and NT_NormalizeToNative().

NT_NormalizeToNative(fileOrPath: str)str

Replaces the slashes of an already normalized file name or path with the slashes expected by the current system (i.e., backslashes on Windows and slashes on Linux/macOS).

Parameters

fileOrPath (str) – The file name or path to normalize.

Returns

Returns the normalized file name or path.

Return type

str

See also NT_NormalizeFileName() and NT_NormalizePath().

NT_OpenFile(FileName: str, opt: int = NTFileOpt_ReadOnly)NT_FILE

Opens an existing file.

Parameters
  • FileName (str) – The name of the file to open.

  • opt (int) – Optional file access. By the default files are opened as read-only (NTFileOpt_ReadOnly). To open them for writing, NTFileOpt_Write must be specified.

Returns

Returns the handle of the opened file if successful; otherwise returns None.

Return type

NT_FILE

See also NT_CreateFile(), NT_CloseFile(), NT_ReadFile() and NT_WriteFile().

NT_OpenProcess(pid: int, access: int = NT_ProcessAccess_Read)NT_PROCESS

Retrieves a handle to a process.

Warning

The process API might not be available on all systems. Use NT_HasProcessAPI() to check the availability of the process API.

Parameters
  • pid (int) – The process id.

  • access (int) – The access level required (e.g., NT_ProcessAccess_Read).

Returns

Returns the handle of the process if successful; otherwise returns None.

Return type

NT_PROCESS

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_ReadProcessMemory(), NT_WriteProcessMemory() and NT_CloseProcess().

class NT_PROCESS_INFO

This class contains information about a process.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_GetProcessList().

Attributes:

name

The name of the process.

path

The full path of the process executable.

pid

The process id.

ppid

The parent process id.

name

The name of the process.

See also path.

path

The full path of the process executable.

See also name.

pid

The process id.

See also ppid.

ppid

The parent process id.

See also pid.

NT_PathFromFileName(fileName: str)str

Separates a path or file name from its trailing part. When passing a file name as argument, it will return its path.

Parameters

fileName (str) – The file name or path.

Returns

Returns the partial path as a normalized path.

Return type

str

See also NT_RawPathFromFileName(), NT_FileNameFromPath() and NT_FileExtFromName().

NT_ProcessAccess_All: Final[int]

All process access privileges.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess().

NT_ProcessAccess_Read: Final[int]

Process read access privileges.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess().

NT_ProcessAccess_Terminate: Final[int]

Process termination access privileges.

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess().

NT_RawPathFromFileName(fileName: str)str

Behaves exactly like NT_PathFromFileName(), except that it retains the slashes of the input.

Parameters

fileName (str) – The file name or path.

Returns

Returns the partial path with its original slashes and with a trailing backslash or slash.

Return type

str

See also NT_RawPathFromFileName().

NT_ReadFile(ntfile: NT_FILE, nBytesToRead: int)bytes

Reads a specified amount of bytes from a file and updates the file position.

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • nBytesToRead (int) – The number of bytes to read.

Returns

Returns the bytes read from the file if successful; otherwise returns an empty bytes object.

Return type

bytes

See also NT_FileToBuffer(), NT_WriteFile(), NT_OpenFile(), NT_CreateFile() and NT_CloseFile().

NT_ReadProcessMemory(proc: NT_PROCESS, MemoryAddr: int, nBytesToRead: int)bytes

Reads the memory of a process.

Parameters
  • proc (NT_PROCESS) – The process handle.

  • MemoryAddr (int) – The memory address to read from.

  • nBytesToRead (int) – The number of bytes to read.

Returns

Returns the bytes read if successful; otherwise returns an empty bytes object.

Return type

bytes

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess() and NT_WriteProcessMemory().

NT_ResetFixedFileSize(ntfile: NT_FILE)None

Resets the fixed file size set by calling NT_SetFixedFileSize().

Parameters

ntfile (NT_FILE) – The handle of the open file.

See also NT_SetFixedFileSize().

NT_ResolveShortcut(shortcut: str)str

Resolves the target of a link (.lnk) file.

This operation is only supported on Windows.

Parameters

shortcut (str) – The file name of the link to resolve.

Returns

Returns the resolved target if successful; otherwise returns an empty string.

Return type

str

See also NT_CreateFileLink().

NT_ResolveSymbol(ntmod: NT_MODULE, symname: str)native_pointer

Resolves the symbol of a module.

Parameters
  • ntmod (NT_MODULE) – The module handle.

  • symname (str) – The name of the symbol to resolve.

Returns

Returns the address of the resolved symbol if successful; otherwise returns None.

Return type

native_pointer

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_LoadModule() and NT_GetModule().

NT_SetCurrentDirectory(dirName: str)bool

Sets the current working directory.

Parameters

dirName (str) – The directory to set as current working directory.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also NT_GetCurrentDirectory().

NT_SetFileAutoDelete(ntfile: NT_FILE, auto_delete: bool)None

Sets the auto-deletion flag for the file.

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • auto_delete (bool) – If True, the file is automatically deleted when closed.

Available since Cerbero Suite 5.7 and Cerbero Engine 2.7.

See also NT_CreateTempFile().

NT_SetFilePos(ntfile: NT_FILE, FileOffset: int)bool

Sets the current file position.

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • FileOffset (int) – The new file position.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_GetFilePos().

NT_SetFileSize(ntfile: NT_FILE, NewFileSize: int)bool

Changes the size of a file.

A file may be increased in size as well as truncated.

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • NewFileSize (int) – The new file size.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_GetFileSize().

NT_SetFixedFileSize(ntfile: NT_FILE, FixedFileSize: int)None

Sets the fixed size of a file.

This function doesn’t alter the real size of the file on disk. It only makes functions relying on NT_GetFileSize() believe that the size of the file is the one specified.

Cancelling the effects of this operation can be achieved by calling NT_ResetFixedFileSize().

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • FixedFileSize (int) – The file size to fake.

See also NT_ResetFixedFileSize().

NT_StripFileExt(fileName: str)str

Strips the extension from a file name.

Parameters

fileName (str) – The file name.

Returns

Returns the file name without the extension.

Return type

str

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also FileExtFromName() and NT_FileNameFromPath().

NT_TrashFile(fileName: str, showProgress: bool = False)bool

Moves a file to the trash.

This operation may not be supported on every system.

Parameters
  • fileName (str) – The name of the file to move to the trash.

  • showProgress (bool) – When True, shows the progress of the operation if supported.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_DeleteFile().

NT_UnescapeCString(str: Union[bytes, str])Union[bytes, str]

Unescapes a C string (e.g.: "Hello,\\nWorld!" becomes "Hello,\nWorld!").

Parameters

str (Union[bytes, str]) – The C string to unescape.

Returns

Returns the unescaped string.

Return type

Union[bytes, str]

See also NT_MakeCString().

NT_Win32FileTimeToDateTime(Time: int)Pro.Core.NTDateTime

Converts a Windows FILETIME to NTDateTime.

Parameters

Time (int) – The FILETIME value.

Returns

Returns the converted FILETIME.

Return type

NTDateTime

See also NTDateTime.

NT_WriteFile(ntfile: NT_FILE, bytes: bytes)bool

Writes the specified bytes to a file.

Important

The file must have been opened with NTFileOpt_Write for this function to succeeded.

Parameters
  • ntfile (NT_FILE) – The handle of the open file.

  • bytes (bytes) – The bytes to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also NT_ReadFile(), NT_OpenFile(), NT_CreateFile() and NT_CloseFile().

NT_WriteProcessMemory(proc: NT_PROCESS, MemoryAddr: int, bytes: bytes)bool

Writes the memory of a process.

Parameters
  • proc (NT_PROCESS) – The process handle.

  • MemoryAddr (int) – The memory address to write to.

  • bytes (bytes) – The bytes to write.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NT_OpenProcess() and NT_ReadProcessMemory().

OFLAG_MORE_CHILDREN: Final[int]

Object flag.

This flag is set when the object reached the maximum number of allowed embedded objects.

See also ScanProvider.

OFLAG_MORE_ENTRIES: Final[int]

Object flag.

This flag is set when the object reached the maximum number of allowed scan entries.

See also ScanProvider.

OFLAG_MORE_SHELLCODE: Final[int]

Object flag.

This flag is set when the object reached the maximum number of allowed shellcode entries.

See also ScanProvider.

OFLAG_NO_DECRYPT: Final[int]

Object flag.

This flag is set when the object couldn’t be decrypted.

See also ScanProvider and CFFN_NoDecrypt.

OFLAG_NO_UNPACK: Final[int]

Object flag.

This flag is set when the object couldn’t be decompressed.

See also ScanProvider and CFFN_NoUnpack.

OFLAG_PARSING_LIMIT: Final[int]

Object flag.

This flag is set when the parser for the object hit a parsing limit.

See also ScanProvider and CFFN_ParsingLimit.

OFLAG_UNPACK_LIMIT: Final[int]

Object flag.

This flag is set when the parser for the object hit a decompression limit.

See also ScanProvider and CFFN_UnpackLimit.

OFLAG_UNPACK_NESTING: Final[int]

Object flag.

This flag is set when the parser for the object hit a decompression nesting limit.

See also ScanProvider and CFFN_UnpackNestLimit.

class PDBAssociationInfo

This class contains association information for Windows PDB files.

The reason why it is declared in the core module is that it is shared across various other modules.

Methods:

UIDFromSignatureAndAge(signature, age)

Computes the unique identifier of the PDB from its signature and age.

fromXMLString(s)

Returns a PDBAssociationInfo instance from an XML string.

isLocalFile()

Returns True if the PDB file is local; otherwise returns False.

isNull()

Returns True if the information is invalid; otherwise returns False.

makeURL()

Returns the last part of a web URL which can be used to download the PDB file.

matches(other)

Compares two PDBAssociationInfo instances.

toXMLString()

Converts the association information to an XML string.

Attributes:

name

The name of the PDB.

uid

The unique identifier of the PDB.

static UIDFromSignatureAndAge(signature: bytes, age: bytes)str

Computes the unique identifier of the PDB from its signature and age.

Parameters
  • signature (bytes) – The signature.

  • age (bytes) – The age.

Returns

Returns the unique identifier.

Return type

str

static fromXMLString(s: str)Pro.Core.PDBAssociationInfo

Returns a PDBAssociationInfo instance from an XML string.

Parameters

s (str) – The XML string.

Returns

Returns the association info.

Return type

PDBAssociationInfo

See also toXMLString().

isLocalFile()bool
Returns

Returns True if the PDB file is local; otherwise returns False.

Return type

bool

See also name.

isNull()bool
Returns

Returns True if the information is invalid; otherwise returns False.

Return type

bool

makeURL()str
Returns

Returns the last part of a web URL which can be used to download the PDB file.

Return type

str

See also name and uid.

matches(other: Pro.Core.PDBAssociationInfo)bool

Compares two PDBAssociationInfo instances.

Parameters

other (PDBAssociationInfo) – The other PDBAssociationInfo instance.

Returns

Returns True if the instances contain the same unique identifier; otherwise returns False.

Return type

bool

See also uid.

name

The name of the PDB.

See also isLocalFile().

toXMLString()str

Converts the association information to an XML string.

Returns

Returns the XML string if successful; otherwise returns an empty string.

Return type

str

See also fromXMLString().

uid

The unique identifier of the PDB.

See also matches() and UIDFromSignatureAndAge().

class ProCoreContext

This class provides functionality for the current context.

The global instance of this class can be retrieved by calling proCoreContext().

See also proCoreContext().

Methods:

addObjectToReport(target, filename[, …])

Adds a root entry to the report after the main scanning operation.

applicationArguments()

Returns the arguments passed to the applications.

closeReport()

Closes the current project.

currentScanProvider()

Returns the current scan provider if available; otherwise returns None.

downloadFile(url, c_or_fname[, …])

Downloads a file to either a NTContainer instance or to location on disk.

getLayout(name)

Retrieves a layout from the current layout pool.

getReport()

Returns an instance of the current project if available; otherwise returns None.

getSystem()

Returns the current scanning system if available; otherwise returns None.

hasLayout(name)

Checks for the presence of a layout in the current layout pool.

isCurrentScanProvider(sp)

Checks whether the specified scan provider is the one currently being inspected in the analysis workspace.

isScanProviderInHierarchy(sp)

Checks whether the specified scan provider is the hierarchy currently being inspected in the analysis workspace.

isScanning()

Returns True if a scanning operation is currently being performed; otherwise returns False.

isValid()

Returns True if the current context is valid; otherwise returns False.

logicProviderArguments()

Retrieves the list of arguments for a logic provider invoked from the command line.

quit()

Gracefully quits the application.

registerLogicProvider(name[, init, end, …])

Registers a logic provider.

setSystem(s)

Sets the current scanning system.

startScan(logic_prov_name)

Starts a scan (or different) operation using the specified logic provider.

unregisterLogicProvider(name)

Unregisters a logic provider.

wasAborted()

Returns True if the scan operation was aborted; otherwise returns False.

addObjectToReport(target: str, filename: str, format: str = str(), risk: int = 0, flags: int = 0, report: bytes = bytes())bool

Adds a root entry to the report after the main scanning operation.

Example:

from Pro.Core import proCoreContext

proCoreContext().addObjectToReport("kernel32.dll", r"c:\windows\system32\kernel32.dll")

Hint

Internal files can also be referenced (see Report.newInternalFileUID()).

Parameters
  • target (str) – The target name.

  • filename (str) – The file name as on disk.

  • format (str) – The format of the object.

  • risk (int) – The combined risk factor for the object and its embedded objects.

  • flags (int) – The combined flags for the object and its embedded objects (e.g.: OFLAG_NO_DECRYPT).

  • report (bytes) – The XML scan report for the object.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

applicationArguments()Pro.Core.NTStringList
Returns

Returns the arguments passed to the applications.

Return type

NTStringList

See also logicProviderArguments().

closeReport()None

Closes the current project.

See also getReport().

currentScanProvider()Pro.Core.ScanProvider
Returns

Returns the current scan provider if available; otherwise returns None.

Return type

ScanProvider

See also ScanProvider.

downloadFile(url: str, c_or_fname: Union[Pro.Core.NTContainer, str], post_dict_or_w: Union[Pro.Core.NTIWait, Pro.Core.NTStringStringHash] = NTStringStringHash(), post_dict: Pro.Core.NTStringStringHash = NTStringStringHash())bool

Downloads a file to either a NTContainer instance or to location on disk.

Optionally a dictionary for POST requests can be specified (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).

Hint

For more complex web requests, use ProWebRequest.

Parameters
Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also ProWebRequest and NTIWait.

getLayout(name: str)Pro.Core.Layout

Retrieves a layout from the current layout pool.

Parameters

name (str) – The name of the layout.

Returns

Returns the layout if successful; otherwise returns an invalid layout.

Return type

Layout

See also hasLayout() and Layout.

getReport()Pro.Core.Report
Returns

Returns an instance of the current project if available; otherwise returns None.

Return type

Report

See also Report and closeReport().

getSystem()Pro.Core.CommonSystem
Returns

Returns the current scanning system if available; otherwise returns None.

Return type

CommonSystem

See also CommonSystem and LocalSystem.

hasLayout(name: str)bool

Checks for the presence of a layout in the current layout pool.

Parameters

name (str) – The name of the layout.

Returns

Returns True if the layout is present; otherwise returns False.

Return type

bool

See also getLayout() and Layout.

isCurrentScanProvider(sp: Pro.Core.ScanProvider)bool

Checks whether the specified scan provider is the one currently being inspected in the analysis workspace.

Parameters

sp (ScanProvider) – The scan provider.

Returns

Returns True if the specified scan provider is the current one; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also isScanProviderInHierarchy().

isScanProviderInHierarchy(sp: Pro.Core.ScanProvider)bool

Checks whether the specified scan provider is the hierarchy currently being inspected in the analysis workspace.

Parameters

sp (ScanProvider) – The scan provider.

Returns

Returns True if the specified scan provider is in the analysis hierarchy; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also isCurrentScanProvider().

isScanning()bool
Returns

Returns True if a scanning operation is currently being performed; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

isValid()bool
Returns

Returns True if the current context is valid; otherwise returns False.

Return type

bool

logicProviderArguments()Pro.Core.NTStringList

Retrieves the list of arguments for a logic provider invoked from the command line.

Returns

Retrieves the list of arguments if the logic provider was invoked from the command line; otherwise returns an empty NTStringList instance.

Return type

NTStringList

Available since Cerbero Suite 5.7 and Cerbero Engine 2.7.

quit()None

Gracefully quits the application.

See also proAbort().

registerLogicProvider(name: str, init: Optional[object] = None, end: Optional[object] = None, scanning: Optional[object] = None, scanned: Optional[object] = None, rload: Optional[object] = None)None

Registers a logic provider.

Parameters
  • name (str) – The unique name of the logic provider.

  • init (object) – The init callback of the logic provider.

  • end (object) – The end callback of the logic provider.

  • scanning (object) – The scanning callback of the logic provider.

  • scanned (object) – The scanned callback of the logic provider.

  • rload (object) – The rload callback of the logic provider.

See also unregisterLogicProvider() and startScan().

setSystem(s: object)None

Sets the current scanning system.

Parameters

s (object) – The scanning system to set.

See also getSystem() and startScan().

startScan(logic_prov_name: str)None

Starts a scan (or different) operation using the specified logic provider.

Parameters

logic_prov_name (str) – The name of the logic provider.

See also registerLogicProvider() and unregisterLogicProvider().

unregisterLogicProvider(name: str)None

Unregisters a logic provider.

Parameters

name (str) – The name of the logic provider.

See also registerLogicProvider() and startScan().

wasAborted()bool
Returns

Returns True if the scan operation was aborted; otherwise returns False.

Return type

bool

See also startScan() and setSystem().

class ProGlobalSettings

This class provides access to the main settings of the application.

In order to avoid conflicts, extensions should use either ProSettings or class:ProValueStorage to store settings.

See also ProSettings and ProValueStorage.

Methods:

getValue(key[, defval])

Retrieves a value.

setValue(key, value)

Sets a value.

static getValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None)Optional[Union[int, float, bool, bytes, str]]

Retrieves a value.

Parameters
  • key (str) – The key of the value to retrieve. The key should be a path containing forward slashes.

  • defval (BasicType) – The default value to return in case the key is not present.

Returns

Returns the requested value if present; otherwise returns either None or the default value if specified.

Return type

BasicType

See also setValue().

static setValue(key: str, value: Optional[Union[int, float, bool, bytes, str]])bool

Sets a value.

Parameters
  • key (str) – The key of the value to set. The key should be a path containing forward slashes.

  • value (BasicType) – The value to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getValue().

class ProSettings

This class provides access to settings.

The settings accessed from this class are specific for extensions. Use ProGlobalSettings to access the settings of the main application.

See also ProGlobalSettings and ProValueStorage.

Methods:

getValue(key[, defval])

Retrieves a value.

setValue(key, value)

Sets a value.

static getValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None)Optional[Union[int, float, bool, bytes, str]]

Retrieves a value.

Parameters
  • key (str) – The key of the value to retrieve. The key should be a path containing forward slashes.

  • defval (BasicType) – The default value to return in case the key is not present.

Returns

Returns the requested value if present; otherwise returns either None or the default value if specified.

Return type

BasicType

See also setValue().

static setValue(key: str, value: Optional[Union[int, float, bool, bytes, str]])bool

Sets a value.

Parameters
  • key (str) – The key of the value to set. The key should be a path containing forward slashes.

  • value (BasicType) – The value to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getValue().

class ProTextPrintBuffer

Bases: Pro.Core.NTTextStream

This is a class derived from NTTextStream.

Any data printed to this class is directly passed to proPrint().

Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.

See also proPrint(), NTTextStream, NTTextBuffer and NTTextStringBuffer.

class ProValueStorage

This class provides SQLite-backed key -> value storage facility.

See also appDataDir(), userConfigDir(), ProSettings and ProGlobalSettings.

Methods:

close()

Closes the database.

databaseName()

Returns the database name.

getKeyCount(tname)

Returns the number of keys in a specified table.

getKeys(tname)

Retrieves the keys in a specified table.

getValue(tname, key)

Retrieves a value from a specified table given a specified key.

open([create])

Opens the database.

openReadOnly()

Opens the database as read-only.

remove(tname, key)

Removes an entry from a specified table given a specified key.

setDatabaseName(name)

Sets the name of the database.

setValue(tname, key, value)

Sets an entry in a specified table given a key and value.

close()None

Closes the database.

Hint

The database is closed automatically when unreferenced.

See also isNull(), setDatabaseName() and open().

databaseName()str
Returns

Returns the database name.

Return type

str

See also setDatabaseName() and open().

getKeyCount(tname: str)int

Returns the number of keys in a specified table.

Parameters

tname (str) – The name of the table.

Returns

Returns the number of keys.

Return type

int

See also getKeys() and getValue().

getKeys(tname: str)Pro.Core.NTStringList

Retrieves the keys in a specified table.

Parameters

tname (str) – The name of the table.

Returns

Returns the list of keys.

Return type

NTStringList

See also getValue().

getValue(tname: str, key: str)str

Retrieves a value from a specified table given a specified key.

Parameters
  • tname (str) – The name of the table.

  • key (str) – The key.

Returns

Returns the requested value if present; otherwise returns an empty string.

Return type

str

See also setValue() and getKeys().

open(create: bool = True)bool

Opens the database.

Parameters

create (bool) – If True, creates the database if not yet present on disk. If False and the database is not yet present on disk, the method will fail.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setDatabaseName(), openReadOnly() and close().

openReadOnly()bool

Opens the database as read-only.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also setDatabaseName(), open() and close().

remove(tname: str, key: str)bool

Removes an entry from a specified table given a specified key.

Parameters
  • tname (str) – The name of the table.

  • key (str) – The key of the entry to remove.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also setValue() and getValue().

setDatabaseName(name: str)None

Sets the name of the database.

Parameters

name (str) – The name of the database.

See also databaseName().

setValue(tname: str, key: str, value: str)bool

Sets an entry in a specified table given a key and value.

Parameters
  • tname (str) – The name of the table.

  • key (str) – The key of the entry.

  • value (str) – The value of the entry.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getValue() and remove().

class ProWebRequest(url: str = str())

This class can be used to make a web request.

Available since Cerbero Suite 6.0 and Cerbero Engine 3.0.

Parameters

url (str) – The URL for the request.

Methods:

addFormValue(name, value)

Adds a form value to the request.

addHeader(header)

Adds an HTTP header to the request.

addHeaderValue(name, value)

Adds an HTTP header-value pair to the request.

execute()

Executes the request.

getErrorCode()

Returns the error code.

readCallback(size)

This method can be overwritten to provide input data for the request.

setInput(input)

Sets the input data container for the request.

setInputSize(input_size)

Sets the size of the input data for the request.

setOutput(output)

Sets the container which receives the data of the response.

setURL(url)

Sets the URL for the request.

setWaitObject(wo)

Sets the wait object for the request.

writeCallback(data)

This method can be overwritten to receive the response for the request.

addFormValue(name: str, value: str)None

Adds a form value to the request.

Parameters
  • name (str) – The name of the value.

  • value (str) – The value.

addHeader(header: str)None

Adds an HTTP header to the request.

Parameters

header (str) – The header.

See also addHeaderValue().

addHeaderValue(name: str, value: str)None

Adds an HTTP header-value pair to the request.

Parameters
  • name (str) – The name of the header.

  • value (str) – The value of the header.

Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.

See also addHeader().

execute()bool

Executes the request.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

getErrorCode()int
Returns

Returns the error code.

Return type

int

readCallback(size: int)bytes

This method can be overwritten to provide input data for the request.

The total size of the input data must be specified by calling setInputSize().

Parameters

size (int) – The amount of data to read.

Returns

Returns the data read if successful; otherwise returns an empty bytes object.

Return type

bytes

Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.

See also setInputSize().

setInput(input: Pro.Core.NTContainer)None

Sets the input data container for the request.

Parameters

input (NTContainer) – The input data.

Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.

See also setOutput(), setInputSize() and readCallback().

setInputSize(input_size: int)None

Sets the size of the input data for the request.

Hint

When setInput() is used, it is not necessary to call this method.

Parameters

input_size (int) – The size of the input data.

Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.

See also readCallback() and setInput().

setOutput(output: Pro.Core.NTContainer)None

Sets the container which receives the data of the response.

Parameters

output (NTContainer) – The output container.

See also setInput().

setURL(url: str)None

Sets the URL for the request.

Parameters

url (str) – The URL for the request.

setWaitObject(wo: Pro.Core.NTIWait)None

Sets the wait object for the request.

Parameters

wo (NTIWait) – The wait object.

See also NTIWait.

writeCallback(data: bytes)bool

This method can be overwritten to receive the response for the request.

Parameters

data (bytes) – Part of the received response.

Returns

Returns True to continue the operation; otherwise returns False.

Return type

bool

REPORT_DB_EXT: Final[str]

File extension for an unpacked project.

See also Report.

REPORT_DB_NAME: Final[str]

Name of the main project database.

See also Report.

REPORT_EXT: Final[str]

File extension for a packed project.

See also Report.

REPORT_INT_ODB_NAME: Final[str]

Name of the internal files database.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also Report.

REPORT_INT_PATH: Final[str]

Name of the internal files path.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also Report.

REPORT_INT_ROOT_PREFIX: Final[str]

The prefix used to reference internal files from root entries.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also Report.

REPORT_ODB_NAME: Final[str]

Name of the object database.

See also Report.

REPORT_PROJECT_SIGNATURE: Final[str]

File signature for a packed project.

See also Report.

REPORT_VERSION: Final[int]

Current project version.

See also Report.

class Report

This class represents a project.

A project can be unpacked or packed. When it’s unpacked, it consists of a directory containing a number of DBs and other files. When it’s packed, the same files are merged into a single file and may be compressed and/or encrypted. Fundamentally, in the context of file scanning, a project contains a SQLite3 database which, in turn, contains XML reports for each scanned file. The current instance of this class is returned by ProCoreContext.getReport().

Internally, a project contains at least two databases. The first one is the main database, which contains miscellaneous information like data layouts or user notes. The second one is the object database, which contains the XML reports for each scanned file.

See also proCoreContext() and ProCoreContext.

Attributes:

Save_Background

Saves the project as a background operation.

Save_Compressed

Compresses the files when saving them.

Save_IncludeFiles

Includes scanned files into the project.

Save_Unpacked

Saves the project as unpacked.

Methods:

close()

Closes the project.

currentTarget()

Returns the identifying name of the current target .

currentTextKey()

Returns the text key for the current target.

dataBase()

Returns the handle of the main project SQLite3 database.

dataBaseFileName()

Returns the file name of the main project SQLite3 database.

dataBasePath()

Returns the path of the main project SQLite3 database.

deleteLayout(key)

Deletes a data layout.

deleteText(table, key)

Deletes a text entry.

enableErrorMessages(b)

Enables error messages to be shown to the user.

flush()

Flushes changes to the object database.

getBookmarkEntries()

Returns all bookmark entry keys.

getBookmarks(key)

Retrieves the bookmarks for a specific object.

getCarbonDBName(tlink, uid)

Returns a Carbon database name.

getCarbonDBNames(tlink)

Retrieves all Carbon database names for a specific target.

getLayout(key)

Retrieves a layout.

getLayoutEntries()

Returns the list of keys of all layout entries.

getLogicProviders()

Returns the list of logic providers used to create the file reports.

getNotes(key)

Retrieves the notes for a specific target.

getNotesCfg(key)

Retrieves the notes configuration for a specific target.

getNotesEntries()

Returns the list of keys of all notes entries.

getText(table, key)

Retrieves a text entry.

getTextCfg(table, key)

Gets the configuration for a text entry.

getTextEntries(table)

Retrieves a list of keys of all the text entries in a specific table.

globalTextKey()

Returns the key for the global text entry.

hasBookmarks(key)

Checks the presence of bookmarks for a specific target.

hasLayout(key)

Checks the presence of a layout for a specific target.

hasNotes(key)

Checks the presence of notes for a specific target.

hasText(table, key)

Checks the presence of a text entry for a specific target.

includesFiles()

Returns True if the project includes the scanned files; otherwise returns False.

isModified()

Returns True if the project was modified; otherwise returns False.

isNull()

Returns True if the project is invalid; otherwise returns False.

isProject()

Returns True if the project was packed; otherwise returns False.

isTemporary()

Returns True if the project hasn’t yet been saved; otherwise returns False.

isValid()

Returns True if the project is valid; otherwise returns False.

newCarbonDBFileName(tlink, uid)

Creates a new Carbon database name.

newInternalFilePath(uid)

Retrieves the path on disk for a yet unsaved internal file.

newInternalFileUID()

Generates a new internal file id.

objAdd(target, filename, format, risk, …)

Adds an entry to the object database.

objBegin()

Starts a multi-part transaction to the object database.

objCount()

Returns the number of entries in the object database.

objCursorDestroy(cur)

Destroys a cursor for the object database.

objCursorFirst()

Returns the cursor pointing at the first entry in the object database.

objCursorFromTarget(target)

Returns a cursor for the object database from a target name.

objCursorHasPrevious()

Returns True if there are object entries before the entry referenced by the cursor; otherwise returns False.

objCursorInfo(cur, info)

Returns information about the object entry referenced by the cursor.

objCursorNext(cur)

Makes the cursor for the object database point at the next entry.

objCursorPosition(cur)

Converts the cursor for the object database into a 0-based entry index.

objCursorPrevious(cur)

Makes the cursor for the object database point at the previous entry.

objCursorRisk(cur)

Returns the risk factor of the object entry referenced by the cursor.

objCursorSetFileName(cur, filename)

Updates the file name field for the object entry referenced by the cursor.

objCursorSetOffset(cur, offset)

Updates the offset field for the object entry referenced by the cursor.

objEnd()

Ends a multi-part transaction to the object database.

objFlush()

Flushes the object database.

objGetFiles()

Returns a list of file names which constitute the object database.

objGetInfo(target, info)

Returns information about an object entry given a target name.

objGetReport(target)

Returns the XML report of an object entry given a target name.

objGetRisk(target)

Returns the risk factor of an object entry given a target name.

objHasCount()

Returns True if the object database supports an objCount() method; otherwise returns False.

objNeedsFlush()

Returns True if the object database needs to be flushed; otherwise returns False.

objRemove(target)

Removes an object entry given a target name.

objRemove2(target, view)

Removes an object entry given a target name and a object database view.

objSetFileName(target, filename)

Updates the file name field of an object entry given a target name.

objSetFormat(target, format)

Updates the format field of an object entry given a target name.

objSetReport(target, report)

Updates the XML report of an object entry given a target name.

objSetRisk(target, risk, flags)

Updates the risk and flags fields of an object entry given a target name.

objViewCount(view)

Returns the number of object entries in the specified window view.

objViewCreate(vi)

Creates a window view of the entries in the object database.

objViewCursor(view, pos)

Returns a cursor for the object database view given an index.

objViewDestroy(view)

Destroys a window view of the object database.

objViewInfo(view, pos, info)

Returns information about an object entry in a window view given an index position.

objViewSetFileName(view, pos, filename)

Updates the file name field for the object entry in the window view given an index position.

openDatabase(dir)

Opens the main and object databases in a given directory.

openProject(name)

Opens a packed or unpacked project.

projectFileName()

Returns the name of the packed project.

removeCarbonDBName(tlink, uid)

Removes a Carbon database name.

removeCarbonDBNames(tlink)

Removes all Carbon database names for a given target.

renameLayout(key, new_key)

Renames a data layout.

renameText(table, key, new_key)

Renames a text entry.

retrieveFile(info_or_target[, context])

Retrieves a file included in the project.

retrieveInternalFile(uid)

Retrieves an internal file.

saveAs(path[, options, password])

Saves the project.

saveInternalFile(uid[, display_name, …])

Saves a new internal file.

setBookmarks(key, bm)

Sets the bookmarks for a specific object.

setCarbonDBName(tlink, uid, dbname)

Sets a Carbon database name.

setCurrentTarget(t)

Sets the target currently being analyzed by the user in the workspace.

setLayout(key, layout)

Sets a data layout.

setLogicProviders(lp)

Sets the list of logic providers used to create the file reports.

setModified(b)

Sets the modified status of the project.

setNotes(key, notes[, cfg])

Set the notes for a specific target.

setText(table, key, txt)

Sets a text entry.

thisHeaderFileName()

Returns the file name of the internal CFFHeader of this project (often referred to as the ‘this’ header).

Save_Background: Final[int]

Saves the project as a background operation.

See also saveAs().

Save_Compressed: Final[int]

Compresses the files when saving them.

See also saveAs().

Save_IncludeFiles: Final[int]

Includes scanned files into the project.

See also saveAs().

Save_Unpacked: Final[int]

Saves the project as unpacked.

When this option is specified, Save_Compressed and Save_IncludeFiles have no effect.

See also saveAs().

close()None

Closes the project.

See also openDatabase() and saveAs().

currentTarget()str
Returns

Returns the identifying name of the current target .

Return type

str

See also setCurrentTarget().

currentTextKey()str

Returns the text key for the current target.

This key is used to retrieve data such as notes for the current target.

Returns

Returns the text key.

Return type

str

See also currentTarget().

dataBase()sqlite3

Returns the handle of the main project SQLite3 database.

This database does not contain reports of scanned files.

Returns

Returns the SQLite3 handle.

Return type

sqlite3

See also dataBaseFileName() and dataBasePath().

dataBaseFileName()str

Returns the file name of the main project SQLite3 database.

This database does not contain reports of scanned files.

Returns

Returns the database file name.

Return type

str

See also dataBase(), dataBasePath() and projectFileName()..

dataBasePath()str

Returns the path of the main project SQLite3 database.

This is the root path of the unpacked project.

Returns

Returns the root path of the unpacked project.

Return type

str

See also dataBase(), dataBaseFileName() and projectFileName().

deleteLayout(key: str)bool

Deletes a data layout.

Parameters

key (str) – The key of the layout entry.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getLayout() and setLayout().

deleteText(table: str, key: str)bool

Deletes a text entry.

Parameters
  • table (str) – The table name.

  • key (str) – The key of the text entry.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getText() and setText().

enableErrorMessages(b: bool)None

Enables error messages to be shown to the user.

Parameters

b (bool) – If True, enables error messages; otherwise disables them.

Available since Cerbero Suite 7.2 and Cerbero Engine 4.2.

flush()None

Flushes changes to the object database.

See also saveAs().

getBookmarkEntries()Pro.Core.NTStringList
Returns

Returns all bookmark entry keys.

Return type

NTStringList

See also getBookmarks() and setBookmarks().

getBookmarks(key: str)str

Retrieves the bookmarks for a specific object.

Parameters

key (str) – The key of the bookmark entry to retrieve.

Returns

Returns the bookmarks for the specified object if successful; otherwise returns an empty string.

Return type

str

See also setBookmarks() and getBookmarkEntries().

getCarbonDBName(tlink: str, uid: int)str

Returns a Carbon database name.

Parameters
  • tlink (str) – The target for which to retrieve the database name.

  • uid (int) – The unique id of the database.

Returns

Returns the name of the database.

Return type

str

See also getCarbonDBNames().

getCarbonDBNames(tlink: str)Pro.Core.NTStringList

Retrieves all Carbon database names for a specific target.

Parameters

tlink (str) – The target for which to retrieve the list of Carbon database names.

Returns

Returns the list of Carbon database names.

Return type

NTStringList

See also getCarbonDBName().

getLayout(key: str)str

Retrieves a layout.

Parameters

key (str) – The key of the layout entry.

Returns

Returns the layout if successful; otherwise returns an empty string.

Return type

str

See also setLayout() and deleteLayout().

getLayoutEntries()Pro.Core.NTStringList
Returns

Returns the list of keys of all layout entries.

Return type

NTStringList

See also setLayout() and deleteLayout().

getLogicProviders()Pro.Core.NTStringList
Returns

Returns the list of logic providers used to create the file reports.

Return type

NTStringList

getNotes(key: str)str

Retrieves the notes for a specific target.

Parameters

key (str) – The target for which to retrieve the notes.

Returns

Returns the notes if successful; otherwise returns an empty string.

Return type

str

See also setNotes() and getNotesCfg().

getNotesCfg(key: str)str

Retrieves the notes configuration for a specific target.

Parameters

key (str) – The target for which to retrieve the settings.

Returns

Returns the configuration if successful; otherwise returns an empty string.

Return type

str

See also getNotes() and setNotes().

getNotesEntries()Pro.Core.NTStringList
Returns

Returns the list of keys of all notes entries.

Return type

NTStringList

See also getNotes() and setNotes().

getText(table: str, key: str)str

Retrieves a text entry.

Parameters
  • table (str) – The table name.

  • key (str) – The key of the text entry.

Returns

Returns the text if successful; otherwise returns an empty string.

Return type

str

See also setText() and deleteText().

getTextCfg(table: str, key: str)str

Gets the configuration for a text entry.

Parameters
  • table (str) – The table name.

  • key (str) – The key of the text entry.

Returns

Returns the text configuration if successful; otherwise returns an empty string.

Return type

str

See also getText(), setText() and deleteText().

getTextEntries(table: str)Pro.Core.NTStringList

Retrieves a list of keys of all the text entries in a specific table.

Parameters

table (str) – The table name.

Returns

Returns the list of keys.

Return type

NTStringList

globalTextKey()str
Returns

Returns the key for the global text entry.

Return type

str

See also getNotes() and setNotes().

hasBookmarks(key: str)bool

Checks the presence of bookmarks for a specific target.

Parameters

key (str) – The target for which to check the presence of bookmarks.

Returns

Returns True if the target has bookmarks; otherwise returns False.

Return type

bool

See also getBookmarks() and setBookmarks().

hasLayout(key: str)bool

Checks the presence of a layout for a specific target.

Parameters

key (str) – The target for which to check the presence of a layout.

Returns

Returns True if the target has a layout; otherwise returns False.

Return type

bool

See also getLayout() and setLayout().

hasNotes(key: str)bool

Checks the presence of notes for a specific target.

Parameters

key (str) – The target for which to check the presence of notes.

Returns

Returns True if the target has notes; otherwise returns False.

Return type

bool

See also getNotes() and setNotes().

hasText(table: str, key: str)bool

Checks the presence of a text entry for a specific target.

Parameters
  • table (str) – The table name.

  • key (str) – The target for which to check the presence of the text entry.

Returns

Returns True if the target has a text entry; otherwise returns False.

Return type

bool

See also getText() and setText().

includesFiles()bool
Returns

Returns True if the project includes the scanned files; otherwise returns False.

Return type

bool

See also saveAs().

isModified()bool
Returns

Returns True if the project was modified; otherwise returns False.

Return type

bool

See also saveAs() and setModified().

isNull()bool
Returns

Returns True if the project is invalid; otherwise returns False.

Return type

bool

See also isValid().

isProject()bool
Returns

Returns True if the project was packed; otherwise returns False.

Return type

bool

See also isTemporary().

isTemporary()bool
Returns

Returns True if the project hasn’t yet been saved; otherwise returns False.

Return type

bool

See also isProject().

isValid()bool
Returns

Returns True if the project is valid; otherwise returns False.

Return type

bool

See also isNull().

newCarbonDBFileName(tlink: str, uid: int)str

Creates a new Carbon database name.

Parameters
  • tlink (str) – The name of the target.

  • uid (int) – The unique id for the database.

Returns

Returns the name of the database if successful; otherwise returns an empty string.

Return type

str

See also getCarbonDBName().

newInternalFilePath(uid: str)str

Retrieves the path on disk for a yet unsaved internal file.

Parameters

uid (str) – The internal file id.

Returns

Returns the file path if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also newInternalFileUID(), saveInternalFile(), retrieveInternalFile(), ScanProvider.addInternalFile() and ProCoreContext.addObjectToReport().

newInternalFileUID()str

Generates a new internal file id.

Example:

from Pro.Core import *

def main():
    sp = proCoreContext().currentScanProvider()
    if not sp:
        return
    r = sp.getGlobalReport()
    if not r:
        return
    uid = r.newInternalFileUID()
    if not uid:
        return
    path = r.newInternalFilePath(uid)
    if not path:
        return
    with open(path, "w") as f:
        f.write("hello " * 5)
    if r.saveInternalFile(uid, "Test", "Test"):
        # add child object
        sp.addInternalFile(uid, "", "Internal File")
        # add root entry
        proCoreContext().addObjectToReport("Test", REPORT_INT_ROOT_PREFIX + uid)

main()
Returns

Returns the unique id if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also newInternalFilePath(), saveInternalFile(), retrieveInternalFile(), ScanProvider.addInternalFile() and ProCoreContext.addObjectToReport().

objAdd(target: str, filename: str, format: str, risk: int, flags: int, report: bytes)bool

Adds an entry to the object database.

Parameters
  • target (str) – The target name.

  • filename (str) – The file name as on disk.

  • format (str) – The format of the object.

  • risk (int) – The combined risk factor for the object and its embedded objects.

  • flags (int) – The combined flags for the object and its embedded objects (e.g.: OFLAG_NO_DECRYPT).

  • report (bytes) – The XML scan report for the object.

Returns

Returns True if the entry was added to the database; otherwise returns False.

Return type

bool

See also objGetReport().

objBegin()None

Starts a multi-part transaction to the object database.

See also objEnd().

objCount()int
Returns

Returns the number of entries in the object database.

Return type

int

See also objHasCount() and objCursorPosition().

objCursorDestroy(cur: objdbcur)None

Destroys a cursor for the object database.

Parameters

cur (objdbcur) – The cursor to destroy.

See also objCursorFirst() and objCursorNext().

objCursorFirst()objdbcur

Returns the cursor pointing at the first entry in the object database.

Returns

Returns the cursor if the object database has entries; otherwise returns an invalid cursor.

Return type

objdbcur

See also objCursorNext() and objCursorPrevious().

objCursorFromTarget(target: str)objdbcur

Returns a cursor for the object database from a target name.

Parameters

target (str) – The target name.

Returns

Returns the cursor if the target is present in the object database; otherwise returns an invalid cursor.

Return type

objdbcur

See also objCursorFirst() and objCursorNext().

objCursorHasPrevious()bool
Returns

Returns True if there are object entries before the entry referenced by the cursor; otherwise returns False.

Return type

bool

See also objCursorPrevious() and objCursorNext().

objCursorInfo(cur: objdbcur, info: objdb_info)bool

Returns information about the object entry referenced by the cursor.

Parameters
  • cur (objdbcur) – The cursor for the object database.

  • info (objdb_info) – The output information.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objGetReport(), objCursorRisk() and objdb_info.

objCursorNext(cur: objdbcur)bool

Makes the cursor for the object database point at the next entry.

Parameters

cur (objdbcur) – The cursor for the object database.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objCursorFirst() and objCursorInfo().

objCursorPosition(cur: objdbcur)int

Converts the cursor for the object database into a 0-based entry index.

Parameters

cur (objdbcur) – The cursor for the object database.

Returns

Returns the 0-based entry index.

Return type

int

See also objCursorFirst() and objCursorNext().

objCursorPrevious(cur: objdbcur)bool

Makes the cursor for the object database point at the previous entry.

Parameters

cur (objdbcur) – The cursor for the object database.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objCursorHasPrevious() and objCursorNext().

objCursorRisk(cur: objdbcur)int

Returns the risk factor of the object entry referenced by the cursor.

Parameters

cur (objdbcur) – The cursor for the object database.

Returns

Returns the risk factor.

Return type

int

See also objGetReport() and objCursorInfo().

objCursorSetFileName(cur: objdbcur, filename: str)bool

Updates the file name field for the object entry referenced by the cursor.

Parameters
  • cur (objdbcur) – The cursor for the object database.

  • filename (str) – The new file name to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objCursorSetOffset().

objCursorSetOffset(cur: objdbcur, offset: int)bool

Updates the offset field for the object entry referenced by the cursor.

The offset field is used only when the project includes scanned files.

Parameters
  • cur (objdbcur) – The cursor for the object database.

  • offset (int) – The new offset to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objCursorSetFileName().

objEnd()None

Ends a multi-part transaction to the object database.

See also objStart().

objFlush()None

Flushes the object database.

See also objNeedsFlush().

objGetFiles()Pro.Core.NTStringList
Returns

Returns a list of file names which constitute the object database.

Return type

NTStringList

objGetInfo(target: str, info: Pro.Core.objdb_info)bool

Returns information about an object entry given a target name.

Parameters
  • target (str) – The target name.

  • info (objdb_info) – The output information.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objGetReport() and objGetRisk().

objGetReport(target: str)bytes

Returns the XML report of an object entry given a target name.

Parameters

target (str) – The target name.

Returns

Returns the utf-8 XML report if successful; otherwise returns an empty byte-array.

Return type

bytes

See also objGetInfo() and objGetRisk().

objGetRisk(target: str)int

Returns the risk factor of an object entry given a target name.

Parameters

target (str) – The target name.

Returns

Returns the risk factor if successful; otherwise returns 0.

Return type

int

See also objGetInfo() and objGetReport().

objHasCount()bool
Returns

Returns True if the object database supports an objCount() method; otherwise returns False.

Return type

bool

See also objCount() and objCursorPosition().

objNeedsFlush()bool
Returns

Returns True if the object database needs to be flushed; otherwise returns False.

Return type

bool

See also objFlush().

objRemove(target: str)bool

Removes an object entry given a target name.

Parameters

target (str) – The target name.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objRemove2().

objRemove2(target: str, view: objdbview)bool

Removes an object entry given a target name and a object database view.

Parameters
  • target (str) – The target name.

  • view (objdbview) – The object database view.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objRemove().

objSetFileName(target: str, filename: str)bool

Updates the file name field of an object entry given a target name.

Parameters
  • target (str) – The target name.

  • filename (str) – The new file name to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objCursorSetFileName().

objSetFormat(target: str, format: str)bool

Updates the format field of an object entry given a target name.

Parameters
  • target (str) – The target name.

  • format (str) – The new format to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

objSetReport(target: str, report: bytes)bool

Updates the XML report of an object entry given a target name.

Parameters
  • target (str) – The target name.

  • report (bytes) – The new XML report to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objGetReport().

objSetRisk(target: str, risk: int, flags: int)bool

Updates the risk and flags fields of an object entry given a target name.

Parameters
  • target (str) – The target name.

  • risk (int) – The new risk to set.

  • flags (int) – The new flags to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also objGetRisk().

objViewCount(view: objdbview)int

Returns the number of object entries in the specified window view.

Parameters

view (objdbview) – The object database view.

Returns

Returns the number of object entries.

Return type

int

See also objViewCreate(), objCursorFirst() and objCursorNext().

objViewCreate(vi: objdbview_info)objdbview

Creates a window view of the entries in the object database.

Parameters

vi (objdbview_info) – Specifies the parameters for the view.

Returns

Returns the requested window view.

Return type

objdbview

See also objViewInfo(), objViewDestroy() and objdbview_info.

objViewCursor(view: objdbview, pos: int)objdbcur

Returns a cursor for the object database view given an index.

Parameters
  • view (objdbview) – The object database view.

  • pos (int) – The 0-based index.

Returns

Returns the cursor for the object database.

Return type

objdbcur

See also objViewCreate(), objCursorNext() and objCursorInfo().

objViewDestroy(view: objdbview)None

Destroys a window view of the object database.

Parameters

view (objdbview) – The view to destroy.

See also objViewCreate() and objViewInfo().

objViewInfo(view: objdbview, pos: int, info: objdb_info)bool

Returns information about an object entry in a window view given an index position.

Parameters
  • view (objdbview) – The object database window view.

  • pos (int) – The 0-based index.

  • info (objdb_info) – The output information.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objViewCreate() and objViewDestroy().

objViewSetFileName(view: objdbview, pos: int, filename: str)bool

Updates the file name field for the object entry in the window view given an index position.

Parameters
  • view (objdbview) – The object database window view.

  • pos (int) – The 0-based index.

  • filename (str) – The new file name to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also objSetFileName().

openDatabase(dir: str)bool

Opens the main and object databases in a given directory.

Parameters

dir (str) – The root directory of the project.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also openProject(), saveAs() and close().

openProject(name: str)bool

Opens a packed or unpacked project.

This method internally calls openDatabase().

Parameters

name (str) – The full path of the project to open.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also saveAs() and close().

projectFileName()str
Returns

Returns the name of the packed project.

Return type

str

See also dataBaseFileName().

removeCarbonDBName(tlink: str, uid: int)bool

Removes a Carbon database name.

Parameters
  • tlink (str) – The target for which to delete the database name.

  • uid (int) – The unique id of the database.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also newCarbonDBFileName().

removeCarbonDBNames(tlink: str)None

Removes all Carbon database names for a given target.

Parameters

tlink (str) – The target for which to delete the database names.

See also removeCarbonDBName().

renameLayout(key: str, new_key: str)bool

Renames a data layout.

Parameters
  • key (str) – The current key of the layout entry.

  • new_key (str) – The new key of the layout entry.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getLayout() and deleteLayout().

renameText(table: str, key: str, new_key: str)bool

Renames a text entry.

Parameters
  • table (str) – The table name.

  • key (str) – The current key of the text entry.

  • new_key (str) – The new key of the text entry.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getText() and deleteText().

retrieveFile(info_or_target: Union[Pro.Core.objdb_info, str], context: str = str())Pro.Core.NTContainer

Retrieves a file included in the project.

Parameters
  • info_or_target (Union[objdb_info, str]) – The file to retrieve specified either as a target name or a objdb_info instance.

  • context (str) – Reserved for future use.

Returns

Returns the data of the file if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

See also saveAs() and openDatabase().

retrieveInternalFile(uid: str)Pro.Core.NTContainer

Retrieves an internal file.

Parameters

uid (str) – The internal file id.

Returns

Returns the data of the file if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also saveInternalFile().

saveAs(path: str, options: int = Save_Compressed, password: str = str())bool

Saves the project.

Parameters
  • path (str) – The full path of the saved project.

  • options (int) – The options for the save operation (e.g.: Save_Unpacked).

  • password (str) – The optional password for the project.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also openProject(), openDatabase() and retrieveFile().

saveInternalFile(uid: str, display_name: str = str(), associated_target: str = str())bool

Saves a new internal file.

Parameters
  • uid (str) – The internal file id.

  • display_name (str) – Tag or display name for the internal file.

  • associated_target (str) – The name of the associated target if any.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also newInternalFileUID(), newInternalFilePath(), retrieveInternalFile(), ScanProvider.addInternalFile() and ProCoreContext.addObjectToReport().

setBookmarks(key: str, bm: str)bool

Sets the bookmarks for a specific object.

Parameters
  • key (str) – The key of the bookmark entry to set.

  • bm (str) – The bookmarks.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getBookmarks() and getBookmarkEntries().

setCarbonDBName(tlink: str, uid: int, dbname: str)bool

Sets a Carbon database name.

Parameters
  • tlink (str) – The name of the target.

  • uid (int) – The unique id for the database.

  • dbname (str) – The database name.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getCarbonDBName().

setCurrentTarget(t: str)None

Sets the target currently being analyzed by the user in the workspace.

Parameters

t (str) – The current target name.

See also currentTarget().

setLayout(key: str, layout: str)bool

Sets a data layout.

Parameters
  • key (str) – The key of the layout entry.

  • layout (str) – The data layout to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getLayout() and deleteLayout().

setLogicProviders(lp: Pro.Core.NTStringList)bool

Sets the list of logic providers used to create the file reports.

Parameters

lp (NTStringList) – The list of logic providers.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getLogicProviders().

setModified(b: bool)None

Sets the modified status of the project.

Parameters

b (bool) – If True, the project is marked as modified.

See also isModified().

setNotes(key: str, notes: str, cfg: Optional[str] = None)bool

Set the notes for a specific target.

Parameters
  • key (str) – The target for which to set the notes.

  • notes (str) – The notes.

  • cfg (Optional[str]) – The configuration for the notes.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

setText(table: str, key: str, txt: str)bool

Sets a text entry.

Parameters
  • table (str) – The table name.

  • key (str) – The key of the text entry.

  • txt (str) – The text to set.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also getText() and deleteText().

thisHeaderFileName()str
Returns

Returns the file name of the internal CFFHeader of this project (often referred to as the ‘this’ header).

Return type

str

See also CFFHeader.

SCANVIEW_BE: Final[int]

Specifies that the returned data is big-endian.

See also ScanViewData.vflags.

SCANVIEW_CARBON: Final[int]

Carbon view.

See also ScanViewData.

SCANVIEW_CELLTABLE: Final[int]

Cell table view.

See also ScanViewData.

SCANVIEW_CHART: Final[int]

Chart view.

See also ScanViewData.

SCANVIEW_CODEC_ASCII: Final[int]

Specifies that the returned data is ascii.

See also ScanViewData.vflags.

SCANVIEW_CODEC_MASK: Final[int]

Codec mask for the returned data.

See also ScanViewData.vflags.

SCANVIEW_CODEC_UCS2: Final[int]

Specifies that the returned data is ucs-2.

See also ScanViewData.vflags.

SCANVIEW_CODEC_UCS4: Final[int]

Specifies that the returned data is ucs-4.

See also ScanViewData.vflags.

SCANVIEW_CODEC_UTF16: Final[int]

Specifies that the returned data is utf-16.

See also ScanViewData.vflags.

SCANVIEW_CODEC_UTF32: Final[int]

Specifies that the returned data is utf-32.

See also ScanViewData.vflags.

SCANVIEW_CODEC_UTF8: Final[int]

Specifies that the returned data is utf-8.

See also ScanViewData.vflags.

SCANVIEW_CODE_JAVASCRIPT: Final[int]

Specifies that the returned data is JavaScript code.

See also ScanViewData.vflags.

SCANVIEW_CODE_MASK: Final[int]

Code mask for the returned data.

See also ScanViewData.vflags.

SCANVIEW_CODE_NONE: Final[int]

Specifies no code type for the returned data.

See also ScanViewData.vflags.

SCANVIEW_CODE_VBA: Final[int]

Specifies that the returned data is VBA code.

See also ScanViewData.vflags.

SCANVIEW_CODE_VBS: Final[int]

Specifies that the returned data is VBS code.

See also ScanViewData.vflags.

SCANVIEW_CUSTOM: Final[int]

Custom view.

See also ScanViewData.

SCANVIEW_CUSTOM_2: Final[int]

Second custom view.

See also ScanViewData.

SCANVIEW_CUSTOM_3: Final[int]

Third custom view.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

SCANVIEW_CUSTOM_4: Final[int]

Fourth custom view.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

SCANVIEW_CUSTOM_5: Final[int]

Fifth custom view.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

SCANVIEW_DATA_NOT_SHARED: Final[int]

Specifies that the returned data is utf-16 is not shared among the views.

See also ScanViewData.vflags.

SCANVIEW_EMASK: Final[int]

Endianness mask for the returned data.

See also ScanViewData.vflags.

SCANVIEW_FILEINFO: Final[int]

File info view.

See also ScanViewData.

SCANVIEW_FS: Final[int]

File system view.

See also ScanViewData.

SCANVIEW_GEO: Final[int]

Geo-location view.

See also ScanViewData.

SCANVIEW_HEX: Final[int]

Hex view.

See also ScanViewData.

SCANVIEW_KEYVALUE: Final[int]

Key-value view.

This value is reserved for future use.

See also ScanViewData.

SCANVIEW_LE: Final[int]

Specifies that the returned data is little-endian.

See also ScanViewData.vflags.

SCANVIEW_LIST: Final[int]

List view.

This value is reserved for future use.

See also ScanViewData.

SCANVIEW_ME: Final[int]

Specifies that the returned data is middle-endian.

This value is reserved for future use.

See also ScanViewData.vflags.

SCANVIEW_MEDIA: Final[int]

Media view.

See also ScanViewData.

SCANVIEW_NONE: Final[int]

Invalid view.

See also ScanViewData.

SCANVIEW_PLOT: Final[int]

Plot view.

See also ScanViewData.

SCANVIEW_RAW: Final[int]

Raw hex view.

See also ScanViewData.

SCANVIEW_TABLE: Final[int]

Table view.

See also ScanViewData.

SCANVIEW_TEXT: Final[int]

Text view.

See also ScanViewData.

SCANVIEW_TEXTBROWSER: Final[int]

Text browser view.

See also ScanViewData.

SCANVIEW_TREE: Final[int]

Tree view.

See also ScanViewData.

SCANVIEW_WEB: Final[int]

Web view.

Note

Since a web-browser is no longer included in the application, this view will simply display the target URL.

See also ScanViewData.

SEC_File: Final[int]

Scan entry category for embedded objects.

See also CT_EmbeddedFile, ScanProvider.addEntry() and ScanEntryData.

SEC_Info: Final[int]

Scan entry category for information.

See also ScanProvider.addEntry() and ScanEntryData.

SEC_Intrinsic: Final[int]

Scan entry category for intrinsic threats.

See also ScanProvider.addEntry() and ScanEntryData.

SEC_Online: Final[int]

Scan entry category for online entries.

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also ScanProvider.addEntry() and ScanEntryData.

SEC_Privacy: Final[int]

Scan entry category for privacy issues.

See also ScanProvider.addEntry() and ScanEntryData.

SEC_Threat: Final[int]

Scan entry category for threats.

See also ScanProvider.addEntry() and ScanEntryData.

SEC_Warn: Final[int]

Scan entry category for warnings.

See also ScanProvider.addEntry() and ScanEntryData.

SFT_AccessTime: Final[int]

Scan provider time type for file access.

See also ScanProvider.addFileTime().

SFT_CreationTime: Final[int]

Scan provider time type for file creation.

See also ScanProvider.addFileTime().

SFT_ModificationTime: Final[int]

Scan provider time type for file modification.

See also ScanProvider.addFileTime().

class ScanEntryBaseAttributes

This class contains the base attributes of a scan entry retrieved from the report.

See also ScanViewData and ScanProvider.

Attributes:

category

The category of the scan entry (e.g., SEC_Threat).

eview

The source view type for the scan entry.

fid

The format id.

flags

Internal flags for the entry.

ind_category

The indirect category of the scan entry (e.g., SEC_Threat).

ind_type

The indirect type of the scan entry (e.g., CT_JavaScript).

type

The type of the scan entry (e.g., CT_JavaScript).

uid

The unique identifier of the scan entry.

Methods:

clear([complete])

Clears the fields of this class.

category

The category of the scan entry (e.g., SEC_Threat).

clear(complete: bool = True)None

Clears the fields of this class.

Parameters

complete (bool) – If True, clears all the fields.

eview

The source view type for the scan entry.

fid

The format id.

See also FormatTree.

flags

Internal flags for the entry.

ind_category

The indirect category of the scan entry (e.g., SEC_Threat).

ind_type

The indirect type of the scan entry (e.g., CT_JavaScript).

type

The type of the scan entry (e.g., CT_JavaScript).

uid

The unique identifier of the scan entry.

class ScanEntryData

This class represents a scan entry.

See also ScanProvider.addEntry().

Attributes:

category

The category of the scan entry (e.g., SEC_Threat).

data

The data XML string.

extra

Extra XML string.

flags

Internal flags for the entry.

oformat

The format of the embedded object.

otarget

The target name of the embedded object.

type

The type of the scan entry (e.g., CT_JavaScript).

Methods:

clear()

Clears the fields of this class.

category

The category of the scan entry (e.g., SEC_Threat).

clear()None

Clears the fields of this class.

data

The data XML string.

This field contains the data which will belong to the data node in the report.

extra

Extra XML string.

This XML string may contain filters and other parameters.

flags

Internal flags for the entry.

oformat

The format of the embedded object.

If "?" is specified, the format of the object will be determined by the engine.

otarget

The target name of the embedded object.

If type is not CT_EmbeddedFile, this field is a label for the entry.

type

The type of the scan entry (e.g., CT_JavaScript).

class ScanMetaDataEntries

List of ScanMetaDataEntry elements.

Methods:

append(value)

Inserts value at the end of the list.

at(i)

Returns the item at index position i in the list.

clear()

Removes all items from the list.

contains(value)

Checks the presence of an element in the list.

count(value)

Returns the number of occurrences of value in the list.

indexOf(value[, start])

Searches for an element in the list.

insert(i, value)

Inserts value at index position i in the list.

isEmpty()

Checks whether the list is empty.

iterator()

Creates an iterator for the list.

removeAll(value)

Removes all occurrences of value in the list and returns the number of entries removed.

removeAt(i)

Removes the item at index position i.

reserve(alloc)

Reserve space for alloc elements.

size()

Returns the number of items in the list.

takeAt(i)

Removes the item at index position i and returns it.

append(value: Pro.Core.ScanMetaDataEntry)None

Inserts value at the end of the list.

Parameters

value (ScanMetaDataEntry) – The value to add to the list.

See also insert().

at(i: int)Pro.Core.ScanMetaDataEntry

Returns the item at index position i in the list. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to return.

Returns

Returns the requested element.

Return type

ScanMetaDataEntry

clear()None

Removes all items from the list.

contains(value: Pro.Core.ScanMetaDataEntry)bool

Checks the presence of an element in the list.

Parameters

value (ScanMetaDataEntry) – The value to check for.

Returns

Returns True if the list contains an occurrence of value; otherwise returns False.

Return type

bool

See also indexOf() and count().

count(value: Pro.Core.ScanMetaDataEntry)int

Returns the number of occurrences of value in the list.

Parameters

value (ScanMetaDataEntry) – The value to count.

Returns

Returns the number of occurrences.

Return type

int

See also indexOf() and contains().

indexOf(value: Pro.Core.ScanMetaDataEntry, start: int = 0)int

Searches for an element in the list.

Parameters
  • value (ScanMetaDataEntry) – The value to search for.

  • start (int) – The start index.

Returns

Returns the index position of the first occurrence of value in the list. Returns -1 if no item was found.

Return type

int

See also contains().

insert(i: int, value: Pro.Core.ScanMetaDataEntry)None

Inserts value at index position i in the list. If i is 0, the value is prepended to the list. If i is size(), the value is appended to the list.

Parameters
  • i (int) – The position at which to add the value.

  • value (ScanMetaDataEntry) – The value to add.

See also append() and removeAt().

isEmpty()bool

Checks whether the list is empty.

Returns

Returns True if the list contains no items; otherwise returns False.

Return type

bool

See also size().

iterator()Pro.Core.ScanMetaDataEntriesIt

Creates an iterator for the list.

Returns

Returns the iterator.

Return type

ScanMetaDataEntriesIt

removeAll(value: Pro.Core.ScanMetaDataEntry)int

Removes all occurrences of value in the list and returns the number of entries removed.

Parameters

value (ScanMetaDataEntry) – The value to remove from the list.

Returns

Returns the number of entries removed.

Return type

int

See also removeAt().

removeAt(i: int)None

Removes the item at index position i. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the item to remove.

See also removeAll().

reserve(alloc: int)None

Reserve space for alloc elements. Calling this method doesn’t change the size of the list.

Parameters

alloc (int) – The amount of elements to reserve space for.

size()int
Returns

Returns the number of items in the list.

Return type

int

See also isEmpty().

takeAt(i: int)Pro.Core.ScanMetaDataEntry

Removes the item at index position i and returns it. i must be a valid index position in the list (i.e., 0 <= i < size()).

Parameters

i (int) – The index of the element to remove from the list.

Returns

Returns the removed element. If you don’t use the return value, removeAt() is more efficient.

Return type

ScanMetaDataEntry

See also removeAt().

class ScanMetaDataEntriesIt(obj: Pro.Core.ScanMetaDataEntries)

Iterator class for ScanMetaDataEntries.

Parameters

obj (ScanMetaDataEntries) – The object to iterate over.

Methods:

hasNext()

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

hasPrevious()

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

next()

Returns the next item and advances the iterator by one position.

previous()

Returns the previous item and moves the iterator back by one position.

toBack()

Moves the iterator to the back of the container (after the last item).

toFront()

Moves the iterator to the front of the container (before the first item).

hasNext()bool
Returns

Returns True if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container; otherwise returns False.

Return type

bool

See also hasPrevious() and next().

hasPrevious()bool
Returns

Returns True if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container; otherwise returns False.

Return type

bool

See also hasNext() and previous().

next()Pro.Core.ScanMetaDataEntry
Returns

Returns the next item and advances the iterator by one position.

Return type

ScanMetaDataEntry

See also hasNext() and previous().

previous()Pro.Core.ScanMetaDataEntry
Returns

Returns the previous item and moves the iterator back by one position.

Return type

ScanMetaDataEntry

See also hasPrevious() and next().

toBack()None

Moves the iterator to the back of the container (after the last item).

See also toFront() and previous().

toFront()None

Moves the iterator to the front of the container (before the first item).

See also toBack() and next().

class ScanMetaDataEntry

This class represents a scan meta-data entry.

See also ScanProvider.addMetaData() and ScanProvider.addMetaDataString().

Attributes:

content

The content of the meta-data.

flags

The flags of the meta-data (e.g., METAFLAG_STRING).

id

The identifier of the meta-data.

label

The label of the meta-data.

content

The content of the meta-data.

flags

The flags of the meta-data (e.g., METAFLAG_STRING).

id

The identifier of the meta-data.

label

The label of the meta-data.

class ScanProvider

This is the base class inherited by all the scan engines for the different file formats.

See also ScanEntryData, ScanViewData and ScanMetaDataEntry.

Attributes:

COMPUTE_HASH

If this scan option is set, the default hash of the object will always be computed.

SCAN_RESULT_ERROR

Error result code.

SCAN_RESULT_FINISHED

Finished result code for _startScan().

SCAN_RESULT_OK

Success result code.

SKIP_EMBEDDED_SCAN

If this scan option is set, child objects will not be scanned.

SKIP_HASH

If this scan option is set, the default hash of the object will not be computed.

SKIP_SHELLCODE_SCAN

If this scan option is set, the object will not be scanned for shellcode.

Methods:

_allChildrenScanned()

This method must be overwritten by derived classes to receive the notification that all child objects have been scanned.

_childScanned(dnode, schild, onode)

This method must be overwritten by derived classes to receive the notification when a child object has been scanned.

_clear()

This method must be overwritten by derived classes to release internal data.

_customOperation(params)

This method must be overwritten by derived classes to perform a custom operation.

_formatViewData(sdata)

This method must be overwritten by derived classes to provide data or views for a format item.

_formatViewInfo(finfo)

This method must be overwritten by derived classes to provide information about a format item.

_getFormat()

This method must be overwritten by derived classes to provide the tree representing the format of the object.

_initObject()

This method must be overwritten by derived classes to provide the basic initialization for the internal CFFObject.

_initObjectWithoutScan()

This method must be overwritten by derived classes which want to provide a different basic initialization for the internal CFFObject when loading the object from an existing project.

_postScan()

This method must be overwritten by derived classes to receive the notification of when _threadScan() has finished.

_scanViewData(xml, dnode, sdata)

This method must be overwritten by derived classes to provide data or views for a scan entry.

_startScan()

This method must be overwritten by derived classes to start the scan process.

_threadScan()

This method must be overwritten by derived classes to implement the scanning process in a thread different than the main UI thread.

_uinGetInitialViewData(context, sdata)

This method must be overwritten by derived classes to provide the data for the additional initial views for the object.

_uinSetupInitialViews(context, sdata)

This method must be overwritten by derived classes to implement additional initial views for the object.

addEmbeddedObject(offset, size, format, name)

Adds a child object.

addEntry(ed)

Adds a scan entry.

addFSFile(fspath, format, name[, offset, …])

Adds an embedded object by its internal file-system name.

addFileTime(type, local_time[, utc_time])

Adds a file time.

addHookEntry(hook_name, ed)

Adds a scan entry handled by a hook extension.

addInternalFile(uid, format, name[, offset, …])

Adds an internal file as child object.

addMetaData(id, content)

Adds meta-data information.

addMetaDataString(label, content)

Adds visible meta-data information.

addNativeCodeEntry(category[, …])

Adds a native code scan entry.

addSignatureMatch(category, content)

Adds a signature match scan entry.

allowedChildrenFiles()

Returns the maximum number of allowed child objects for this object.

allowedExtractionSize()

Returns the maximum extraction size allowed child objects of this object.

customOperation(params)

Performs a custom operation.

dataFromEntry(enode)

Retrieves the data node from an entry node.

exclude([b])

Determines the inclusion of a root-level object into the project.

extractMetaDataEntries(xml, onode[, flags])

Retrieves the meta-data entries from an XML report.

getGlobalReport()

Returns the project instance.

getHash(name[, compute, wo])

Retrieves a hash from the report by its name.

getInstanceObject(key[, defval])

Retrieves an object shared across parent and children scan providers given a specified key.

getInstanceValue(key[, defval])

Retrieves a value shared across parent and children scan providers given a specified key.

getMetaDataEntries([flags])

Retrieves meta-data entries.

getMetaDataEntry(id)

Retrieves a meta-data entry by its identifier.

getNextEntry([t, enode])

Retrieves the next entry node by its type.

getObject()

Returns the internal CFFObject instance.

getObjectFormat()

Returns the format of the object.

getObjectStream()

Retrieves the internal data container of the object.

getReportObjectNode()

Returns the object node of the XML report.

getReportXML()

Retrieves the current XML report.

getStream()

Retrieves the initial data associated with the scan provider.

include([b])

Determines the inclusion of a root-level object into the project.

initCFFObject(obj)

Initializes the CFFObject with the default scanning limits.

isAborted()

Returns True if was aborted; otherwise returns False.

isBatchScan()

Returns True if a batch scan is being performed; otherwise returns False.

isNestedScan()

Returns True if the current scan is nested; otherwise returns False.

parentProvider()

Returns the parent scan provider if present; otherwise returns None.

rootProvider()

Returns the root scan provider for the current scan hierarchy.

scanNesting()

Returns the current level of nesting. Returns 0 for root level scans.

scanOptions()

Returns the scan options (e.g., SKIP_HASH).

setBatchScan(b)

Sets the batch scan status.

setCachedObject(obj)

Sets the cached object which is returned by getObject().

setInstanceObject(key, obj[, destroyer_cb])

Sets an object shared across parent and children scan providers given a specified key.

setInstanceValue(key, value)

Sets a value shared across parent and children scan providers given a specified key.

setScanOptions(opt)

Sets the scan options.

subtractExtractionSize(size)

Subtracts a specified size from the total amount of allowed extraction size.

targetName()

Returns the target name for the scan provider if available; otherwise returns an empty string.

wasExcluded()

Returns True if the current file was excluded from the project; otherwise returns False.

COMPUTE_HASH: Final[int]

If this scan option is set, the default hash of the object will always be computed.

See also setScanOptions().

SCAN_RESULT_ERROR: Final[int]

Error result code.

See also _initObject() and _startScan().

SCAN_RESULT_FINISHED: Final[int]

Finished result code for _startScan().

See also _startScan().

SCAN_RESULT_OK: Final[int]

Success result code.

See also _initObject() and _startScan().

SKIP_EMBEDDED_SCAN: Final[int]

If this scan option is set, child objects will not be scanned.

See also setScanOptions().

SKIP_HASH: Final[int]

If this scan option is set, the default hash of the object will not be computed.

See also setScanOptions().

SKIP_SHELLCODE_SCAN: Final[int]

If this scan option is set, the object will not be scanned for shellcode.

Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.

See also setScanOptions().

_allChildrenScanned()None

This method must be overwritten by derived classes to receive the notification that all child objects have been scanned.

Warning

This method must not be called directly!

See also _childScanned().

_childScanned(dnode: NTXmlNode, schild: ScanProvider, onode: NTXmlNode)None

This method must be overwritten by derived classes to receive the notification when a child object has been scanned.

Warning

This method must not be called directly!

Parameters
  • dnode (NTXmlNode) – The data node for the embedded object.

  • schild (ScanProvider) – The scan provider of the child object.

  • onode (NTXmlNode) – The object node of the child object.

See also _allChildrenScanned().

_clear()None

This method must be overwritten by derived classes to release internal data.

Warning

This method must not be called directly!

_customOperation(params: Pro.Core.NTStringVariantHash)Optional[Union[int, float, bool, bytes, str]]

This method must be overwritten by derived classes to perform a custom operation.

Warning

This method must not be called directly!

Parameters

params (NTStringVariantHash) – The parameters for the operation.

Returns

Returns a value specific to the implementation of this method; by default returns None.

Return type

BasicType

See also customOperation().

_formatViewData(sdata: Pro.Core.ScanViewData)bool

This method must be overwritten by derived classes to provide data or views for a format item.

Warning

This method must not be called directly!

Parameters

sdata (ScanViewData) – This structure contains both the identifier of the format item (ScanViewData.fid) and the data returned by this method.

Returns

Returns True if the data is available; otherwise returns False.

Return type

bool

See also _getFormat(), _formatViewInfo() and ScanViewData.

_formatViewInfo(finfo: Pro.Core.FormatItemInfo)bool

This method must be overwritten by derived classes to provide information about a format item.

Warning

This method must not be called directly!

Parameters

finfo (FormatItemInfo) – This structure contains both the identifier of the format item (FormatItemInfo.fid) and the information returned by this method.

Returns

Returns True if the information is available; otherwise returns False.

Return type

bool

See also _getFormat(), _formatViewData() and FormatItemInfo.

_getFormat()Pro.Core.FormatTree

This method must be overwritten by derived classes to provide the tree representing the format of the object.

Warning

This method must not be called directly!

The tree is made of unique identifiers which are passed to _formatViewInfo() and _formatViewData() to retrieve information and data for a specific item.

Important

Before adding items to the tree, FormatTree.enableIDs() must be called with a value of True.

Returns

Returns the format tree.

Return type

FormatTree

See also _formatViewInfo(), _formatViewData() and _scanViewData().

_initObject()int

This method must be overwritten by derived classes to provide the basic initialization for the internal CFFObject.

Warning

This method must not be called directly!

Important

Before calling CFFObject.Load() this method must call initCFFObject() to initialize the CFFObject with the default scanning limits.

Returns

Returns SCAN_RESULT_OK if successful; otherwise returns SCAN_RESULT_ERROR.

Return type

int

See also _initObjectWithoutScan(), _startScan() and initCFFObject().

_initObjectWithoutScan()int

This method must be overwritten by derived classes which want to provide a different basic initialization for the internal CFFObject when loading the object from an existing project.

Warning

This method must not be called directly!

This method is different from _initObject(), because it is only called when a scan has already been performed and the scan provider can access an existing report. If this method is not implemented, _initObject() is called instead.

Important

Before calling CFFObject.Load() this method must call initCFFObject() to initialize the CFFObject with the default scanning limits.

Returns

Returns SCAN_RESULT_OK if successful; otherwise returns SCAN_RESULT_ERROR.

Return type

int

See also _initObject(), _startScan() and initCFFObject().

_postScan()None

This method must be overwritten by derived classes to receive the notification of when _threadScan() has finished.

Warning

This method must not be called directly!

See also _threadScan() and _startScan().

_scanViewData(xml: NTXml, dnode: NTXmlNode, sdata: ScanViewData)bool

This method must be overwritten by derived classes to provide data or views for a scan entry.

Warning

This method must not be called directly!

Parameters
  • xml (NTXml) – The XML report.

  • dnode (NTXmlNode) – The data node of the scan entry.

  • sdata (ScanViewData) – This structure contains the data returned by this method.

Returns

Returns True if the data is available; otherwise returns False.

Return type

bool

See also addEntry(), ScanViewData and _formatViewData().

_startScan()int

This method must be overwritten by derived classes to start the scan process.

Warning

This method must not be called directly!

If the method returns SCAN_RESULT_OK, the scan process must be performed from _threadScan(). Alternatively, if the scanning process is time inexpensive, the method can return SCAN_RESULT_FINISHED to specify that the scanning process is terminated. In that case, _threadScan() will not be invoked.

Hint

_startScan() is called from the main UI thread and should not be used for time consuming operation, otherwise it will block the UI. _threadScan() is called from a different thread than the main UI thread and can be used for long scanning processes.

Returns

Returns SCAN_RESULT_OK or SCAN_RESULT_FINISHED if successful; otherwise returns SCAN_RESULT_ERROR.

Return type

int

See also _initObject(), _threadScan() and addEntry().

_threadScan()None

This method must be overwritten by derived classes to implement the scanning process in a thread different than the main UI thread.

Warning

This method must not be called directly!

This method is called only when _startScan() returns SCAN_RESULT_OK.

See also _startScan() and addEntry().

_uinGetInitialViewData(context: ProContext, sdata: ScanViewData)int

This method must be overwritten by derived classes to provide the data for the additional initial views for the object.

Warning

This method must not be called directly!

Example:

def previewCallback(cv, self, code, view, data):
    if code == pvnInit:
        tv = cv.getView(1)
        tv.setText(self.previewText())
        return 1
    return 0

def _uinGetInitialViewData(self, ctx, sdata):
    ui = "<ui><vlayout margin='0'><text id='1'/></vlayout></ui>";
    sdata.data.setData(ui);
    sdata.setCallback(previewCallback, self)
    return 1

To inform the workspace about additional views, _uinSetupInitialViews() must be implemented.

Note

This method requires the UI module.

Parameters
Returns

Returns 1 if successful; otherwise returns 0.

Return type

int

See also _uinSetupInitialViews().

_uinSetupInitialViews(context: ProContext, sdata: ScanViewData)int

This method must be overwritten by derived classes to implement additional initial views for the object.

Warning

This method must not be called directly!

Example:

def _uinSetupInitialViews(self, ctx, sdata):
    sdata.supported_views |= SCANVIEW_CUSTOM_2
    sdata.addToolBarInfo(SCANVIEW_CUSTOM_2, "Preview", PubIcon_Text)
    return 0

To provide the data for the additional views, _uinGetInitialViewData() must be implemented.

Note

This method requires the UI module.

Parameters
Returns

Must return 0.

Return type

int

See also _uinGetInitialViewData().

addEmbeddedObject(offset: int, size: int, format: str, name: str, filters: Optional[str] = None)None

Adds a child object.

Note

This is a convenience method for child object which are plainly embedded into the current object. For more complex extractions addEntry() and CT_EmbeddedFile must be used.

Parameters
  • offset (int) – The offset of the child object.

  • size (int) – The size of the object.

  • format (str) – The format of the object. "?" can be specified to make the engine determine the format.

  • name (str) – The name of the object.

  • filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.

See also addEntry() and addFSFile().

addEntry(ed: Pro.Core.ScanEntryData)None

Adds a scan entry.

Scan entries can be threats, warnings, privacy issues, information and child objects.

Parameters

ed (ScanEntryData) – The data of the scan entry.

See also ScanEntryData, addEmbeddedObject(), addFSFile(), addNativeCodeEntry(), addSignatureMatch() and addHookEntry().

addFSFile(fspath: str, format: str, name: str, offset: int = INVALID_STREAM_OFFSET, size: int = 0, filters: Optional[str] = None, data: bytes = bytes())None

Adds an embedded object by its internal file-system name.

Important

The the file-system interface must be implemented to use this method.

Parameters
  • fspath (str) – The file-system name of the object.

  • format (str) – The format of the object. "?" can be specified to make the engine determine the format.

  • name (str) – The name of the object.

  • offset (int) – The start offset of the object.

  • size (int) – The size of the object.

  • filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.

  • data (bytes) – Optional data XML string.

Available since Cerbero Suite 7.0 and Cerbero Engine 4.0.

See also addEntry() and addEmbeddedObject().

addFileTime(type: int, local_time: Pro.Core.NTDateTime, utc_time: Pro.Core.NTDateTime = NTDateTime())None

Adds a file time.

Parameters

See also NTDateTime, SFT_CreationTime, SFT_AccessTime and SFT_ModificationTime.

addHookEntry(hook_name: str, ed: Pro.Core.ScanEntryData)None

Adds a scan entry handled by a hook extension.

Hint

The data returned for this entry must be provided by the hook extension associated to it. For this purpose the associated hook extension must implement the scandata function.

Scan entries can be threats, warnings, privacy issues, information and child objects.

Parameters
  • hook_name (str) – The name of the hook extension which handles the scan entry.

  • ed (ScanEntryData) – The data of the scan entry.

Available since Cerbero Suite 5.0 and Cerbero Engine 2.0.

See also ScanEntryData and addEntry().

addInternalFile(uid: str, format: str, name: str, offset: int = INVALID_STREAM_OFFSET, size: int = 0, filters: Optional[str] = None, data: str = str())None

Adds an internal file as child object.

Parameters
  • uid (str) – The id of the internal file.

  • format (str) – The format of the object. "?" can be specified to make the engine determine the format.

  • name (str) – The name of the object.

  • offset (int) – The offset of the child object.

  • size (int) – The size of the child object.

  • filters (str) – Optional XML string specifying which filters to apply to the object before scanning it.

  • data (str) – Optional data XML string.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also Report.newInternalFileUID(), Report.newInternalFilePath(), Report.saveInternalFile(), Report.retrieveInternalFile() and ProCoreContext.addObjectToReport().

addMetaData(id: str, content: bytes)None

Adds meta-data information.

Parameters
  • id (str) – The id of the meta-data.

  • content (bytes) – The content of the meta-data.

See also addMetaDataString(), extractMetaDataEntries() and getMetaDataEntries().

addMetaDataString(label: str, content: str)None

Adds visible meta-data information.

Parameters
  • label (str) – The label of the meta-data.

  • content (str) – The content of the meta-data.

See also addMetaData(), extractMetaDataEntries() and getMetaDataEntries().

addNativeCodeEntry(category: int, carbon_xml_string: str = str(), text: Optional[str] = None)None

Adds a native code scan entry.

self.addNativeCodeEntry(SEC_Info, "<carbon loader='PE'/>", "x64")
Parameters
  • category (int) – The category of the scan entry.

  • carbon_xml_string (str) – The Carbon XML information string.

  • text (str) – The information string for the Carbon loader.

See also addEntry().

addSignatureMatch(category: int, content: str)None

Adds a signature match scan entry.

Parameters
  • category (int) – The category of the scan entry.

  • content (str) – The text of the scan entry.

See also addEntry().

allowedChildrenFiles()int
Returns

Returns the maximum number of allowed child objects for this object.

Return type

int

See also allowedExtractionSize().

allowedExtractionSize()int
Returns

Returns the maximum extraction size allowed child objects of this object.

Return type

int

See also subtractExtractionSize() and allowedChildrenFiles().

customOperation(params: Pro.Core.NTStringVariantHash)Optional[Union[int, float, bool, bytes, str]]

Performs a custom operation.

Parameters

params (NTStringVariantHash) – The parameters for the operation.

Returns

Returns a value specific to the implementation of the internal _customOperation() method; by default returns None.

Return type

BasicType

See also _customOperation().

dataFromEntry(enode: NTXmlNode)NTXmlNode

Retrieves the data node from an entry node.

Parameters

enode (NTXmlNode) – The entry node.

Returns

Returns the data node if successful; otherwise returns None.

Return type

NTXmlNode

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also NTXml and getReportXML().

exclude(b: bool = True)None

Determines the inclusion of a root-level object into the project.

Parameters

b (bool) – If True, the object is excluded from the project.

See also include() and wasExcluded().

static extractMetaDataEntries(xml: NTXml, onode: NTXmlNode, flags: int = - 1)ScanMetaDataEntries

Retrieves the meta-data entries from an XML report.

Parameters
  • xml (NTXml) – The XML report.

  • onode (NTXmlNode) – The object node.

  • flags (int) – If specified, only the meta-data entries matching this value are retrieved (e.g. METAFLAG_STRING).

Returns

Returns a list of meta-data entries.

Return type

ScanMetaDataEntries

See also ScanMetaDataEntry, addMetaData(), addMetaDataString() and getMetaDataEntries().

getGlobalReport()Pro.Core.Report
Returns

Returns the project instance.

Return type

Report

See also Report.

getHash(name: str, compute: bool = True, wo: Optional[Pro.Core.NTIWait] = None)bytes

Retrieves a hash from the report by its name.

Note

If the compute argument is True and the hash is not already present in the report, then the method will compute the hash and try to store it in the report for future retrieval.

Parameters
  • name (str) – The name of the hash (e.g., ‘sha256’).

  • compute (bool) – If True, computes the hash if it’s not already present in the report (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).

  • wo (NTIWait) – The wait object used to compute the hash (available since Cerbero Suite 5.6 and Cerbero Engine 2.6.).

Returns

Returns the hash if successful; otherwise returns an empty bytes object.

Return type

bytes

See also NTIWait and COMPUTE_HASH.

getInstanceObject(key: str, defval: Optional[object] = None)object

Retrieves an object shared across parent and children scan providers given a specified key.

Parameters
  • key (str) – The key.

  • defval (object) – The default value to return if the requested object is not available.

Returns

Returns the requested object if available; otherwise returns the default value.

Return type

object

See also setInstanceObject() and getInstanceValue().

getInstanceValue(key: str, defval: Optional[Union[int, float, bool, bytes, str]] = None)Optional[Union[int, float, bool, bytes, str]]

Retrieves a value shared across parent and children scan providers given a specified key.

Parameters
  • key (str) – The key.

  • defval (BasicType) – The default value to return if the requested value is not available.

Returns

Returns the requested value if available; otherwise returns the default value.

Return type

BasicType

See also setInstanceValue() and getInstanceObject().

getMetaDataEntries(flags: int = - 1)Pro.Core.ScanMetaDataEntries

Retrieves meta-data entries.

Parameters

flags (int) – If specified, only the meta-data entries matching this value are retrieved (e.g. METAFLAG_STRING).

Returns

Returns a list of meta-data entries.

Return type

ScanMetaDataEntries

See also ScanMetaDataEntry, addMetaData(), addMetaDataString() and extractMetaDataEntries().

getMetaDataEntry(id: str)Pro.Core.ScanMetaDataEntry

Retrieves a meta-data entry by its identifier.

Parameters

id (str) – The meta-data identifier.

Returns

Returns a valid meta-data entry if successful; otherwise returns an empty meta-data entry.

Return type

ScanMetaDataEntry

See also ScanMetaDataEntry and getMetaDataEntries().

getNextEntry(t: int = - 1, enode: NTXmlNode = None)NTXmlNode

Retrieves the next entry node by its type.

Parameters
  • t (int) – The type of entry node to retrieve (e.g., CT_EmbeddedFile).

  • enode (NTXmlNode) – The current entry node.

Returns

Returns the next entry if available; otherwise returns None.

Return type

NTXmlNode

Available since Cerbero Suite 6.3 and Cerbero Engine 3.3.

See also NTXml and getReportXML().

getObject()object
Returns

Returns the internal CFFObject instance.

Return type

object

See also CFFObject, getObjectStream() and getObjectFormat().

getObjectFormat()str
Returns

Returns the format of the object.

Return type

str

See also getObject() and getObjectStream().

getObjectStream()Pro.Core.NTContainer

Retrieves the internal data container of the object.

Hint

This is the equivalent of calling CFFObject.GetStream().

Returns

Returns the internal data container of the object.

Return type

NTContainer

See also getStream(), getObject() and getObjectFormat().

getReportObjectNode()NTXmlNode
Returns

Returns the object node of the XML report.

Return type

NTXmlNode

See also getReportXML().

getReportXML()Pro.Core.NTXml

Retrieves the current XML report.

Important

The XML is available only at the completion of the scanning process.

Returns

Returns the XML report if available; otherwise returns an invalid NTXml instance.

Return type

NTXml

See also NTXml and getReportObjectNode().

getStream()Pro.Core.NTContainer

Retrieves the initial data associated with the scan provider.

Note

The returned data may differ from the data returned by getObjectStream.

Returns

Returns the initial data associated with the scan provider.

Return type

NTContainer

See also getObjectStream().

include(b: bool = True)None

Determines the inclusion of a root-level object into the project.

Parameters

b (bool) – If True, the object is included in the project.

See also exclude() and wasExcluded().

initCFFObject(obj: Pro.Core.CFFObject)None

Initializes the CFFObject with the default scanning limits.

Important

This method should be called from the implementations of _initObject() and _initObjectWithoutScan() before these methods call CFFObject.Load().

Parameters

obj (CFFObject) – The object to initialize with the default scanning limits.

See also _initObject() and _initObjectWithoutScan().

isAborted()bool
Returns

Returns True if was aborted; otherwise returns False.

Return type

bool

See also _stopScan().

isBatchScan()bool
Returns

Returns True if a batch scan is being performed; otherwise returns False.

Return type

bool

See also setBatchScan().

isNestedScan()bool
Returns

Returns True if the current scan is nested; otherwise returns False.

Return type

bool

See also scanNesting().

parentProvider()Pro.Core.ScanProvider
Returns

Returns the parent scan provider if present; otherwise returns None.

Return type

ScanProvider

See also rootProvider() and isNestedScan().

rootProvider()Pro.Core.ScanProvider
Returns

Returns the root scan provider for the current scan hierarchy.

Return type

ScanProvider

See also parentProvider() and isNestedScan().

scanNesting()int
Returns

Returns the current level of nesting. Returns 0 for root level scans.

Return type

int

See also isNestedScan().

scanOptions()int
Returns

Returns the scan options (e.g., SKIP_HASH).

Return type

int

See also setScanOptions().

setBatchScan(b: bool)None

Sets the batch scan status.

Parameters

b (bool) – The status to set.

See also isBatchScan().

setCachedObject(obj: Pro.Core.CFFObject)None

Sets the cached object which is returned by getObject().

Parameters

obj (CFFObject) – The object to set.

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also getObject() and _initObject().

setInstanceObject(key: str, obj: object, destroyer_cb: Optional[object] = None)None

Sets an object shared across parent and children scan providers given a specified key.

Parameters
  • key (str) – The key.

  • obj (object) – The object.

  • destroyer_cb (object) – An optional deletion callback.

See also getInstanceObject() and setInstanceValue().

setInstanceValue(key: str, value: Optional[Union[int, float, bool, bytes, str]])None

Sets a value shared across parent and children scan providers given a specified key.

Parameters
  • key (str) – The key.

  • value (BasicType) – The value.

See also getInstanceValue() and setInstanceObject().

setScanOptions(opt: int)None

Sets the scan options.

Parameters

opt (int) – The scan options (e.g., SKIP_HASH).

See also scanOptions().

subtractExtractionSize(size: int)None

Subtracts a specified size from the total amount of allowed extraction size.

Once the limit is reached a CT_DecompressionBomb scan entry is automatically added to the report.

Parameters

size (int) – The size to subtract.

See also allowedExtractionSize().

targetName()str
Returns

Returns the target name for the scan provider if available; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.6 and Cerbero Engine 2.6.

See also Report.currentTarget().

wasExcluded()bool
Returns

Returns True if the current file was excluded from the project; otherwise returns False.

Return type

bool

See also exclude() and include().

class ScanProviderWait(sprovider: Pro.Core.ScanProvider)

Bases: Pro.Core.NTIWait

This class only wraps ScanProvider.isAborted().

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also NTIWait.

Parameters

sprovider (ScanProvider) – The scan provider to be monitored for abort.

class ScanViewData

Bases: Pro.Core.ScanEntryBaseAttributes

This class is used as I/O container to retrieve data and UI views from a scan provider.

See also ScanProvider._scanViewData() and ScanProvider._formatViewData().

Methods:

addFileTime(type, local_time[, utc_time])

Adds a file time to the returned child object.

addMetaData(id, content)

Adds meta-data to the returned child object.

addMetaDataString(id_or_label, content_or_label)

Adds a meta-data string to the returned child object.

addToolBarInfo(view, descr, icon)

Specifies tool-bar label and icon for a view type.

setCallback(cb[, ud])

Sets the callback for custom view.

setViews(supported[, preferred])

Sets the views for the scan entry.

Attributes:

data

A CFFContainer which encapsulates the data returned by the scan provider.

dnode

The data node in the XML report.

highlight_rules

The name of the highlighting rules to be used for the returned text.

preferred_view

The default view for the entry (e.g., SCANVIEW_TEXT).

requested_view

The requested view for the entry (e.g., SCANVIEW_TEXT).

supported_views

The supported views for the entry (e.g., SCANVIEW_TEXT | SCANVIEW_HEX).

vflags

The flags for the views.

addFileTime(type: int, local_time: Pro.Core.NTDateTime, utc_time: Pro.Core.NTDateTime = NTDateTime())None

Adds a file time to the returned child object.

Parameters

See also NTDateTime, SFT_CreationTime, SFT_AccessTime and SFT_ModificationTime.

addMetaData(id: str, content: bytes)None

Adds meta-data to the returned child object.

Parameters
  • id (str) – The identifier of the meta-data.

  • content (bytes) – The content of the meta-data.

See also addMetaDataString().

addMetaDataString(id_or_label: str, content_or_label: str, content: Optional[str] = None)None

Adds a meta-data string to the returned child object.

Parameters
  • id_or_label (str) – Either the identifier or the label of the meta-data.

  • content_or_label (str) – Either the content or the label of the meta-data.

  • content (Optional[str]) – The content of the meta-data.

See also addMetaData().

addToolBarInfo(view: SViewType, descr: str, icon: int)None

Specifies tool-bar label and icon for a view type.

Parameters
  • view (SViewType) – The view type (e.g., SCANVIEW_TEXT).

  • descr (str) – The label.

  • icon (int) – The icon.

data

A CFFContainer which encapsulates the data returned by the scan provider.

It can contain raw data, text or an XML string, depending on the type of view that is selected.

See also CFFContainer, setViews() and setCallback().

dnode

The data node in the XML report.

highlight_rules

The name of the highlighting rules to be used for the returned text.

Applies only if the requested view is SCANVIEW_TEXT.

preferred_view

The default view for the entry (e.g., SCANVIEW_TEXT).

See also setViews, supported_views and requested_view.

requested_view

The requested view for the entry (e.g., SCANVIEW_TEXT).

See also setViews, supported_views and preferred_view.

setCallback(cb: object, ud: Optional[object] = None)None

Sets the callback for custom view.

When a custom view is requested (e.g., SCANVIEW_CUSTOM or SCANVIEW_CUSTOM_2), this sets the callback for it.

Hint

The data field must contain the XML string representing the custom view.

Parameters
  • cb (object) – The callback of the custom view.

  • ud (object) – The user data passed to the callback.

See also data.

setViews(supported: SViewType, preferred: SViewType = 0)None

Sets the views for the scan entry.

Parameters
  • supported (SViewType) – The combination of supported views (e.g., SCANVIEW_TEXT | SCANVIEW_HEX).

  • preferred (SViewType) – The preferred view (e.g., SCANVIEW_TEXT).

See also supported_views, preferred_view and requested_view.

supported_views

The supported views for the entry (e.g., SCANVIEW_TEXT | SCANVIEW_HEX).

See also setViews, preferred_view and requested_view.

vflags

The flags for the views.

If SCANVIEW_DATA_NOT_SHARED is specified, the data is not shared among the views. Consequently, when the view is switched, the scan provider must return different data for each requested view.

TB_SIZE: Final[int]

This constant defines the size of a terabyte.

See also KB_SIZE, MB_SIZE and GB_SIZE.

THIS_HDR_NAME: Final[str]

The special name of the header file associated with the report.

See also Report.thisHeaderFileName().

THIS_HEADER_NAME: Final[str]

The file name of the header file associated with the report.

See also Report.thisHeaderFileName().

TYPES_NATURE_BASE: Final[int]

Base value for type nature.

See also CFFObject.GetTypeNature().

ToolDir_CheckExistence: Final[int]

Checks for the existence of the directory. If the directory doesn’t exist, it causes the function being passed this option to return an empty string.

See also appDataDir(), userConfigDir(), userPluginsDir(), userHeadersDir(), userMediaDir(), userThemesDir(), userCarbonThemesDir() and userPDBSymbolsDir().

ToolDir_CreateIfMissing: Final[int]

Creates the directory if missing.

See also appDataDir(), userConfigDir(), userPluginsDir(), userHeadersDir(), userMediaDir(), userThemesDir(), userCarbonThemesDir() and userPDBSymbolsDir().

ToolDir_None: Final[int]

Returns the requested directory without checking for its existence or creating it if missing.

See also appDataDir(), userConfigDir(), userPluginsDir(), userHeadersDir(), userMediaDir(), userThemesDir(), userCarbonThemesDir() and userPDBSymbolsDir().

appDataDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user data directory for the application.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

applyFilters(data: Pro.Core.NTContainer, str: str, waitdlg_or_wo: Union[Pro.Core.NTIWait, bool] = True)Pro.Core.NTContainer

Applies the specified filters to an NTContainer and returns the resulting data as an NTContainer.

For example:

from Pro.Core import *

c = NTContainer()
c.setData(b"Hello, world!")
# compress data with zlib
fstr = "<flts><f name='pack/zlib' level='9' raw='true'/></flts>"
# set the last parameter to False to hide the wait-box
c = applyFilters(c, fstr, True)
# print out the compressed data
print(c.read(0, c.size()))

By using filters it’s possible to perform complex data operations with just a few lines of code. In the code snippet above we use a filter to compress the input data using zlib.

Parameters
  • data (NTContainer) – The input data.

  • str (str) – The filters XML string.

  • waitdlg_or_wo (Union[NTIWait, bool]) – Optionally displays a wait-dialog If True or specifies a wait object.

Returns

Returns the transformed data if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

See also NTContainer.

carbonThemesDir()str
Returns

Returns the carbon themes directory.

Return type

str

cfsFileSystem()Pro.Core.CFSInstance

Maps the computer file system to a CFSInstance instance.

Returns

Returns a valid instance if successful; otherwise returns an invalid CFSInstance instance.

Return type

CFSInstance

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also cfsFileSystemEntry().

See also CFSInstance and cfsFileSystemEntry().

cfsFileSystemEntry(path: str)Pro.Core.CFSEntry

Maps a file system file to a CFSEntry instance.

Parameters

path (str) – The file name.

Returns

Returns a valid entry if successful; otherwise returns an invalid CFSEntry instance.

Return type

CFSEntry

Available since Cerbero Suite 7.1 and Cerbero Engine 4.1.

See also CFSEntry and cfsFileSystem().

configDir()str
Returns

Returns the configuration directory.

Return type

str

createAddressSpace(name: str, pt_offs: int = 0, arg2: int = 0, arg3: int = 0)Pro.Core.NTAddressSpace

Creates an address space based on a page-table.

Parameters
  • name (str) – The name of the address space to create. Supported values are: "x86", "x86pae", "x64" and "bitmap".

  • pt_offs (int) – The offset of the page-table. When "bitmap" is specified, this parameter represents the offset of the bitmap.

  • arg2 (int) – When "bitmap" is specified, this parameter represents size of the bitmap. For all other address spaces this parameter is ignored.

  • arg3 (int) – When "bitmap" is specified, this parameter represents offset of the first page. For all other address spaces this parameter is ignored.

Returns

Returns the created address space if successful; otherwise returns an invalid address space.

Return type

NTAddressSpace

See also createSparseAddressSpace(), createBlockIOAddressSpace(), NTAddressSpace and NTContainer.

createBlockIOAddressSpace(total_size: int, page_size: int)Pro.Core.NTAddressSpace

Creates a block I/O address space.

When applied onto an NTContainer object, it ensures that every I/O operation on the container is performed at the granularity of the specified block size.

Parameters
  • total_size (int) – The total size that the container should appear to be. This parameter determines the size returned by NTContainer.size().

  • page_size (int) – The block size for I/O operations.

Returns

Returns the created address space.

Return type

NTAddressSpace

See also createAddressSpace(), createSparseAddressSpace(), NTAddressSpace and NTContainer.

createContainerFromFile(fname: str)Pro.Core.NTContainer

Creates an NTContainer object from a file on disk.

Whether the file will be read into an internal memory buffer or accessed from disk is decided on the basis of available memory resources at the time of the call.

Parameters

fname (str) – The name of the file.

Returns

Returns a valid NTContainer if successful; otherwise returns an invalid NTContainer.

Return type

NTContainer

See also newContainer() and NTContainer.

createSparseAddressSpace(reference_as: Pro.Core.NTContainer = NTContainer(), make_contiguous: bool = False, page_size: int = 0)Pro.Core.NTAddressSpace

Creates a sparse address space.

Parameters
  • reference_as (NTContainer) – An optional reference container object. This is used to propagate page flags.

  • make_contiguous (bool) – If True, the address space created will be contiguous.

  • page_size (int) – The page size.

Returns

Returns the created address space.

Return type

NTAddressSpace

See also createAddressSpace(), createBlockIOAddressSpace(), NTAddressSpace and NTContainer.

enableHook(name: str, enable: bool)None

Enables or disables the specified hook

Parameters
  • name (str) – The name of the hook.

  • enable (bool) – If True, the hook is enabled; otherwise it is disabled.

executeFunctionInMainThread(func: object, ud: Optional[object] = None, blocking: bool = True)object

Executes a function from the main thread.

The main thread is also the UI thread.

Parameters
  • func (object) – The function to execute.

  • ud (object) – Optional object to be passed to the function to execute.

  • blocking (bool) – If True, the current thread will lock until the specified function is executed; otherwise executeFunctionInMainThread() will return immediately.

Returns

Returns the object returned by the specified function if blocking=True; otherwise returns None.

See also isGuiThread().

headersDir()str
Returns

Returns the headers directory.

Return type

str

identifyPossibleFormats(data: Pro.Core.NTContainer)Pro.Core.NTStringList

Identifies a list of possible file formats for the input data.

Parameters

data (NTContainer) – The input data.

Returns

Returns a string list of file formats. If no file format was identified, the returned list is empty.

Return type

NTStringList

See also NTContainer.

isGuiThread()bool
Returns

Returns True if called from the UI thread; otherwise returns False.

Return type

bool

See also executeFunctionInMainThread().

mediaDir()str
Returns

Returns the media directory.

Return type

str

newContainer(size: int = 0, reserve_size: int = 4096, max_size: int = 0)Pro.Core.NTContainer

Creates a new NTContainer object.

Whether the container will be using an internal memory buffer or a file on disk is decided on the basis of available memory resources at the time of the call.

Parameters
  • size (int) – The initial size of the container.

  • reserve_size (int) – The size to initially reserve for the container.

  • max_size (int) – The maximum size the container will ever reach. This is an optional parameter used to decide whether the container can operate on a memory buffer.

Returns

Returns the created container if successful; otherwise returns an invalid container.

Return type

NTContainer

See also createContainerFromFile() and NTContainer.

ntAlpha(rgb: int)int

Retrieves the alpha color component from an RGBA value.

Parameters

rgb (int) – The RGBA value.

Returns

Returns the alpha color component.

Return type

int

See also ntRed(), ntGreen(), ntBlue(), ntRgb() and ntRgba().

ntAlphaBlend(src: int, bkg: int)int

Performs an alpha blend operation on two RGBA values.

Parameters
  • src (int) – The source RGBA value.

  • bkg (int) – The background RGBA value.

Returns

Returns the RGBA result of the alpha blend operation.

Return type

int

See also ntShiftToColor(), ntRgb() and ntRgba().

ntBlue(rgb: int)int

Retrieves the blue color component from an RGBA value.

Parameters

rgb (int) – The RGBA value.

Returns

Returns the blue color component.

Return type

int

See also ntRed(), ntGreen(), ntAlpha(), ntRgb() and ntRgba().

ntGreen(rgb: int)int

Retrieves the green color component from an RGBA value.

Parameters

rgb (int) – The RGBA value.

Returns

Returns the green color component.

Return type

int

See also ntRed(), ntBlue(), ntAlpha(), ntRgb() and ntRgba().

ntRed(rgb: int)int

Retrieves the read color component from an RGBA value.

Parameters

rgb (int) – The RGBA value.

Returns

Returns the red color component.

Return type

int

See also ntGreen(), ntBlue(), ntAlpha(), ntRgb() and ntRgba().

ntRgb(r: int, g: int, b: int)int

Creates an RGBA value from its red, green and blue color components.

Parameters
  • r (int) – The red color component.

  • g (int) – The green color component.

  • b (int) – The blue color component.

Returns

Returns the RGBA value.

Return type

int

See also ntRed(), ntGreen(), ntBlue(), ntAlpha() and ntRgba().

ntRgba(r: int, g: int, b: int, a: int)int

Creates an RGBA value from its red, green, blue and alpha color components.

Parameters
  • r (int) – The red color component.

  • g (int) – The green color component.

  • b (int) – The blue color component.

  • a (int) – The alpha color component.

Returns

Returns the RGBA value.

Return type

int

See also ntRed(), ntGreen(), ntBlue(), ntAlpha() and ntRgb().

ntShiftToColor(source: int, target: int, fraction: float)int

Shift an RGBA value to another RGBA value.

Parameters
  • source (int) – The source RGBA value.

  • target (int) – The target RGBA value.

  • fraction (float) – The shift factor expressed as a floating point number.

Returns

Returns the computed RGBA value.

Return type

int

See also ntAlphaBlend(), ntRgb() and ntRgba().

class objdb_info

This class contains information about an entry in the object database.

See also Report.objGetInfo(), Report.objCursorInfo() and Report.objViewInfo().

Attributes:

filename

The file name of the object as on disk.

flags

The flags of the object (e.g.: OFLAG_NO_DECRYPT).

format

The file format of the object.

offset

The offset of the object inside the project database.

risk

The risk factor of the object.

target

The target name of the object.

filename

The file name of the object as on disk.

flags

The flags of the object (e.g.: OFLAG_NO_DECRYPT).

format

The file format of the object.

offset

The offset of the object inside the project database.

This value is only used when scanned files are included in the project.

risk

The risk factor of the object.

target

The target name of the object.

class objdbview_info

This class contains parameters to create a window view of the object database.

See also Report.objViewCreate().

Attributes:

pages

The number of pages in the view.

pos

Unused parameter.

winsize

The size of the window view.

pages

The number of pages in the view.

This value is returned by Report.objViewCreate().

pos

Unused parameter.

winsize

The size of the window view.

packageCertificatesDir()str
Returns

Returns the package certificates directory.

Return type

str

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

pluginsDir()str
Returns

Returns the plugins directory.

Return type

str

Available since Cerbero Suite 5.3 and Cerbero Engine 2.3.

proAbort(ret: int, msg: str = str())None

Aborts the application with an optional message.

Parameters
  • ret (int) – The return value.

  • msg (str) – The optional abort message.

proAddRecentFile(history: str, fname: str, max_list_size: int = 10)bool

Adds a recent file name to a specified historical list.

Parameters
  • history (str) – The unique name of the historical list.

  • fname (str) – The file name to add.

  • max_list_size (int) – The maximum size the list can reach.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.

See also proGetRecentItems() and proAddRecentItem().

proAddRecentItem(history: str, item: str, max_list_size: int = 10)bool

Adds a recent item to a specified historical list.

Hint

This function is used to implement recent items in logic providers.

Parameters
  • history (str) – The unique name of the historical list.

  • item (str) – The item to add.

  • max_list_size (int) – The maximum size the list can reach.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.

See also proGetRecentItems() and proAddRecentFile().

proApplicationFileName()str
Returns

Returns the path of the main application.

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

proArchIsX64()bool
Returns

Returns True if the current architecture is x64; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proArchName() and proArchIsX86().

proArchIsX86()bool
Returns

Returns True if the current architecture is x86; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proArchName() and proArchIsX64().

proArchName()str
Returns

Returns the name of the current architecture (e.g., 'x64').

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proArchIsX86() and proArchIsX64().

proClearOutput(with_undo: bool = True)None

Clears the output view if available.

Parameters

with_undo (bool) – If True, gives the user the possibility to undo this operation from the UI.

See also proPrint() and proPrintnl().

proCoreContext()Pro.Core.ProCoreContext
Returns

Returns the global ProCoreContext instance.

Return type

ProCoreContext

See also ProCoreContext.

proCrashApplication(i: int)None

Crashes the application on purpose.

This function is provided for debugging purposes.

Parameters

i (int) – A value which may be used to generate the exception.

See also proAbort().

proDisasmOptions()int
Returns

Returns the current disassembly options for the text view.

Return type

int

See also DisasmOpt_Opcodes and DisasmOpt_FileOffsets.

proGetIntPtr(name: str)native_pointer

Retrieves an internal pointer.

Note

This function is reserved for internal use.

Parameters

name (str) – The name of the pointer to retrieve.

Returns

Returns the requested pointer if successful; otherwise returns None.

Return type

native_pointer

Available since Cerbero Suite 6.5 and Cerbero Engine 3.5.

proGetLine(prompt: str = str())str

Retrieves an input string either by prompting a dialog box or from the terminal.

Note

This function is used internally by Python’s built-in input() function.

Parameters

prompt (str) – The message prompted to the user.

Returns

Returns the string entered by the user.

Return type

str

Available since Cerbero Suite 5.5 and Cerbero Engine 2.5.

See also proPrint() and proPrintnl().

proGetRecentItems(history: str)Pro.Core.NTStringList

Retrieves a specified historical list.

Hint

This function is used to implement recent items in logic providers.

Parameters

history (str) – The unique name of the historical list.

Returns

Returns the requested historical list.

Return type

NTStringList

Available since Cerbero Suite 7.4 and Cerbero Engine 4.4.

See also proAddRecentItem() and proAddRecentFile().

proGetRiskBgColor(risk: int, bg: int)int

Computes a color based on risk percentage.

Parameters
  • risk (int) – The risk percentage.

  • bg (int) – The background color.

Returns

Returns the computed risk color.

Return type

int

See also ntRgba(), ntRgb() and ntShiftToColor().

proLaunchApplication(app: str, args: Pro.Core.NTStringList = NTStringList())bool

Launches an application.

Parameters
  • app (str) – The application to launch.

  • args (NTStringList) – The arguments to be passed to the application.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proLaunchThisApplication().

proLaunchThisApplication(args: Pro.Core.NTStringList = NTStringList())bool

Launches the main application.

Note

Internally this function calls proLaunchApplication() with proApplicationFileName() as application.

Parameters

args (NTStringList) – The arguments to be passed to the application.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proLaunchApplication() and proApplicationFileName().

proPlatformIsLinux()bool
Returns

Returns True if the current platform is Linux; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proPlatformName(), proPlatformShortName(), proPlatformIsWindows() and proPlatformIsMacOS().

proPlatformIsMacOS()bool
Returns

Returns True if the current platform is macOS; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proPlatformName(), proPlatformShortName(), proPlatformIsWindows() and proPlatformIsLinux().

proPlatformIsWindows()bool
Returns

Returns True if the current platform is Windows; otherwise returns False.

Return type

bool

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proPlatformName(), proPlatformShortName(), proPlatformIsLinux() and proPlatformIsMacOS().

proPlatformName()str
Returns

Returns the name of the current platform (supported values are: 'windows', 'linux' and 'macos').

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proPlatformShortName(), proPlatformIsWindows(), proPlatformIsLinux() and proPlatformIsMacOS().

proPlatformShortName()str
Returns

Returns the short name of the current platform (supported values are: 'win', 'lin' and 'mac').

Return type

str

Available since Cerbero Suite 5.4 and Cerbero Engine 2.4.

See also proPlatformName(), proPlatformIsWindows(), proPlatformIsLinux() and proPlatformIsMacOS().

proPrint(str: str)None

Prints a message to the output view.

The difference with proPrintnl() is that the message is not be terminated by a new-line character.

Parameters

str (str) – The message to print.

See also proPrintnl() and proClearOutput().

proPrintnl(str: str)None

Prints a message to the output view.

The difference with proPrint() is that a new-line character is automatically appended to the message.

Parameters

str (str) – The message to print.

See also proPrint() and proClearOutput().

proProcessEvents(ms: int = 0)None

Processes thread loop events.

When called from the UI thread, this function processes UI events.

Parameters

ms (int) – The maximum amount of time expressed in milliseconds to be spent processing queued events. If 0, all queued events are processed.

See also NTIWait.

proSetReturnCode(ret: int)None

Sets the return code for the application.

Parameters

ret (int) – The return code.

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also ProCoreContext.quit() and proAbort().

proTextStream()Pro.Core.NTTextBuffer

Creates a new NTTextBuffer instance with the default disassembly options.

Returns

Returns a new NTTextBuffer instance.

Return type

NTTextBuffer

See also proDisasmOptions() and NTTextStream.

proVersion()str
Returns

Returns the current version of the application as a string in the shape of major_version.minor_version.build_version.

Return type

str

See also proVersionMajor(), proVersionMinor() and proVersionBuild().

proVersionBuild()int
Returns

Returns the build number of the application.

Return type

int

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also proVersion(), proVersionMajor() and proVersionMinor().

proVersionMajor()int
Returns

Returns the major version of the application.

Return type

int

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also proVersion(), proVersionMinor() and proVersionBuild().

proVersionMinor()int
Returns

Returns the minor version of the application.

Return type

int

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also proVersion(), proVersionMajor() and proVersionBuild().

pythonAllowIdleProcessing(b: bool)None

Enables or disables the idle processing of Python code.

This function should be used rarely. Once the idle processing is disabled, it must be re-enabled as soon as possible.

Parameters

b (bool) – If False, disables the idle processing of Python code.

themesDir()str
Returns

Returns the themes directory.

Return type

str

userCarbonThemesDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user carbon themes directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

userConfigDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user configuration directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

userHeadersDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user headers directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

userMediaDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user media directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

userPDBSymbolsDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user PDB symbols directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.

userPackageCertificatesDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user package certificates directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also ToolDir_CreateIfMissing.

userPackagesDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user packages directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also ToolDir_CreateIfMissing.

userPluginsDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user plugins directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing and userPythonPluginsDir().

userPythonPluginsDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user Python plugins directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

Available since Cerbero Suite 5.1 and Cerbero Engine 2.1.

See also ToolDir_CreateIfMissing.

userThemesDir(opt: int = ToolDir_CheckExistence)str

Retrieves the user themes directory.

Parameters

opt (int) – By default ToolDir_CheckExistence.

Returns

Returns the directory if successful; otherwise returns an empty string.

Return type

str

See also ToolDir_CreateIfMissing.