TruxtonExport

From truxwiki.com
Revision as of 09:34, 2 December 2020 by Sam (talk | contribs) (→‎fqid)
Jump to navigation Jump to search

This class gives you the capability to export files from Truxton.

Attributes and Methods

addcriteria(field, value)

Adds criteria to the selection of files to export.

The following are the possible criteria to set.

fqhash

The value contains a string containing the hash or partial hash of the file to export.

fqid

The value parameter is a string containing the GUID of the file which corresponds to the [ID] column of the [File] table. You can specify a comma separated list of identifiers if you want to export more than a single file.

fqlimit

Sets the maximum number of files to export.

fqmedia

The identifier of the media the exported files belong to.

fqparentid

The identifier of the parent of the files to export. This is useful for exporting the files in a folder in the seized media.

fqsize

The length of the file to export.

fqsizeminimum

The minimum number of bytes in the file to export.

fqsizemaximum

The maximum number of bytes in the file to export.

fqtype

The type of file to export. You can specify a comma separated list of file types if you want to export more than a single type.

addoption(field, value)

Sets one of the output options.

execute()

After the criteria and options have been set, this function will perform the task of exporting the files from Truxton.

where

Holds the SQL WHERE clause based on the current criteria.

Sample

import truxton

def main():
  t = truxton.create()

  exporter = t.newexporter()

  # Limit the number of files exported to 99
  exporter.addcriteria( exporter.fqlimit, 99 )

  # Make sure the files being exported are at least 4KB
  exporter.addcriteria( exporter.fqsizeminimum, 4096)

  # We want JPGs, EXIF and GIFs
  exporter.addcriteria( exporter.fqtype, truxton.Type_JPEG )
  exporter.addcriteria( exporter.fqtype, truxton.Type_JPEGWithExif)
  exporter.addcriteria( exporter.fqtype, truxton.Type_GIF)

  # Only output files that have an MD5 starting with E4
  exporter.addcriteria( exporter.fqhash, "e4" )

  # Select files that belong to a particular piece of media
  exporter.addcriteria( exporter.fqmedia, "174bcbe6-ef53-170f-8903-3958c45521a4" )

  # We want the files to be named with their hash followed by original name
  exporter.addoption( exporter.eoname, "{hash}_{name}" )

  # Write the exported files to C:\temp
  exporter.addoption( exporter.eofolder, "c:\\temp" )

  # Write the files to output.tar in c:\temp
  exporter.addoption( exporter.eotar, "output.tar" )

  exporter.execute()

if __name__ == "__main__":
  main()