Xeno-rat
Loading...
Searching...
No Matches
InfoGrab.SQLiteHandler Class Reference
Collaboration diagram for InfoGrab.SQLiteHandler:

Classes

struct  record_header_field
 
struct  sqlite_master_entry
 
struct  table_entry
 

Public Member Functions

 SQLiteHandler (string baseName)
 
int GetRowCount ()
 Gets the number of rows in the table.
 
string[] GetTableNames ()
 Retrieves the names of tables from the master table entries and returns an array of strings.
 
string GetValue (int row_num, int field)
 Retrieves the value at the specified row and field.
 
string GetValue (int row_num, string field)
 
bool ReadTable (string TableName)
 Reads the specified table and returns a boolean indicating success or failure.
 

Private Member Functions

ulong ConvertToInteger (int startIndex, int Size)
 Converts a sequence of bytes to an unsigned integer.
 
long CVL (int startIndex, int endIndex)
 Converts a range of bytes to a long integer and returns the result.
 
int GVL (int startIndex)
 Returns the index of the first non-128 byte in the array starting from the specified index.
 
bool IsOdd (long value)
 Determines if the given value is odd.
 
void ReadMasterTable (ulong Offset)
 Reads the master table from the specified offset.
 
bool ReadTableFromOffset (ulong Offset)
 Reads a table from the specified offset and populates the table entries.
 

Private Attributes

byte[] db_bytes
 
ulong encoding
 
string[] field_names
 
SQLiteHandler.sqlite_master_entry[] master_table_entries
 
ushort page_size
 
byte[] SQLDataTypeSize
 
SQLiteHandler.table_entry[] table_entries
 

Constructor & Destructor Documentation

◆ SQLiteHandler()

InfoGrab.SQLiteHandler.SQLiteHandler ( string baseName)
inline
Here is the call graph for this function:

Member Function Documentation

◆ ConvertToInteger()

ulong InfoGrab.SQLiteHandler.ConvertToInteger ( int startIndex,
int Size )
inlineprivate

Converts a sequence of bytes to an unsigned integer.

Parameters
startIndexThe starting index of the byte sequence.
SizeThe number of bytes to be converted.
Returns
The unsigned integer value converted from the byte sequence.

This method converts a sequence of bytes starting from the specified startIndex to an unsigned integer value. If the Size is greater than 8 or equal to 0, the method returns 0. The conversion is performed by bitwise shifting and OR operations to combine the bytes into an unsigned integer value.

Here is the caller graph for this function:

◆ CVL()

long InfoGrab.SQLiteHandler.CVL ( int startIndex,
int endIndex )
inlineprivate

Converts a range of bytes to a long integer and returns the result.

Parameters
startIndexThe starting index of the byte range.
endIndexThe ending index of the byte range.
Returns
The long integer value converted from the specified byte range.

This method converts a range of bytes from the startIndex to endIndex (inclusive) to a long integer value. It handles different cases based on the number of bytes in the range and modifies the byte array accordingly. If the number of bytes is 0 or greater than 9, the method returns 0. If there is only one byte in the range, it extracts the value and returns it as a long integer. If there are 9 bytes in the range, it handles a special case and sets a flag. The method then processes the bytes and performs bitwise operations to construct the long integer value. The resulting long integer value is returned.

Here is the caller graph for this function:

◆ GetRowCount()

int InfoGrab.SQLiteHandler.GetRowCount ( )
inline

Gets the number of rows in the table.

Returns
The number of rows in the table.
Here is the caller graph for this function:

◆ GetTableNames()

string[] InfoGrab.SQLiteHandler.GetTableNames ( )
inline

Retrieves the names of tables from the master table entries and returns an array of strings.

Returns
An array of strings containing the names of tables from the master table entries.

This method iterates through the master table entries and retrieves the names of tables. It then stores the names in an array of strings and returns the array.

◆ GetValue() [1/2]

string InfoGrab.SQLiteHandler.GetValue ( int row_num,
int field )
inline

Retrieves the value at the specified row and field.

Parameters
row_numThe row number.
fieldThe field name.
Returns
The value at the specified row_num and field .

This method retrieves the value at the specified row_num and field from the internal data structure. If the specified field is not found, it returns null.

Here is the caller graph for this function:

◆ GetValue() [2/2]

string InfoGrab.SQLiteHandler.GetValue ( int row_num,
string field )
inline
Here is the call graph for this function:

◆ GVL()

int InfoGrab.SQLiteHandler.GVL ( int startIndex)
inlineprivate

Returns the index of the first non-128 byte in the array starting from the specified index.

Parameters
startIndexThe starting index in the array.
Returns
The index of the first non-128 byte in the array starting from startIndex .

This method returns the index of the first non-128 byte in the array starting from the specified index. If the startIndex is greater than the length of the array, it returns 0. If no non-128 byte is found within the next 8 bytes from the startIndex , it returns startIndex + 8.

Here is the caller graph for this function:

◆ IsOdd()

bool InfoGrab.SQLiteHandler.IsOdd ( long value)
inlineprivate

Determines if the given value is odd.

Parameters
valueThe value to be checked for oddity.
Returns
True if the value is odd; otherwise, false.
Here is the caller graph for this function:

◆ ReadMasterTable()

void InfoGrab.SQLiteHandler.ReadMasterTable ( ulong Offset)
inlineprivate

Reads the master table from the specified offset.

Parameters
OffsetThe offset from which to read the master table.

This method reads the master table from the specified offset in the database file. It processes the data according to the SQLite file format specifications and populates the master_table_entries array with the retrieved information. The method handles different encodings for reading the item type, item name, and SQL statement from the database bytes. If the byte at the specified offset is 13, it reads the master table entries and populates the master_table_entries array. If the byte at the specified offset is 5, it recursively calls the ReadMasterTable method to read the master table entries from the specified offsets within the database file.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadTable()

bool InfoGrab.SQLiteHandler.ReadTable ( string TableName)
inline

Reads the specified table and returns a boolean indicating success or failure.

Parameters
TableNameThe name of the table to be read.
Returns
True if the table was successfully read; otherwise, false.

This method searches for the specified table name in the master table entries and retrieves the SQL statement associated with it. It then extracts the field names from the SQL statement and populates the field_names array. If the table is found and the fields are successfully extracted, it calls the ReadTableFromOffset method to read the table data from the specified offset.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadTableFromOffset()

bool InfoGrab.SQLiteHandler.ReadTableFromOffset ( ulong Offset)
inlineprivate

Reads a table from the specified offset and populates the table entries.

Parameters
OffsetThe offset from which to read the table.
Returns
True if the table is successfully read and populated; otherwise, false.

This method reads a table from the specified offset in the database file and populates the table entries. It handles different types of data encoding and modifies the table entries in place.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ db_bytes

byte [] InfoGrab.SQLiteHandler.db_bytes
private

◆ encoding

ulong InfoGrab.SQLiteHandler.encoding
private

◆ field_names

string [] InfoGrab.SQLiteHandler.field_names
private

◆ master_table_entries

SQLiteHandler.sqlite_master_entry [] InfoGrab.SQLiteHandler.master_table_entries
private

◆ page_size

ushort InfoGrab.SQLiteHandler.page_size
private

◆ SQLDataTypeSize

byte [] InfoGrab.SQLiteHandler.SQLDataTypeSize
private
Initial value:
= new byte[]
{
0,
1,
2,
3,
4,
6,
8,
8,
0,
0
}

◆ table_entries

SQLiteHandler.table_entry [] InfoGrab.SQLiteHandler.table_entries
private

The documentation for this class was generated from the following file: