Difference between revisions of "TruxtonFileIO newartifact"

From truxwiki.com
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
=Return value=
 
=Return value=
An Entity object
+
An [[TruxtonArtifact|artifact]] object
  
 
=Sample=
 
=Sample=
Line 27: Line 27:
 
   artifact.offset = 1
 
   artifact.offset = 1
 
   artifact.save()
 
   artifact.save()
 +
 +
  return None
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
   main()
+
   sys.exit(main())
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:02, 3 February 2024

This create an artifact object from a file in Truxton. It automatically associates the file and media identifiers used in the entity table.

Syntax

object newartifact();

Return value

An artifact object

Sample

import truxton

def main():
  t = truxton.create()
  file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")

  artifact = file.newartifact()

  artifact.type = truxton.ENTITY_TYPE_PASSWORD
  artifact.value = "password"
  artifact.datatype = truxton.DATA_TYPE_ASCII
  artifact.length = 8
  artifact.offset = 1
  artifact.save()

  return None

if __name__ == "__main__":
  sys.exit(main())