Difference between revisions of "TruxtonChildFileIO addnote"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This creates an investigator note associated with this file in Truxton. This will add a record to the <code>[InvestigatorNote]</code> table in the database. =Syntax= <syntaxh...")
 
 
Line 36: Line 36:
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
   main()
+
   sys.exit(main())
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:04, 3 February 2024

This creates an investigator note associated with this file in Truxton. This will add a record to the [InvestigatorNote] table in the database.

Syntax

addnote(text: str) -> boolean

Return value

True if the note was associated with the file, False on failure.

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_child( file, "C:/Manual Exploitation/Clients.csv")

  child.addnote("We had the interns manually type these in.")

  return None

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