Difference between revisions of "TruxtonFileIO tag"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This creates a tag associated with this file in Truxton. =Syntax= <syntaxhighlight lang="Python"> bool tag(tag, reason); </syntaxhighlight> =Return value= [https://docs.pyth...")
 
 
(4 intermediate revisions by the same user not shown)
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);
+
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:_str.2C_description:_str.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:_str.2C_description:_str.29|createtag()]]</code> function.
  
 
=Sample=
 
=Sample=
 
+
<source lang="Python" highlight="7">
<syntaxhighlight lang="Python" highlight="7">
 
 
import truxton
 
import truxton
  
Line 18: Line 33:
 
   file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
 
   file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
  
   file.tag("Bomb", "Contains references to TNT")
+
   file.tag("Bomb", "Contains references to TNT", truxton.TAG_ORIGIN_HUMAN)
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
   main()
+
   sys.exit(main())
</syntaxhighlight>
+
</source>

Latest revision as of 10:07, 3 February 2024

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__":
  sys.exit(main())