Xeno-rat
Loading...
Searching...
No Matches
xeno_rat_server.Utils Class Reference
Collaboration diagram for xeno_rat_server.Utils:

Static Public Member Functions

static long BytesToLong (byte[] data, int offset=0)
 Converts a byte array to a long integer.
 
static byte[] LongToBytes (long data)
 Converts a long integer to an array of bytes.
 
static async Task< bool > LoadDllAsync (Node clientsubsock, string dllname, byte[] dll, Action< string, Color > Logcallback=null)
 Asynchronously loads a DLL into the specified node and returns a boolean indicating the success of the operation.
 
static byte[] CalculateSha256Bytes (string input)
 Computes the SHA-256 hash value for the input string and returns the result as an array of bytes.
 
static void AddTextToZip (ZipArchive archive, string entryName, string text)
 Adds text to a ZipArchive entry with the specified name.
 
static async Task< int > SetType2setIdAsync (Node subnode)
 Asynchronously sets the ID for type 2 node and returns the set ID.
 
static async Task Type2returnAsync (Node subNode)
 Sends a byte array with opcode 3 to the specified subNode if the SockType is 2.
 
static async Task< NodeConnectAndSetupAsync (Socket sock, byte[] key, int ID, Action< Node > OnDisconnect=null)
 Connects to a socket, sets up a node using the provided key and ID, and returns the node.
 

Member Function Documentation

◆ AddTextToZip()

static void xeno_rat_server.Utils.AddTextToZip ( ZipArchive archive,
string entryName,
string text )
inlinestatic

Adds text to a ZipArchive entry with the specified name.

Parameters
archiveThe ZipArchive to which the text will be added.
entryNameThe name of the entry to be created in the ZipArchive.
textThe text to be written to the ZipArchive entry.

This method creates a new entry with the specified name in the ZipArchive and writes the provided text to it using UTF-8 encoding.

Here is the caller graph for this function:

◆ BytesToLong()

static long xeno_rat_server.Utils.BytesToLong ( byte[] data,
int offset = 0 )
inlinestatic

Converts a byte array to a long integer.

Parameters
dataThe byte array to be converted.
offsetThe zero-based byte offset in data at which to begin converting.
Returns
The long integer converted from the specified byte array starting at the specified offset.

This method converts a byte array to a long integer, taking into account the endianness of the system. If the system is little-endian, the bytes are combined in little-endian order; otherwise, they are combined in big-endian order.

Here is the caller graph for this function:

◆ CalculateSha256Bytes()

static byte[] xeno_rat_server.Utils.CalculateSha256Bytes ( string input)
inlinestatic

Computes the SHA-256 hash value for the input string and returns the result as an array of bytes.

Parameters
inputThe input string for which the SHA-256 hash is to be computed.
Returns
The SHA-256 hash value of the input string as an array of bytes.

This method uses the SHA256 algorithm to compute the hash value of the input string. The input string is first converted to an array of bytes using UTF-8 encoding. The SHA-256 algorithm is then applied to the input bytes to compute the hash value, which is returned as an array of bytes.

Here is the caller graph for this function:

◆ ConnectAndSetupAsync()

static async Task< Node > xeno_rat_server.Utils.ConnectAndSetupAsync ( Socket sock,
byte[] key,
int ID,
Action< Node > OnDisconnect = null )
inlinestatic

Connects to a socket, sets up a node using the provided key and ID, and returns the node.

Parameters
sockThe socket to connect to.
keyThe byte array key used for setup.
IDThe ID used for authentication.
OnDisconnectAn optional action to be performed on disconnection.
Exceptions
ExceptionThrown when an error occurs during the connection and setup process.
Returns
A node representing the connection and setup, or null if the authentication fails or an error occurs.

This method asynchronously connects to the provided socket, creates a new node using the socket handler and key, and authenticates using the provided ID. If the authentication fails, null is returned. An optional action can be provided to be performed on disconnection.

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

◆ LoadDllAsync()

static async Task< bool > xeno_rat_server.Utils.LoadDllAsync ( Node clientsubsock,
string dllname,
byte[] dll,
Action< string, Color > Logcallback = null )
inlinestatic

Asynchronously loads a DLL into the specified node and returns a boolean indicating the success of the operation.

Parameters
clientsubsockThe node where the DLL will be loaded.
dllnameThe name of the DLL to be loaded.
dllThe byte array representing the DLL to be loaded.
LogcallbackAn optional callback function for logging messages.
Returns
A boolean value indicating whether the DLL was loaded successfully.
Exceptions
ExceptionThrown when an error occurs during the DLL loading process.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LongToBytes()

static byte[] xeno_rat_server.Utils.LongToBytes ( long data)
inlinestatic

Converts a long integer to an array of bytes.

Parameters
dataThe long integer to be converted.
Returns
An array of bytes representing the input data .

This method converts the input long integer data into an array of bytes. The method first checks the endianness of the system using BitConverter.IsLittleEndian. If the system is little-endian, the method populates the byte array bytes with the bytes of the input long integer in little-endian order. If the system is big-endian, the method populates the byte array with the bytes of the input long integer in big-endian order.

◆ SetType2setIdAsync()

static async Task< int > xeno_rat_server.Utils.SetType2setIdAsync ( Node subnode)
inlinestatic

Asynchronously sets the ID for type 2 node and returns the set ID.

Parameters
subnodeThe node for which the ID needs to be set.
Returns
The set ID for the type 2 node.

This method sets the ID for a type 2 node by incrementing the SubNodeIdCount of its parent node and sending the set ID to the subnode using asynchronous operations. If the subnode's SockType is not 2, it returns -1.

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

◆ Type2returnAsync()

static async Task xeno_rat_server.Utils.Type2returnAsync ( Node subNode)
inlinestatic

Sends a byte array with opcode 3 to the specified subNode if the SockType is 2.

Parameters
subNodeThe node to which the byte array with opcode 3 will be sent.
Exceptions
ArgumentNullExceptionThrown when the subNode is null.
Returns
An asynchronous task representing the sending of the byte array with opcode 3 to the subNode.

This method sends a byte array with opcode 3 to the specified subNode if the SockType property of the subNode is equal to 2. The method uses asynchronous programming to send the byte array and awaits the completion of the operation.

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

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