Difference between revisions of "TruxtonChildFileIO newartifact"
Jump to navigation
Jump to search
(Created page with "This create an artifact object from a file in Truxton. It automatically associates the file and media identifiers used in the entity table. =Syntax= <synta...") |
|||
| Line 29: | Line 29: | ||
t = truxton.create() | t = truxton.create() | ||
file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000") | file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000") | ||
| − | child = add_file(file, "C: | + | child = add_file(file, "C:/decrypts/PlainText.txt") |
artifact = child .newartifact() | artifact = child .newartifact() | ||
Revision as of 15:10, 25 May 2020
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 Entity object
Sample
import truxton
import shutil
from pathlib import Path
def add_file(parent_truxton_file, filename):
source_file = open(filename, "rb")
child = parent_truxton_file.newchild()
child.name = Path(filename).name
shutil.copyfileobj(source_file, child)
source_file.close()
child.save()
return child
def main():
t = truxton.create()
file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
child = add_file(file, "C:/decrypts/PlainText.txt")
artifact = child .newartifact()
artifact.type = truxton.ENTITY_TYPE_PASSWORD
artifact.value = "password"
artifact.datatype = truxton.DATA_TYPE_ASCII
artifact.length = 8
artifact.offset = 1
artifact.save()
if __name__ == "__main__":
main()