Xeno-rat
|
Public Member Functions | |
ScreenControl (Node _client) | |
void | TempOnDisconnect (Node node) |
Disconnects the client and image node if the provided node is equal to the client or the image node, and closes the form if not disposed. | |
async Task | RefreshMons () |
Refreshes the list of monitors in the combo box and enables/disables a button based on the number of monitors. | |
async Task | start () |
Starts the asynchronous operation. | |
async Task | stop () |
Sends a stop signal to the client asynchronously. | |
async Task< string[]> | GetMonitors () |
Asynchronously retrieves the list of monitors from the client and returns it as an array of strings. | |
async Task | SetQuality (int quality) |
Sets the quality of the client and sends the quality value to the server. | |
async Task | SetMonitor (int monitorIndex) |
Sets the monitor index and updates the scale size. | |
async Task | UpdateScaleSize () |
Updates the scale size of the picture box based on the current monitor size. | |
async Task | RecvThread () |
Asynchronously receives data from the ImageNode and updates the PictureBox with the received image. | |
Point | TranslateCoordinates (Point originalCoords, Size originalScreenSize, PictureBox targetControl) |
Translates the original coordinates from one screen size to another based on the target control's image size. | |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Releases the unmanaged resources used by the component and optionally releases the managed resources. | |
Private Member Functions | |
async Task | InitializeAsync () |
Initializes the object asynchronously by creating an image node, adding temporary on disconnect, refreshing the mons, and receiving thread. | |
async Task< Node > | CreateImageNode () |
Creates an image node and returns it. If the image node already exists, returns the existing node. | |
Point | UnzoomedAndAdjusted (PictureBox pictureBox, Point scaledPoint) |
Translates a point from scaled coordinates to unscaled coordinates and adjusts for the zoom factor. | |
Point | Unzoomed (PictureBox pictureBox, Point zoomedPoint) |
Calculates the position on the original image from the zoomed point on the PictureBox. | |
Rectangle | GetImageDisplayRectangle (PictureBox pictureBox) |
Gets the display rectangle for the image in the specified PictureBox. | |
void | ScreenControl_Load (object sender, EventArgs e) |
Called when the screen control is loaded. | |
async void | button2_Click (object sender, EventArgs e) |
Initiates the start method asynchronously and sets the 'playing' flag to true. | |
async void | button3_Click (object sender, EventArgs e) |
Stops the current operation and sets the 'playing' flag to false. | |
async void | button1_Click (object sender, EventArgs e) |
Asynchronously refreshes the monsters. | |
async void | comboBox1_SelectedIndexChanged (object sender, EventArgs e) |
Handles the SelectedIndexChanged event of comboBox1. | |
async void | comboBox2_SelectedIndexChanged (object sender, EventArgs e) |
Handles the SelectedIndexChanged event of comboBox2. Sets the quality based on the selected index in the comboBox. | |
async void | pictureBox1_MouseClick (object sender, MouseEventArgs e) |
Handles the mouse click event on pictureBox1 by sending the coordinates and opcode to the server. | |
async void | pictureBox1_MouseDoubleClick (object sender, MouseEventArgs e) |
Handles the double-click event on the picture box. | |
async void | pictureBox1_MouseUp (object sender, MouseEventArgs e) |
Handles the mouse up event for pictureBox1. | |
async void | pictureBox1_MouseMove (object sender, MouseEventArgs e) |
Handles the mouse movement event for pictureBox1. | |
async void | pictureBox1_MouseDown (object sender, MouseEventArgs e) |
Handles the mouse down event for pictureBox1. | |
void | pictureBox1_PreviewKeyDown (object sender, PreviewKeyDownEventArgs e) |
Handles the PreviewKeyDown event for the pictureBox1 control. | |
void | pictureBox1_Click (object sender, EventArgs e) |
Event handler for the Click event of pictureBox1. | |
void | ScreenControl_KeyPress (object sender, KeyPressEventArgs e) |
Handles the KeyPress event for the screen control. | |
void | ScreenControl_KeyDown (object sender, KeyEventArgs e) |
Handles the KeyDown event for the screen control. | |
async void | ScreenControl_KeyUp (object sender, KeyEventArgs e) |
Handles the KeyUp event for screen control. | |
void | checkBox1_CheckedChanged (object sender, EventArgs e) |
Handles the CheckedChanged event of checkBox1 and updates the text based on the checked state. | |
void | pictureBox1_SizeChanged (object sender, EventArgs e) |
Updates the scale size when the size of the picture box changes. | |
void | InitializeComponent () |
Initializes the components of the form including picture box, combo boxes, buttons, labels, and checkbox. | |
Private Attributes | |
Node | client |
Node | ImageNode |
bool | playing = false |
int | monitor_index = 0 |
double | scaling_factor = 1 |
Size? | current_mon_size = null |
string[] | qualitys = new string[] { "100%","90%", "80%", "70%", "60%", "50%", "40%", "30%", "20%", "10%" } |
System.ComponentModel.IContainer | components = null |
Required designer variable. | |
System.Windows.Forms.PictureBox | pictureBox1 |
System.Windows.Forms.ComboBox | comboBox1 |
System.Windows.Forms.ComboBox | comboBox2 |
System.Windows.Forms.Button | button1 |
System.Windows.Forms.Button | button2 |
System.Windows.Forms.Button | button3 |
System.Windows.Forms.Label | label1 |
System.Windows.Forms.CheckBox | checkBox1 |
|
inline |
|
inlineprivate |
Asynchronously refreshes the monsters.
This method triggers an asynchronous refresh of the monsters, updating the monster data and UI display accordingly.
|
inlineprivate |
Initiates the start method asynchronously and sets the 'playing' flag to true.
This method asynchronously initiates the start method, which may involve asynchronous operations such as network requests or file I/O. Once the start method is initiated, the 'playing' flag is set to true, indicating that the application is in a playing state.
|
inlineprivate |
Stops the current operation and sets the 'playing' flag to false.
This method asynchronously stops the current operation and sets the 'playing' flag to false.
|
inlineprivate |
Handles the CheckedChanged event of checkBox1 and updates the text based on the checked state.
sender | The source of the event. |
e | The EventArgs that contains the event data. |
This method updates the text of checkBox1 based on its checked state. If checkBox1 is checked, the text is set to "Enabled"; otherwise, it is set to "Disabled".
|
inlineprivate |
Handles the SelectedIndexChanged event of comboBox1.
sender | The source of the event. |
e | The EventArgs that contains the event data. |
This method asynchronously sets the monitor based on the selected index in comboBox1. If the selected index is not -1, it awaits the SetMonitor method passing the selected index as a parameter.
|
inlineprivate |
Handles the SelectedIndexChanged event of comboBox2. Sets the quality based on the selected index in the comboBox.
sender | The source of the event. |
e | An EventArgs that contains the event data. |
This method retrieves the selected index from comboBox2 and sets the quality based on the selected index. It first checks if a valid index is selected, then it calls the SetQuality method with the parsed quality value from the qualitys array.
|
inlineprivate |
Creates an image node and returns it. If the image node already exists, returns the existing node.
This method first checks if the image node already exists. If it does, it returns the existing node. If the image node does not exist, it creates a new sub-node using the client and sets its type to 2. It then sends the type 2 ID to the server and waits for a response. If the ID is found, it sets the type 2 ID and returns the sub-node. If the ID is not found, it disconnects the sub-node and returns null. If the type 2 ID cannot be set, it disconnects the sub-node and returns null.
|
inlineprotected |
Releases the unmanaged resources used by the component and optionally releases the managed resources.
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
This method releases the unmanaged resources used by the component and optionally releases the managed resources. If disposing is true, this method disposes of the managed resources.
|
inlineprivate |
Gets the display rectangle for the image in the specified PictureBox.
pictureBox | The PictureBox control containing the image. |
|
inline |
Asynchronously retrieves the list of monitors from the client and returns it as an array of strings.
This method sends a byte array with a value of 2 to the client asynchronously and then receives a string from the client, which is then split into an array of strings using the newline character as the delimiter.
|
inlineprivate |
Initializes the object asynchronously by creating an image node, adding temporary on disconnect, refreshing the mons, and receiving thread.
This method initializes the object asynchronously by performing the following tasks:
|
inlineprivate |
Initializes the components of the form including picture box, combo boxes, buttons, labels, and checkbox.
|
inlineprivate |
Event handler for the Click event of pictureBox1.
sender | The object that raised the event. |
e | The event data. |
|
inlineprivate |
Handles the mouse click event on pictureBox1 by sending the coordinates and opcode to the server.
sender | The object that raised the event. |
e | A MouseEventArgs that contains the event data. |
This method checks if the pictureBox1 has an image, if the application is in playing mode, and if checkBox1 is checked. If any of these conditions are not met, the method returns without performing any further actions. The method then translates the mouse coordinates to match the current monitor size and pictureBox1, and determines the opcode based on the mouse button clicked. The coordinates and opcode are then sent to the server using the client's SendAsync method.
|
inlineprivate |
Handles the double-click event on the picture box.
sender | The object that raised the event. |
e | A MouseEventArgs that contains the event data. |
This method checks if the current monitor size is null, if the picture box image is null, if the application is not in playing mode, if the right mouse button or middle mouse button is clicked, or if the checkbox is not checked. If any of these conditions are met, the method returns without performing any further actions. If all conditions are met, the method translates the coordinates of the mouse click to the current monitor size and sends the coordinates to the client asynchronously.
|
inlineprivate |
Handles the mouse down event for pictureBox1.
sender | The object that raised the event. |
e | A MouseEventArgs that contains the event data. |
This method sends the coordinates of the mouse click to the server using the client's socket connection. It translates the coordinates relative to the pictureBox1 and sends the payload asynchronously to the server.
|
inlineprivate |
Handles the mouse movement event for pictureBox1.
sender | The object that raised the event. |
e | A MouseEventArgs that contains the event data. |
This method translates the mouse coordinates to the corresponding coordinates on the pictureBox1 image, and sends the translated coordinates to the client asynchronously.
|
inlineprivate |
Handles the mouse up event for pictureBox1.
sender | The object that raised the event. |
e | A MouseEventArgs that contains the event data. |
This method checks if the current monitor size and pictureBox1.Image are not null, if the application is in playing state, if the right or middle mouse button is not clicked, and if checkBox1 is checked. If all conditions are met, it translates the mouse coordinates to the pictureBox1 and sends the payload to the client asynchronously.
|
inlineprivate |
Handles the PreviewKeyDown event for the pictureBox1 control.
sender | The source of the event. |
e | A PreviewKeyDownEventArgs that contains the event data. |
This method checks if the current_mon_size is null, if the pictureBox1.Image is null, if the application is not in a playing state, or if checkBox1 is not checked, and returns if any of these conditions are met.
|
inlineprivate |
Updates the scale size when the size of the picture box changes.
sender | The object that raised the event. |
e | The event data. |
|
inline |
Asynchronously receives data from the ImageNode and updates the PictureBox with the received image.
This method continuously receives data from the ImageNode while it is connected. Upon receiving data, it checks if the application is in a playing state. If so, it attempts to convert the received data into a System.Drawing.Image and updates the PictureBox with the new image using BeginInvoke to ensure thread safety. If an exception occurs during the image processing or updating the PictureBox, it is caught and ignored.
|
inline |
Refreshes the list of monitors in the combo box and enables/disables a button based on the number of monitors.
This method asynchronously retrieves the list of monitors and updates the combo box with the new list. If the list of monitors is empty, the associated button is disabled. Otherwise, the button is enabled and the monitor is set to the first item in the list.
|
inlineprivate |
Handles the KeyDown event for the screen control.
sender | The source of the event. |
e | A KeyEventArgs that contains the event data. |
|
inlineprivate |
Handles the KeyPress event for the screen control.
sender | The source of the event. |
e | A KeyPressEventArgs that contains the event data. |
|
inlineprivate |
Handles the KeyUp event for screen control.
sender | The object that raised the event. |
e | A KeyEventArgs that contains the event data. |
This method checks if the current monitor size is null, if the picture box image is null, if the application is not playing, or if the checkbox is not checked, and then returns without performing any further action. If the conditions are met, it sends an asynchronous message to the client with the concatenated byte array consisting of 12 and the key value from the KeyEventArgs.
|
inlineprivate |
Called when the screen control is loaded.
sender | The source of the event. |
e | An EventArgs that contains the event data. |
|
inline |
Sets the monitor index and updates the scale size.
monitorIndex | The index of the monitor to be set. |
This method sets the monitor index to the specified value and updates the scale size accordingly. It sends the monitor index to the client and receives hardware data, including width and height, from the client. The received data is used to update the current monitor size, and then the scale size is updated accordingly.
|
inline |
Sets the quality of the client and sends the quality value to the server.
quality | The quality value to be set for the client. |
This method sets the quality of the client and sends the quality value to the server using the SendAsync method of the client. The quality value is sent to the server after concatenating it with a byte array containing the value 3 using the Concat method. The method is asynchronous and returns a Task representing the asynchronous operation.
|
inline |
Starts the asynchronous operation.
This method initiates an asynchronous operation using the client to send a byte array with a single element of value 0.
|
inline |
Sends a stop signal to the client asynchronously.
Exception | Thrown when an error occurs while sending the stop signal. |
|
inline |
Disconnects the client and image node if the provided node is equal to the client or the image node, and closes the form if not disposed.
node | The node to be checked for disconnection. |
InvalidOperationException | Thrown when attempting to disconnect the client or image node while they are null. |
If the provided node is equal to the client or the image node, this method disconnects the client and image node if they are not null, and closes the form if it is not disposed.
|
inline |
Translates the original coordinates from one screen size to another based on the target control's image size.
originalCoords | The original coordinates to be translated. |
originalScreenSize | The original screen size. |
targetControl | The target control to which the coordinates will be translated. |
This method calculates the scaling factors based on the target control's image size and the original screen size. It then applies the scaling factors to the original coordinates to obtain the scaled coordinates. The method further adjusts the scaled coordinates based on the unzoomed and offset-adjusted coordinates of the target control.
|
inlineprivate |
Calculates the position on the original image from the zoomed point on the PictureBox.
pictureBox | The PictureBox control where the image is displayed. |
zoomedPoint | The point on the PictureBox after zooming. |
This method calculates the position on the original image based on the zoomed point and the scaling factor of the PictureBox. It first determines the scaling factor by comparing the client size of the PictureBox with the dimensions of the image. Then, it calculates the bounding rectangle of the displayed image and uses it to find the corresponding position on the original image.
|
inlineprivate |
Translates a point from scaled coordinates to unscaled coordinates and adjusts for the zoom factor.
pictureBox | The PictureBox control used for displaying the image. |
scaledPoint | The point in scaled coordinates to be translated and adjusted. |
This method calculates the zoom factor based on the size of the PictureBox control and the size of the image being displayed. It then determines the displayed rectangle of the image within the PictureBox. The method finally offsets and unzooms the input coordinates to obtain the corresponding unscaled coordinates, taking into account the zoom factor and the displayed rectangle.
|
inline |
Updates the scale size of the picture box based on the current monitor size.
This method compares the width and height of the picture box with the current monitor size. If the picture box dimensions exceed the monitor size, it sends a scaling factor of 10000 to the client. If the picture box dimensions are within the monitor size, it calculates the scaling factor based on the width and height ratios, and sends the scaled factor to the client.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Required designer variable.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |