Truxton enumeration get scope

From truxwiki.com
Revision as of 05:39, 22 May 2023 by Sam (talk | contribs) (Created page with "Retrieves the next item in the enumeration. =Syntax= <source lang="C"> uint64_t truxton_enumeration_get_scope( uint64_t enumeration_handle ); </source> =Parameters= ==<code>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Retrieves the next item in the enumeration.

Syntax

uint64_t truxton_enumeration_get_scope( uint64_t enumeration_handle );

Parameters

enumeration_handle

The handle returned by calling truxton_enumeration_create().

Return value

The scope of the enumeration.

Sample

void print_details( uint64_t enumerator )
{
   char uuid[40];

   uint64_t scope = truxton_enumeration_get_scope( enumerator );
   uint64_t target = truxton_enumeration_get_target( enumerator );

   truxton_enumeration_get_scope_id( enumerator, uuid, sizeof( uuid ) );

   printf( "%" PRIu64 " - %s - %" PRIu64 "\n", scope, scope_id, target );
}

void main()
{
    char investigation_name[256];

    truxton_start();

    uint64_t truxton = truxton_create();

    uint64_t enumerator = truxton_enumeration_create( truxton );

    truxton_enumeration_set_target( enumerator, Type_Investigation );

    uint64_t investigation_handle = truxton_enumeration_get_next( enumerator );

    uint64_t count = 0;

    print_details( enumerator );

    while( investigation_handle != 0 )
    {
        count++ 
        investigation_handle = truxton_enumeration_get_next( enumerator );
    }

    printf( "%" PRIu64 " investigations\n", count );

    truxton_enumeration_destroy( enumerator );
    truxton_destroy( truxton );
    truxton_stop();
}