Difference between revisions of "TruxtonFileIO tag"

From truxwiki.com
Jump to navigation Jump to search
Line 1: Line 1:
 
This creates a tag associated with this file in Truxton.
 
This creates a tag associated with this file in Truxton.
 +
It will result in a record being added to the <code>[Tagged]</code> table.
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="Python">
+
<source lang="Python">
bool tag(tag, reason, origin);
+
bool tag( tag, reason, origin );
</syntaxhighlight>
+
</source>
 +
 
 +
=Parameters=
 +
==<code>tag</code>==
 +
This string is the bit of text that will appear in the Analyst desktop.
 +
It must have first been created using the <code>[[TruxtonObject#createtag.28name.2C_description.29|createtag()]]</code> function.
 +
 
 +
==<code>reason</code>==
 +
A description of why this tag is being applied to the file.
 +
 
 +
==<code>origin</code>==
 +
This tells the analyst whether a human or an algorithm tagged this file.
 +
<code>TAG_ORIGIN_AUTOMATIC</code> (1) means that an algorithm tagged the file while <code>TAG_ORIGIN_HUMAN</code> (2) means the tag is the result of a human making a decision.
  
 
=Return value=
 
=Return value=
 
[https://docs.python.org/3.8/library/constants.html?highlight=false#True True] if the tag was associated with the file, [https://docs.python.org/3.8/library/constants.html?highlight=false#False False] on failure.
 
[https://docs.python.org/3.8/library/constants.html?highlight=false#True True] if the tag was associated with the file, [https://docs.python.org/3.8/library/constants.html?highlight=false#False False] on failure.
 +
 +
=Remarks=
 +
In order for the tag to be visible in the Analyst desktop, the <code>tag</code> must first have been created using the <code>[[TruxtonObject#createtag.28name.2C_description.29|createtag()]]</code> function.
  
 
=Sample=
 
=Sample=
 
+
<source lang="Python" highlight="7">
<syntaxhighlight lang="Python" highlight="7">
 
 
import truxton
 
import truxton
  
Line 22: Line 37:
 
if __name__ == "__main__":
 
if __name__ == "__main__":
 
   main()
 
   main()
</syntaxhighlight>
+
</source>

Revision as of 06:46, 2 March 2021

This creates a tag associated with this file in Truxton. It will result in a record being added to the [Tagged] table.

Syntax

bool tag( tag, reason, origin );

Parameters

tag

This string is the bit of text that will appear in the Analyst desktop. It must have first been created using the createtag() function.

reason

A description of why this tag is being applied to the file.

origin

This tells the analyst whether a human or an algorithm tagged this file. TAG_ORIGIN_AUTOMATIC (1) means that an algorithm tagged the file while TAG_ORIGIN_HUMAN (2) means the tag is the result of a human making a decision.

Return value

True if the tag was associated with the file, False on failure.

Remarks

In order for the tag to be visible in the Analyst desktop, the tag must first have been created using the createtag() function.

Sample

import truxton

def main():
  t = truxton.create()
  file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")

  file.tag("Bomb", "Contains references to TNT", truxton.TAG_ORIGIN_HUMAN)

if __name__ == "__main__":
  main()