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....") |
(→Sample) |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
=Syntax= | =Syntax= | ||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
| − | object | + | object newrelation(); |
</syntaxhighlight> | </syntaxhighlight> | ||
=Return value= | =Return value= | ||
| − | A | + | A [[TruxtonRelation|relation]] object. |
=Sample= | =Sample= | ||
| − | <syntaxhighlight lang="Python" | + | <syntaxhighlight lang="Python" highlight="25"> |
import truxton | import truxton | ||
def main(): | def main(): | ||
t = truxton.create() | t = truxton.create() | ||
| − | + | file_in_truxton = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000") | |
| − | imsi = | + | imsi = file_in_truxton .newartifact() |
imsi.type = truxton.ENTITY_TYPE_IMSI | imsi.type = truxton.ENTITY_TYPE_IMSI | ||
| Line 28: | Line 28: | ||
imsi.save() | imsi.save() | ||
| − | mac = | + | mac = file_in_truxton .newartifact() |
mac.type = truxton.ENTITY_TYPE_MAC_ADDRESS | mac.type = truxton.ENTITY_TYPE_MAC_ADDRESS | ||
| Line 37: | Line 37: | ||
mac.save() | mac.save() | ||
| − | relationship = | + | relationship = file_in_truxton .newrelation() |
relationship.a = imsi.id | relationship.a = imsi.id | ||
| Line 47: | Line 47: | ||
if relationship.save() is True: | if relationship.save() is True: | ||
print( "New relationship established" ) | print( "New relationship established" ) | ||
| + | |||
| + | return None | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
| − | main() | + | sys.exit(main()) |
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 10:04, 3 February 2024
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
import truxton
def main():
t = truxton.create()
file_in_truxton = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
imsi = file_in_truxton .newartifact()
imsi.type = truxton.ENTITY_TYPE_IMSI
imsi.value = "310120265624299"
imsi.datatype = truxton.DATA_TYPE_ASCII
imsi.length = 15
imsi.offset = 1
imsi.save()
mac = file_in_truxton .newartifact()
mac.type = truxton.ENTITY_TYPE_MAC_ADDRESS
mac.value = "001422012345"
mac.datatype = truxton.DATA_TYPE_ASCII
mac.length = 12
mac.offset = 111
mac.save()
relationship = file_in_truxton .newrelation()
relationship.a = imsi.id
relationship.b = mac.id
relationship.typea = truxton.OBJECT_TYPE_ENTITY
relationship.typeb = truxton.OBJECT_TYPE_ENTITY
relationship.relation = truxton.RELATION_RELATED
if relationship.save() is True:
print( "New relationship established" )
return None
if __name__ == "__main__":
sys.exit(main())