TruxtonEnumeration
This class lets you enumerate things in Truxton.
Contents
Attributes and Methods
addnote(text: str) -> boolean
This adds an investigator's note.
The text parameter is the contents of the note.
It will return
True if the tag was associated with the communication, False on failure.
The note is stored in the [InvestigatorNote] table in the database.
currentfile: TruxtonFileIO
The file that contained whatever is being enumerated.
currentinvestigation: TruxtonInvestigation
The investigation that contained whatever is being enumerated.
currentmedia: TruxtonMedia
The media that contained whatever is being enumerated.
scope: int
This sets the level at which things can be enumerated. The default is a global scope, you want to enumerate everything in Truxton. You can set it to:
- Type_Investigation - This will tell Truxton you wish to enumerate things in a particular investigation
- Type_Media - This will tell Truxton you wish to enumerate things in a particular piece of media
scopeid: str | UUID
This isolates the scope to the particular investigation or media you wish to enumerate.
target: int
These are the things you want to enumerate. It can be one of the following:
- Type_Artifact - The enumeration will be TruxtonArtifact objects
- Type_Camera_Information - The enumeration will be TruxtonEXIF objects
- Type_Event - The enumeration will be TruxtonEvent objects
- Type_File - The enumeration will be TruxtonFileIO objects
- Type_Investigation - The enumeration will be TruxtonInvestigation objects
- Type_Location - The enumeration will be TruxtonLocation objects
- Type_Media - The enumeration will be TruxtonMedia objects
- Type_Message_Attachment - The enumeration will be TruxtonFileIO objects of message attachments
- Type_Message_Body - The enumeration will be TruxtonFileIO objects of message bodies
- Type_Participant - The enumeration will be TruxtonMessageParticipant objects
- Type_Website_Visit - The enumeration will be TruxtonUrl objects
Sample
This sample will enumerate all of the investigations in Truxton and list all media in those investigations. The output is JSON format.
1 import sys
2 import json
3 sys.path.append('C:/Program Files/Truxton/SDK')
4 import truxton
5
6 trux = truxton.create()
7
8 media_status_names = json.loads(trux.mediastatusnames())
9 media_type_names = json.loads(trux.mediatypenames())
10
11 def output_investigation(investigation: truxton.TruxtonInvestigation, instance: int) -> None:
12 if instance > 0:
13 print(",")
14
15 d = dict()
16 d["id"] = investigation.id.lower()
17 d["name"] = investigation.name
18 d["case"] = investigation.case
19 d["description"] = investigation.description
20 d["jurisdiction"] = str(investigation.jurisdiction)
21 d["opened"] = F"{investigation.opened:%Y-%m-%dT%H:%M:%SZ}"
22 d["status"] = str(investigation.status)
23 d["type"] = str(investigation.type)
24
25 object_name = dict()
26 object_name["investigation"] = d;
27 print(json.dumps(object_name, ensure_ascii = False, sort_keys = True))
28
29 def output_media(media: truxton.TruxtonMedia) -> None:
30 d = dict()
31 d["id"] = media.id.lower()
32 d["name"] = media.name
33 d["case"] = media.case
34 d["loadconfiguration"] = str(media.configid)
35 d["created"] = F"{media.created:%Y-%m-%dT%H:%M:%SZ}"
36 d["description"] = media.description
37 d["evidencebag"] = media.evidencebag
38 d["expires"] = F"{media.expires:%Y-%m-%dT%H:%M:%SZ}"
39 d["generatedfolderid"] = media.generatedfolderid.lower()
40 d["latitude"] = str(media.latitude)
41 d["longitude"] = str(media.longitude)
42 d["originator"] = media.originator
43 d["percentcomplete"] = str(media.percentcomplete)
44 d["rootid"] = media.rootid.lower()
45 d["status"] = str(media.status)
46 d["statusname"] = media_status_names[str(media.status)]
47 d["type"] = str(media.type)
48 d["typename"] = media_type_names[str(media.type)]
49 d["updated"] = F"{media.updated:%Y-%m-%dT%H:%M:%SZ}"
50
51 object_name = dict()
52 object_name["media"] = d;
53 print("," + json.dumps(object_name, ensure_ascii = False, sort_keys = True))
54
55 def dump_investigation(investigation: truxton.TruxtonInvestigation, instance: int) -> None:
56 output_investigation(investigation, instance)
57
58 investigation_media = trux.newenumerator()
59 investigation_media.scope = truxton.Type_Investigation
60 investigation_media.scopeid = investigation.id
61 investigation_media.target = truxton.Type_Media
62
63 for media in investigation_media:
64 output_media(media)
65
66 def main():
67 investigations = trux.newenumerator()
68 investigations.target = truxton.Type_Investigation
69
70 print("[")
71 instance = 0
72 for investigation in investigations:
73 dump_investigation(investigation, instance)
74 instance += 1
75 print("]")
76
77 if __name__ == "__main__":
78 main()