Difference between revisions of "TruxtonFileIO newrelation"
Jump to navigation
Jump to search
(Created page with "This create new relationship sourced from a file in Truxton. It automatically associates the parent file and media identifiers used in the Relation table....") |
(→Syntax) |
||
| Line 4: | Line 4: | ||
=Syntax= | =Syntax= | ||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
| − | object | + | object newrelation(); |
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 15:24, 21 May 2020
This create new relationship sourced from a file in Truxton. It automatically associates the parent file and media identifiers used in the Relation table.
Syntax
object newrelation();
Return value
A Relation object
Sample
1 import truxton
2
3 def main():
4 t = truxton.create()
5 file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
6
7 imsi = file.newartifact()
8
9 imsi.type = truxton.ENTITY_TYPE_IMSI
10 imsi.value = "310120265624299"
11 imsi.datatype = truxton.DATA_TYPE_ASCII
12 imsi.length = 15
13 imsi.offset = 1
14 imsi.save()
15
16 mac = file.newartifact()
17
18 mac.type = truxton.ENTITY_TYPE_MAC_ADDRESS
19 mac.value = "001422012345"
20 mac.datatype = truxton.DATA_TYPE_ASCII
21 mac.length = 12
22 mac.offset = 111
23 mac.save()
24
25 relationship = file.newrelation()
26
27 relationship.a = imsi.id
28 relationship.b = mac.id
29 relationship.typea = truxton.OBJECT_TYPE_ENTITY
30 relationship.typeb = truxton.OBJECT_TYPE_ENTITY
31 relationship.relation = truxton.RELATION_RELATED
32
33 if relationship.save() is True:
34 print( "New relationship established" )
35
36 if __name__ == "__main__":
37 main()