|
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< Node > | ConnectAndSetupAsync (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.
|
|
◆ 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
-
archive | The ZipArchive to which the text will be added. |
entryName | The name of the entry to be created in the ZipArchive. |
text | The 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.
◆ BytesToLong()
static long xeno_rat_server.Utils.BytesToLong |
( |
byte[] | data, |
|
|
int | offset = 0 ) |
|
inlinestatic |
Converts a byte array to a long integer.
- Parameters
-
data | The byte array to be converted. |
offset | The 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.
◆ 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
-
input | The 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.
◆ 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
-
sock | The socket to connect to. |
key | The byte array key used for setup. |
ID | The ID used for authentication. |
OnDisconnect | An optional action to be performed on disconnection. |
- Exceptions
-
Exception | Thrown 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.
◆ 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
-
clientsubsock | The node where the DLL will be loaded. |
dllname | The name of the DLL to be loaded. |
dll | The byte array representing the DLL to be loaded. |
Logcallback | An optional callback function for logging messages. |
- Returns
- A boolean value indicating whether the DLL was loaded successfully.
- Exceptions
-
Exception | Thrown when an error occurs during the DLL loading process. |
◆ LongToBytes()
static byte[] xeno_rat_server.Utils.LongToBytes |
( |
long | data | ) |
|
|
inlinestatic |
Converts a long integer to an array of bytes.
- Parameters
-
data | The 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
-
subnode | The 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.
◆ 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
-
subNode | The node to which the byte array with opcode 3 will be sent. |
- Exceptions
-
ArgumentNullException | Thrown 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.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/xeno rat server/Utils.cs