TruxtonEvent

From truxwiki.com
Revision as of 06:24, 28 May 2020 by Sam (talk | contribs) (→‎Sample)
Jump to navigation Jump to search

This class lets you add to the Event table in Truxton.

Attributes and Methods

id

This is the GUID of the event. It becomes non-zero after save() has been called.

description

The longer description of the event.

end

When the event ended in FILETIME ticks. This corresponds to the End column of the Event table.

fileid

The GUID of the file this event came from. This corresponds to the FileID column of the Event table.

mediaid

This is the GUID of the media this event came from. This identifier corresponds to the MediaID of the Event table.

save()

This will commit the information to the Event table.

tag(tag, reason, origin)

This creates a tag associated with this event in Truxton. The tag parameter is a short, one or two word, bit of text that will be displayed in the UI. The reason a sentence explaining why this event was tagged. The origin is either TAG_ORIGIN_AUTOMATIC (1) or TAG_ORIGIN_HUMAN (2). It will return True if the tag was associated with the file, False on failure.

start

When the event began in FILETIME ticks. This corresponds to the Start column of the Event table.

title

This corresponds to the Title column of the Event table.

type

This corresponds to the EventTypeID column of the Event table. It should contain a value from the ID column of the EventType table.

Sample

 1 import truxton
 2 import shutil
 3 
 4 from datetime import datetime
 5 from calendar import timegm
 6 from pathlib import Path
 7 
 8 EPOCH_AS_FILETIME = 116444736000000000
 9 HUNDREDS_OF_NANOSECONDS = 10000000
10 
11 EVENT_TYPE_FBI = 20001
12 
13 def date_to_filetime(dt):
14   return EPOCH_AS_FILETIME + (timegm(dt.timetuple()) * HUNDREDS_OF_NANOSECONDS)
15 
16 def create_event_type(t, id, name):
17   event_type = t.neweventtype()
18   event_type.id = id
19   event_type.name = name
20   event_type.save()
21 
22 def add_media(t):
23   media = t.newmedia()
24 
25   media.name = "Public Documents"
26   media.description = "Publicly available documents"
27   media.case = "DC-SNAFU-2016.2020"
28   media.evidencebag = "EV-0937459386623-a"
29   media.originator = "Jeffrey Jensen"
30   media.latitude = 38.897661
31   media.longitude = -77.036458
32   media.type = truxton.MEDIA_TYPE_LOGICAL_FILES
33 
34   if media.save():
35     print("Media saved")
36   else:
37     print("Media not saved")
38 
39   return media
40 
41 def main():
42   t = truxton.create()
43 
44   create_event_type(t, EVENT_TYPE_FBI, "FBI Actions" )
45 
46   media = add_media(t)
47 
48   root_file = media.addroot()
49   root_file.save()
50 
51 
52 
53 if __name__ == "__main__":
54   main()