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

Classes

struct  LASTINPUTINFO
 

Static Public Member Functions

static async Task< string > GetCaptionOfActiveWindowAsync ()
 Retrieves the caption of the active window asynchronously.
 
static string GetCaptionOfActiveWindow ()
 Retrieves the caption of the active window.
 
static bool IsAdmin ()
 Checks if the current user is an admin and returns a boolean value indicating the result.
 
static string GetAntivirus ()
 Retrieves the installed antivirus products on the local machine and returns a comma-separated list of the product names.
 
static string GetWindowsVersion ()
 Retrieves the Windows version and architecture information.
 
static string HWID ()
 Generates a unique hardware identifier (HWID) based on various system parameters.
 
static string GetHash (string strToHash)
 Computes the MD5 hash of the input string and returns the first 20 characters in uppercase.
 
static async Task< NodeConnectAndSetupAsync (Socket sock, byte[] key, int type=0, int ID=0, Action< Node > OnDisconnect=null)
 Connects to a socket, sets up a node, and authenticates it asynchronously.
 
static async Task RemoveStartup (string executablePath)
 Removes any startup entries related to the specified executable path.
 
static async Task Uninstall ()
 Uninstalls the application by removing it from startup, executing a command to delete the application file, and then terminating the current process.
 
static async Task< bool > AddToStartupNonAdmin (string executablePath, string name="XenoUpdateManager")
 Adds the specified executable to the current user's startup registry without requiring admin privileges.
 
static async Task< bool > AddToStartupAdmin (string executablePath, string name="XenoUpdateManager")
 Adds the specified executable to the Windows startup for all users and returns a boolean indicating whether the operation was successful.
 
static async Task< uint > GetIdleTimeAsync ()
 Asynchronously retrieves the system's idle time in milliseconds.
 
static uint GetIdleTime ()
 Retrieves the number of milliseconds that have elapsed since the last input event (keyboard or mouse) was received.
 

Private Member Functions

static bool IsUserAnAdmin ()
 Determines whether the current user is a member of the administrator group.
 
static IntPtr GetForegroundWindow ()
 Retrieves a handle to the foreground window (the window with which the user is currently working).
 
static int GetWindowText (IntPtr hWnd, StringBuilder text, int count)
 Retrieves the text of the specified window's title bar, if it has one.
 
static int GetWindowTextLength (IntPtr hWnd)
 Retrieves the length, in characters, of the specified window's title bar text (if it has one). If the specified window is a control, the function retrieves the length of the text within the control.
 
static IntPtr GetWindowThreadProcessId (IntPtr hWnd, out uint ProcessId)
 Retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
 
static bool GetLastInputInfo (ref LASTINPUTINFO plii)
 Retrieves the time of the last input event.
 
static bool CloseHandle (IntPtr hObject)
 Closes an open object handle.
 

Member Function Documentation

◆ AddToStartupAdmin()

static async Task< bool > xeno_rat_client.Utils.AddToStartupAdmin ( string executablePath,
string name = "XenoUpdateManager" )
inlinestatic

Adds the specified executable to the Windows startup for all users and returns a boolean indicating whether the operation was successful.

Parameters
executablePathThe full path to the executable file to be added to the startup.
nameThe name of the task to be created in the Windows Task Scheduler. Default is "XenoUpdateManager".
Returns
A System.Boolean value indicating whether the operation was successful. Returns true if the task was created successfully; otherwise, false.
Exceptions
System.ExceptionThrown if an error occurs while attempting to add the task to the Windows Task Scheduler.
Here is the caller graph for this function:

◆ AddToStartupNonAdmin()

static async Task< bool > xeno_rat_client.Utils.AddToStartupNonAdmin ( string executablePath,
string name = "XenoUpdateManager" )
inlinestatic

Adds the specified executable to the current user's startup registry without requiring admin privileges.

Parameters
executablePathThe full path to the executable file to be added to the startup.
nameThe name under which the executable will be added to the startup (default is "XenoUpdateManager").
Returns
A Task<TResult> representing the asynchronous operation. The task result is true if the operation was successful; otherwise, false.
Exceptions
System.Security.SecurityExceptionThrown when the user does not have permission to access the registry key.
Here is the caller graph for this function:

◆ CloseHandle()

static bool xeno_rat_client.Utils.CloseHandle ( IntPtr hObject)
private

Closes an open object handle.

Parameters
hObjectA handle to an open object.
Returns
True if the function succeeds, false if it fails.

This method closes an open object handle. If the function succeeds, the return value is true. If the function fails, the return value is false.

◆ ConnectAndSetupAsync()

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

Connects to a socket, sets up a node, and authenticates it asynchronously.

Parameters
sockThe socket to connect to.
keyThe byte array key for authentication.
typeThe type of authentication (default is 0).
IDThe ID for authentication (default is 0).
OnDisconnectAn action to be performed on disconnection (default is null).
Returns
An authenticated node if successful; otherwise, null.

This method connects to the specified socket, creates a new node with the provided socket handler and disconnection action. It then attempts to authenticate the node asynchronously with the specified type and ID. If the authentication is successful, the authenticated node is returned; otherwise, null is returned.

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

◆ GetAntivirus()

static string xeno_rat_client.Utils.GetAntivirus ( )
inlinestatic

Retrieves the installed antivirus products on the local machine and returns a comma-separated list of the product names.

Returns
A comma-separated string containing the names of the installed antivirus products. If no antivirus products are found, "N/A" is returned.
Exceptions
System.ExceptionAn exception may be thrown if there is an issue retrieving the antivirus products.
Here is the caller graph for this function:

◆ GetCaptionOfActiveWindow()

static string xeno_rat_client.Utils.GetCaptionOfActiveWindow ( )
inlinestatic

Retrieves the caption of the active window.

Returns
The caption of the active window.

This method retrieves the caption of the active window by obtaining the handle of the foreground window and using it to get the window text. It then retrieves the process ID associated with the window handle and uses it to get the process information, which is used to construct the caption. If the window title is empty, only the process name is used as the caption; otherwise, the process name is appended with the window title.

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

◆ GetCaptionOfActiveWindowAsync()

static async Task< string > xeno_rat_client.Utils.GetCaptionOfActiveWindowAsync ( )
inlinestatic

Retrieves the caption of the active window asynchronously.

Returns
A Task<TResult> representing the asynchronous operation. The task result contains the caption of the active window.

This method asynchronously retrieves the caption of the active window by executing the GetCaptionOfActiveWindow method within a separate task.

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

◆ GetForegroundWindow()

static IntPtr xeno_rat_client.Utils.GetForegroundWindow ( )
private

Retrieves a handle to the foreground window (the window with which the user is currently working).

Returns
The handle to the foreground window.

This method retrieves a handle to the foreground window, which is the window that the user is currently interacting with. The handle can be used to perform various operations on the window, such as sending messages or modifying its properties.

Here is the caller graph for this function:

◆ GetHash()

static string xeno_rat_client.Utils.GetHash ( string strToHash)
inlinestatic

Computes the MD5 hash of the input string and returns the first 20 characters in uppercase.

Parameters
strToHashThe input string to be hashed.
Returns
The MD5 hash of the input string, truncated to 20 characters and converted to uppercase.

This method computes the MD5 hash of the input string using the MD5CryptoServiceProvider class. It then converts the hash bytes to a hexadecimal string and truncates it to 20 characters. The resulting hash is returned in uppercase.

Here is the caller graph for this function:

◆ GetIdleTime()

static uint xeno_rat_client.Utils.GetIdleTime ( )
inlinestatic

Retrieves the number of milliseconds that have elapsed since the last input event (keyboard or mouse) was received.

Returns
The number of milliseconds that have elapsed since the last input event was received.

This method retrieves the idle time by using the GetLastInputInfo function to obtain the time of the last input event and then calculates the difference between the current time and the last input time to determine the idle time.

◆ GetIdleTimeAsync()

static async Task< uint > xeno_rat_client.Utils.GetIdleTimeAsync ( )
inlinestatic

Asynchronously retrieves the system's idle time in milliseconds.

Returns
The system's idle time in milliseconds.

This method asynchronously retrieves the system's idle time by running the GetIdleTime method in a separate task.

Here is the caller graph for this function:

◆ GetLastInputInfo()

static bool xeno_rat_client.Utils.GetLastInputInfo ( ref LASTINPUTINFO plii)
private

Retrieves the time of the last input event.

Parameters
pliiA reference to a LASTINPUTINFO structure that receives the time of the last input event.
Returns
True if the function succeeds; otherwise, false.

This method retrieves the time (in milliseconds) of the last input event. The input events include keyboard and mouse input.

◆ GetWindowsVersion()

static string xeno_rat_client.Utils.GetWindowsVersion ( )
inlinestatic

Retrieves the Windows version and architecture information.

Returns
The Windows version and architecture in the format "Caption - OSArchitecture".

This method retrieves the Windows version and architecture information using WMI (Windows Management Instrumentation). It queries the Win32_OperatingSystem class to obtain the necessary information. The method returns a string containing the Windows version and architecture details.

Here is the caller graph for this function:

◆ GetWindowText()

static int xeno_rat_client.Utils.GetWindowText ( IntPtr hWnd,
StringBuilder text,
int count )
private

Retrieves the text of the specified window's title bar, if it has one.

Parameters
hWndA handle to the window or control containing the text.
textThe buffer that will receive the text.
countThe maximum number of characters to copy to the buffer, including the null-terminating character.
Returns
If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating null character. If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError.
Here is the caller graph for this function:

◆ GetWindowTextLength()

static int xeno_rat_client.Utils.GetWindowTextLength ( IntPtr hWnd)
private

Retrieves the length, in characters, of the specified window's title bar text (if it has one). If the specified window is a control, the function retrieves the length of the text within the control.

Parameters
hWndA handle to the window or control.
Returns
The length of the window's title bar text, in characters.
Exceptions
Win32ExceptionThrown when an error occurs while retrieving the window's title bar text length.
Here is the caller graph for this function:

◆ GetWindowThreadProcessId()

static IntPtr xeno_rat_client.Utils.GetWindowThreadProcessId ( IntPtr hWnd,
out uint ProcessId )
private

Retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.

Parameters
hWndA handle to the window.
ProcessIdWhen this method returns, contains the identifier of the process that created the window.
Returns
If the function succeeds, the return value is the identifier of the thread that created the window. If the function fails, the return value is zero.
Here is the caller graph for this function:

◆ HWID()

static string xeno_rat_client.Utils.HWID ( )
inlinestatic

Generates a unique hardware identifier (HWID) based on various system parameters.

Returns
A string representing the unique hardware identifier (HWID) generated based on the processor count, user name, machine name, operating system version, and total size of the system drive. If an exception occurs during the generation process, the method returns "UNKNOWN".

This method combines various system parameters such as processor count, user name, machine name, operating system version, and total size of the system drive to create a unique hardware identifier (HWID). The method uses a hashing function to generate the HWID and returns it as a string. If any exception occurs during the generation process, the method returns "UNKNOWN" to indicate that the HWID could not be generated accurately.

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

◆ IsAdmin()

static bool xeno_rat_client.Utils.IsAdmin ( )
inlinestatic

Checks if the current user is an admin and returns a boolean value indicating the result.

Returns
True if the current user is an admin; otherwise, false.

This method internally calls the IsUserAnAdmin method to determine if the current user has admin privileges. If an exception occurs during the check, the method returns false.

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

◆ IsUserAnAdmin()

static bool xeno_rat_client.Utils.IsUserAnAdmin ( )
private

Determines whether the current user is a member of the administrator group.

Returns
True if the current user is a member of the administrator group; otherwise, false.
Here is the caller graph for this function:

◆ RemoveStartup()

static async Task xeno_rat_client.Utils.RemoveStartup ( string executablePath)
inlinestatic

Removes any startup entries related to the specified executable path.

Parameters
executablePathThe path of the executable for which startup entries need to be removed.
Exceptions
System.Security.SecurityExceptionThe caller does not have the required permission.
System.InvalidOperationExceptionThe schtasks.exe process is already running.
System.ComponentModel.Win32ExceptionAn error occurred when accessing the native Windows API.

This method removes any startup entries related to the specified executable path from the system's startup configurations. It first checks for scheduled tasks using schtasks.exe and deletes any task that runs the specified executable. Then, it checks the registry for any startup entries and removes them if they match the specified executable path.

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

◆ Uninstall()

static async Task xeno_rat_client.Utils.Uninstall ( )
inlinestatic

Uninstalls the application by removing it from startup, executing a command to delete the application file, and then terminating the current process.

This method removes the application from the startup, deletes the application file using a command executed in a hidden command prompt window, and then terminates the current process.

Here is the caller graph for this function:

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