|
| Node (SocketHandler _sock, Action< Node > _OnDisconnect) |
|
void | AddSubNode (Node subNode) |
| Adds a sub-node to the current node.
|
|
async void | Disconnect () |
| Disconnects the current socket and clears the subNodes list, and invokes the OnDisconnect event if it is not null.
|
|
async Task< Node > | ConnectSubSockAsync (int type, int retid, Action< Node > OnDisconnect=null) |
| Asynchronously connects a sub socket and sets up the connection with the specified parameters.
|
|
bool | Connected () |
| Checks if the socket is connected and returns a boolean value indicating the connection status.
|
|
async Task< byte[]> | ReceiveAsync () |
| Asynchronously receives data from the socket and returns the received data as a byte array.
|
|
async Task< bool > | SendAsync (byte[] data) |
| Asynchronously sends the specified data over the socket connection.
|
|
void | SetRecvTimeout (int ms) |
| Sets the receive timeout for the socket.
|
|
void | ResetRecvTimeout () |
| Resets the receive timeout for the socket.
|
|
async Task< bool > | AuthenticateAsync (int type, int id=0) |
| Authenticates the connection based on the specified type and optional ID.
|
|
|
static int | memcmp (byte[] b1, byte[] b2, long count) |
| Compares two byte arrays and returns an integer that indicates their relationship in terms of order.
|
|
bool | ByteArrayCompare (byte[] b1, byte[] b2) |
| Compares two byte arrays and returns true if they are equal, otherwise returns false.
|
|
◆ Node()
◆ AddSubNode()
void xeno_rat_client.Node.AddSubNode |
( |
Node | subNode | ) |
|
|
inline |
Adds a sub-node to the current node.
- Parameters
-
subNode | The sub-node to be added. |
This method adds the specified sub-node to the list of sub-nodes associated with the current node.
◆ AuthenticateAsync()
async Task< bool > xeno_rat_client.Node.AuthenticateAsync |
( |
int | type, |
|
|
int | id = 0 ) |
|
inline |
Authenticates the connection based on the specified type and optional ID.
- Parameters
-
type | The type of authentication. 0 for main, 1 for heartbeat, 2 for anything else. |
id | The optional ID for authentication. Defaults to 0. |
- Returns
- A boolean value indicating whether the authentication was successful.
This method asynchronously authenticates the connection based on the specified type and optional ID. It sets a receive timeout of 5000 milliseconds, receives data from the socket, sends the received data back, and resets the receive timeout. If the received data matches a predefined byte array, it further processes the authentication based on the type. If the type is 0, it receives data from the socket to obtain a connection ID and sets the ID property. If the type is not 0, it sets the ID property with the specified ID and sends the ID back to the socket. The method returns true if the authentication is successful; otherwise, it returns false.
◆ ByteArrayCompare()
bool xeno_rat_client.Node.ByteArrayCompare |
( |
byte[] | b1, |
|
|
byte[] | b2 ) |
|
inlineprivate |
Compares two byte arrays and returns true if they are equal, otherwise returns false.
- Parameters
-
b1 | The first byte array to be compared. |
b2 | The second byte array to be compared. |
- Returns
- True if the byte arrays are equal in length and content, otherwise false.
◆ Connected()
bool xeno_rat_client.Node.Connected |
( |
| ) |
|
|
inline |
Checks if the socket is connected and returns a boolean value indicating the connection status.
- Returns
- True if the socket is connected; otherwise, false.
This method checks the connection status of the socket and returns a boolean value indicating whether the socket is connected or not. If an exception occurs during the check, the method returns false.
◆ ConnectSubSockAsync()
async Task< Node > xeno_rat_client.Node.ConnectSubSockAsync |
( |
int | type, |
|
|
int | retid, |
|
|
Action< Node > | OnDisconnect = null ) |
|
inline |
Asynchronously connects a sub socket and sets up the connection with the specified parameters.
- Parameters
-
type | The type of the socket connection. |
retid | The return ID for the connection. |
OnDisconnect | An optional action to be performed on disconnection. |
- Returns
- A Node representing the connected sub socket.
This method creates a new socket with the specified address family, socket type, and protocol type. It then asynchronously connects to the remote endpoint of the socket. After successful connection, it sets up the connection using the Utils.ConnectAndSetupAsync method with the provided encryption key, type, and ID. It then sends the return ID to the connected sub socket and returns the sub socket. If an exception occurs during the process, a byte array with value 0 is sent asynchronously and null is returned.
- Exceptions
-
Exception | Thrown if an error occurs during the connection and setup process. |
◆ Disconnect()
async void xeno_rat_client.Node.Disconnect |
( |
| ) |
|
|
inline |
Disconnects the current socket and clears the subNodes list, and invokes the OnDisconnect event if it is not null.
This method asynchronously disconnects the current socket using Task.Factory.FromAsync method, and then clears the subNodes list and disconnects each subNode recursively. If an exception occurs during the disconnection process, the socket is closed and disposed.
◆ memcmp()
static int xeno_rat_client.Node.memcmp |
( |
byte[] | b1, |
|
|
byte[] | b2, |
|
|
long | count ) |
|
private |
Compares two byte arrays and returns an integer that indicates their relationship in terms of order.
- Parameters
-
b1 | The first byte array to be compared. |
b2 | The second byte array to be compared. |
count | The number of bytes to compare. |
- Returns
- An integer that indicates the relationship between the two byte arrays. Returns 0 if the contents of the arrays are equal, a value less than 0 if the first differing byte in b1 is less than the corresponding byte in b2, and a value greater than 0 if the first differing byte in b1 is greater than the corresponding byte in b2.
◆ ReceiveAsync()
async Task< byte[]> xeno_rat_client.Node.ReceiveAsync |
( |
| ) |
|
|
inline |
Asynchronously receives data from the socket and returns the received data as a byte array.
- Returns
- The received data as a byte array. Returns null if the received data is null, and disconnects the socket.
- Exceptions
-
Exception | Thrown when there is an issue with receiving data from the socket. |
This method asynchronously receives data from the socket using the ReceiveAsync method and returns the received data as a byte array. If the received data is null, the method disconnects the socket and returns null.
◆ ResetRecvTimeout()
void xeno_rat_client.Node.ResetRecvTimeout |
( |
| ) |
|
|
inline |
Resets the receive timeout for the socket.
This method resets the receive timeout for the underlying socket to the default value.
◆ SendAsync()
async Task< bool > xeno_rat_client.Node.SendAsync |
( |
byte[] | data | ) |
|
|
inline |
Asynchronously sends the specified data over the socket connection.
- Parameters
-
data | The byte array containing the data to be sent. |
- Returns
- A Task<TResult> representing the asynchronous operation. The task result is
true
if the data was sent successfully; otherwise, false
.
- Exceptions
-
SocketException | Thrown when an error occurs during the socket operation. |
◆ SetRecvTimeout()
void xeno_rat_client.Node.SetRecvTimeout |
( |
int | ms | ) |
|
|
inline |
Sets the receive timeout for the socket.
- Parameters
-
ms | The receive timeout value in milliseconds. |
This method sets the receive timeout for the underlying socket to the specified value in milliseconds. A receive timeout value of 0 indicates an infinite timeout.
◆ ID
int xeno_rat_client.Node.ID = -1 |
◆ OnDisconnect
Action<Node> xeno_rat_client.Node.OnDisconnect |
|
private |
◆ Parent
Node xeno_rat_client.Node.Parent |
◆ SetId
int xeno_rat_client.Node.SetId = -1 |
◆ sock
◆ SockType
int xeno_rat_client.Node.SockType = -1 |
◆ subNodes
List<Node> xeno_rat_client.Node.subNodes = new List<Node>() |
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/xeno rat client/Node.cs