Difference between revisions of "Truxton child file create event"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This creates an avent from this file that you can use in the Event API. An artifact object is how you add records to the <code>[[Event Table | Event]...")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
This creates an avent from this file that you can use in the [[Truxton C API#Event | Event API.]]
+
This creates an event from this file that you can use in the [[Truxton C API#Event | Event API.]]
An artifact object is how you add records to the <code>[[Event Table | Event]]</code> table.
+
An event object is how you add records to the <code><nowiki>[</nowiki>[[Event Table|Event]]<nowiki>]</nowiki></code> table.
 
The resulting event object will automatically be associated with the file it was created from and with the media the file belongs to.
 
The resulting event object will automatically be associated with the file it was created from and with the media the file belongs to.
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
 
uint64_t truxton_child_file_create_event( uint64_t child_handle );
 
uint64_t truxton_child_file_create_event( uint64_t child_handle );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
 
==<code>child_handle</code>==
 
==<code>child_handle</code>==
 
 
The handle created by the [[truxton_child_file_create]] or [[truxton_file_create_child]] call.
 
The handle created by the [[truxton_child_file_create]] or [[truxton_file_create_child]] call.
  
 
=Return value=
 
=Return value=
 
A handle to an event object.
 
A handle to an event object.
 +
 
=Sample=
 
=Sample=
 
+
<source lang="C" highlight="21">
<syntaxhighlight lang="C" highlight="26">
+
void add_folder( uint64_t truxton, uint64_t parent_file )
void add_folder(uint64_t truxton, uint64_t parent_file)
 
 
{
 
{
   truxton_start_adding_files(truxton);
+
   truxton_start_adding_files( truxton );
  
   uint64_t child = truxton_child_file_create(truxton);
+
   uint64_t child = truxton_child_file_create( truxton );
  
 
   char id[40];
 
   char id[40];
  
   truxton_file_get_id(parent_file, id, sizeof(id));
+
   truxton_file_get_id( parent_file, id, sizeof(id) );
   truxton_child_file_set_parent_id(child, id);
+
   truxton_child_file_set_parent_id( child, id );
   truxton_child_file_set_type(child, Type_Directory);
+
   truxton_child_file_set_type( child, Type_Directory );
   truxton_child_file_set_name(child, "Custom Exploits Folder");
+
   truxton_child_file_set_name( child, "Custom Exploits Folder" );
  
   truxton_child_file_set_origin(child, ORIGIN_GENERATED);
+
   truxton_child_file_set_origin( child, ORIGIN_GENERATED );
  
   if ( truxton_child_file_save(child) == 0 )
+
   if ( truxton_child_file_save( child ) == 0 )
 
   {
 
   {
 
       printf( "Failed to add child to Truxton\n" );
 
       printf( "Failed to add child to Truxton\n" );
  }
 
  else
 
  {
 
      ticks.QuadPart = truxton_child_file_get_disk_offset(child_file);
 
      printf( "Physical Disk Offset was %d\n", ticks.QuadPart );
 
 
   }
 
   }
  
   uint64_t event = truxton_child_file_create_event(child);
+
   uint64_t event = truxton_child_file_create_event( child );
  
   truxton_event_set_type(event, EVENT_TYPE_POSSIBLE_INFECTION);
+
   truxton_event_set_type( event, EVENT_TYPE_POSSIBLE_INFECTION );
   truxton_event_set_start(artifact, truxton_file_get_created( parent_file ) );
+
   truxton_event_set_start( event, truxton_file_get_created( parent_file ) );
   truxton_event_set_end(event, truxton_file_get_modified( parent_file ) );
+
   truxton_event_set_end( event, truxton_file_get_modified( parent_file ) );
   truxton_event_set_title(event, "Fancy Bear Panda Hurricane" );
+
   truxton_event_set_title( event, "Fancy Bear Panda Hurricane" );
   truxton_event_set_description(event, "Russian Malware repurposed by Chinese military used in FBI investigation" );
+
   truxton_event_set_description( event, "Russian Malware repurposed by Chinese military used in FBI investigation" );
   truxton_event_save(event);
+
   truxton_event_save( event );
 +
  truxton_event_destroy( event );
  
   truxton_child_file_destroy(child);
+
   truxton_child_file_destroy( child );
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 04:20, 13 February 2021

This creates an event from this file that you can use in the Event API. An event object is how you add records to the [Event] table. The resulting event object will automatically be associated with the file it was created from and with the media the file belongs to.

Syntax

uint64_t truxton_child_file_create_event( uint64_t child_handle );

Parameters

child_handle

The handle created by the truxton_child_file_create or truxton_file_create_child call.

Return value

A handle to an event object.

Sample

void add_folder( uint64_t truxton, uint64_t parent_file )
{
   truxton_start_adding_files( truxton );

   uint64_t child = truxton_child_file_create( truxton );

   char id[40];

   truxton_file_get_id( parent_file, id, sizeof(id) );
   truxton_child_file_set_parent_id( child, id );
   truxton_child_file_set_type( child, Type_Directory );
   truxton_child_file_set_name( child, "Custom Exploits Folder" );

   truxton_child_file_set_origin( child, ORIGIN_GENERATED );

   if ( truxton_child_file_save( child ) == 0 )
   {
      printf( "Failed to add child to Truxton\n" );
   }

   uint64_t event = truxton_child_file_create_event( child );

   truxton_event_set_type( event, EVENT_TYPE_POSSIBLE_INFECTION );
   truxton_event_set_start( event, truxton_file_get_created( parent_file ) );
   truxton_event_set_end( event, truxton_file_get_modified( parent_file ) );
   truxton_event_set_title( event, "Fancy Bear Panda Hurricane" );
   truxton_event_set_description( event, "Russian Malware repurposed by Chinese military used in FBI investigation" );
   truxton_event_save( event );
   truxton_event_destroy( event );

   truxton_child_file_destroy( child );
}