Difference between revisions of "Truxton child file create url"

From truxwiki.com
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
This creates a website visit object sourced from this file that you can use in the [[Truxton C API#Website Visit | Website Visit API.]]
 
This creates a website visit object sourced from this file that you can use in the [[Truxton C API#Website Visit | Website Visit API.]]
A URL object is how you add records to the <code>[[WebsiteVisit Table | WebsiteVisit]]</code> table.
+
A URL object is how you add records to the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table.
 
The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.
 
The resulting 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_url( uint64_t child_handle );
 
uint64_t truxton_child_file_create_url( 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.
  
Line 17: Line 16:
  
 
=Sample=
 
=Sample=
 
+
<source lang="C" highlight="21">
<syntaxhighlight lang="C" highlight="21">
+
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" );
 
   }
 
   }
  
   uint64_t url = truxton_child_file_create_url(child);
+
   uint64_t url = truxton_child_file_create_url( child );
  
   truxton_url_set_url(url, "https://truxtonforensics.com/");
+
   truxton_url_set_url( url, "https://truxtonforensics.com/" );
   truxton_url_set_method(url, URL_METHOD_TYPE_USER_FOLLOWED_A_BOOKMARK);
+
   truxton_url_set_method( url, URL_METHOD_TYPE_USER_FOLLOWED_A_BOOKMARK );
   truxton_url_set_type(url, URL_TYPE_OPERA);
+
   truxton_url_set_type( url, URL_TYPE_OPERA );
   truxton_url_set_when(url, truxton_file_get_modified( parent_file ) );
+
   truxton_url_set_when( url, truxton_file_get_modified( parent_file ) );
   truxton_url_save(url);
+
   truxton_url_save( url );
   truxton_url_destroy(url);
+
   truxton_url_destroy( url );
  
   truxton_child_file_destroy(child);
+
   truxton_child_file_destroy( child );
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 04:28, 13 February 2021

This creates a website visit object sourced from this file that you can use in the Website Visit API. A URL object is how you add records to the [WebsiteVisit] table. The resulting 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_url( 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 website visit 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 url = truxton_child_file_create_url( child );

   truxton_url_set_url( url, "https://truxtonforensics.com/" );
   truxton_url_set_method( url, URL_METHOD_TYPE_USER_FOLLOWED_A_BOOKMARK );
   truxton_url_set_type( url, URL_TYPE_OPERA );
   truxton_url_set_when( url, truxton_file_get_modified( parent_file ) );
   truxton_url_save( url );
   truxton_url_destroy( url );

   truxton_child_file_destroy( child );
}