Difference between revisions of "TruxtonFileIO newrelation"
Jump to navigation
Jump to search
(→Sample) |
|||
| 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() | main() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 07:27, 17 September 2022
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 = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
imsi = file.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.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.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__":
main()