Virtual machine remote command interaction method and device for distributed heterogeneous target field and medium
By automatically deploying agents in distributed heterogeneous test ranges and providing pre-arranged and interactive modes, the problem of inconvenient remote command operation is solved, enabling efficient remote command delivery and execution for virtual machines, and supporting unified management of multiple virtual machines and automatic deployment of attack and defense tools.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PENG CHENG LAB
- Filing Date
- 2023-03-09
- Publication Date
- 2026-06-02
AI Technical Summary
In a distributed heterogeneous test range environment, remote command operation is inconvenient, especially since external users cannot directly log in to the virtual machines of the sub-test ranges, and simultaneous login to multiple sub-test ranges may cause conflicts, resulting in inconvenience for users.
The agent program is automatically deployed to target virtual machines that do not have the agent program installed through the server port of the main target range business network. It provides pre-arranged mode and interactive mode to realize the execution of batch and single remote commands, and supports unified management and command distribution of multiple virtual machines.
It solves the problems of cumbersome and inefficient traditional manual login execution methods, and realizes the function of unified virtual machine remote command issuance and execution in distributed heterogeneous test ranges, which improves operation efficiency and interaction smoothness, and supports the automatic deployment and operation of offensive and defensive weapons and tools.
Smart Images

Figure CN116414521B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network target range technology, and in particular to a method, apparatus and medium for remote command interaction of virtual machines in a distributed heterogeneous target range. Background Technology
[0002] A cyber range is a technology based on virtualization that simulates and reproduces the operational status and environment of network architecture, system equipment, and business processes in real cyberspace. It serves purposes such as network attack and defense training, network attack and defense product evaluation, and research and development of new network technologies.
[0003] In a distributed heterogeneous test range environment, remote command operations on virtual machines distributed across different sub-test ranges require logging into the user management system of each sub-test range separately, and then remotely logging into the virtual machine within that sub-test range. This process is highly inconvenient. Furthermore, due to security reasons, some sub-test ranges only allow remote login to users on their internal LAN, making it inaccessible to external users. Alternatively, external users may need to first log into a VPN (Virtual Private Network) and then connect to the internal sub-test range through a VPN tunnel, but simultaneous logins to multiple sub-test ranges can lead to conflicts. All of these methods are inconvenient for users. Therefore, improvements are needed to the interaction method for remote commands in distributed heterogeneous test ranges. Summary of the Invention
[0004] This application provides a method, apparatus, and medium for remote command interaction of virtual machines in a distributed heterogeneous test range. It can combine the input of the interaction device for encoding, thereby improving the encoding speed and the smoothness of the interaction.
[0005] In a first aspect, embodiments of this application provide a method for remote command interaction of virtual machines in a distributed heterogeneous test range. The distributed heterogeneous test range includes a main test range and sub-test ranges. Both the main test range and the sub-test ranges include at least one virtual machine. The sub-test ranges are connected to the main test range service network through the main test range. The main test range service network is used to provide users with remote command scheduling and execution services for the virtual machines.
[0006] The method includes:
[0007] The system receives user query requests and returns virtual machine information of virtual machines that can receive remote commands. The virtual machine information is used by the user to select the target virtual machine from the virtual machines from which to issue remote commands.
[0008] The system receives remote command execution requests from users via a front-end page. These requests are used to send remote commands to a target virtual machine specified by the user. The front-end page supports pre-arrangement mode and interactive mode. The pre-arrangement mode is used to create a command execution workflow based on multiple user commands and generate a first remote command execution request. The interactive mode provides an interactive dialog box to the user. This dialog box is used to receive a single remote command from the user each time and generate a second remote command execution request.
[0009] Check whether all the target virtual machines have an agent program installed. If the target virtual machine does not have the agent program installed, deploy the agent program to the target virtual machine that does not have the agent program installed through the server port of the main target range business network.
[0010] When the agent program is installed on all the target virtual machines, the remote command execution request is sent to the agent program in the target virtual machine, and the remote command execution result returned by the agent program is received. The execution result of the first remote command execution request corresponds to the execution result of the command execution workflow, and the execution result of the second remote command execution request corresponds to the execution result of the single remote command.
[0011] In some embodiments, deploying the agent program to the target virtual machine that does not have the agent program installed via the server port of the main target range service network includes:
[0012] Determine the target network in which the distributed heterogeneous target sites reside;
[0013] Map the server ports of the main target range service network to the target network;
[0014] The agent program is pushed and deployed to the target virtual machine that does not have the agent program installed via the server port.
[0015] In some embodiments, pushing and deploying the agent program to the target virtual machine that does not have the agent program installed via the server port includes:
[0016] When the target virtual machine where the agent program is not installed is located is the main target area, the target area interface of the main target area is called to push and deploy the agent program;
[0017] When the target virtual machine where the agent program is not installed is located is the sub-target field, the agent virtual machine in the sub-target field that is connected to the main target field is selected, and the agent program is pushed and deployed through the agent virtual machine, which already has the agent program deployed in the agent virtual machine.
[0018] In some embodiments, pushing and deploying the agent includes:
[0019] Push the program installation package and configuration file to the target virtual machine that does not have the agent program installed;
[0020] After confirming that the target virtual machine, which has not installed the agent program, has successfully received the program installation package and the configuration file, a deployment command is issued to execute the installation and deployment.
[0021] In some embodiments, mapping the server port of the main target range service network to the target network includes:
[0022] Select one virtual machine from the main target range as the push virtual machine, and determine the subnet where the push virtual machine is located;
[0023] The data transmission interface of the main target range is invoked to open a data channel to the subnet where the push virtual machine is located;
[0024] The server port of the main target range service network is mapped to the target network, and the program installation package and configuration file of the agent program are sent through the data transmission channel.
[0025] In some embodiments, the main target range service network further includes an external interface, which is used to receive multiple commands sent by an external terminal in the pre-arrangement mode, and generate a third remote command execution request based on the multiple commands.
[0026] In some embodiments, the pre-arrangement mode is specifically used for:
[0027] The front-end page receives multiple commands to be executed, which are arranged by the user.
[0028] Create a command execution workflow based on the multiple commands;
[0029] The execution method of the command execution workflow and the input-output relationship of the nodes in the target range are determined. The execution method includes serial execution, parallel execution, and serial-parallel execution of multiple commands.
[0030] The first remote command execution request is constructed based on the command data, execution method, and input-output relationship of nodes in the target range of the command execution workflow.
[0031] In some embodiments, the interaction mode is specifically used for:
[0032] When connected to the target virtual machine, the interactive dialog box is created on the front-end page;
[0033] When a remote command is received from the user in the interactive dialog box, a task session corresponding to the remote command is created, and the remote command is sent to the agent program of the target virtual machine;
[0034] Receive the execution result of the remote command and display it on the interface of the task session;
[0035] When a user requests to end their task, the interactive dialog box is closed.
[0036] Secondly, embodiments of this application provide a virtual machine remote command interaction device, including at least one processor and a memory for communicatively connecting to the at least one processor; the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the virtual machine remote command interaction method as described in the first aspect.
[0037] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the virtual machine remote command interaction method as described in the first aspect.
[0038] The method, apparatus, and medium for remote command interaction of virtual machines in distributed heterogeneous test ranges provided in this application have at least the following beneficial effects: Addressing the problem of inconvenient batch command issuance in distributed heterogeneous test ranges, this application provides users with a pre-arranged mode for batch command execution and an interactive mode for single remote command interaction through a front-end page. The corresponding remote command execution request is issued to one or more target virtual machines specified by the user. Data communication between different network test ranges is achieved through the automatic issuance of proxy programs. When it is detected that a target virtual machine does not have an proxy program installed, the main test range service network automatically pushes and deploys the proxy program to the target virtual machine through the server. This facilitates users issuing remote commands to different virtual machines in distributed heterogeneous test ranges, providing users with a unified virtual machine remote command issuance and execution function. It supports selecting multiple virtual machines for batch issuance and execution, solving the problems of cumbersome and inefficient traditional manual login execution methods, and providing support for the automatic deployment and operation of offensive and defensive weapons and tools. Attached Figure Description
[0039] Figure 1 This is a system framework diagram of a method for remote command interaction in a virtual machine provided in an embodiment of the present invention;
[0040] Figure 2 This is a flowchart of the virtual machine remote command interaction method provided in the embodiments of this application;
[0041] Figure 3 yes Figure 2 The detailed flowchart of step S300;
[0042] Figure 4 yes Figure 3 The detailed flowchart of step S330;
[0043] Figure 5 yes Figure 3 Another specific flowchart of step S330;
[0044] Figure 6 yes Figure 4 The detailed flowchart of step S331;
[0045] Figure 7 yes Figure 3 The detailed flowchart of step S320;
[0046] Figure 8 This is a system architecture diagram of the distributed heterogeneous target range provided in the embodiments of this application;
[0047] Figure 9 This is a schematic diagram of the structure of a virtual machine remote command interaction device provided in one embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0049] It should be noted that in the description of the embodiments of the present invention, the terms "first," "second," etc., in the specification, claims, and the accompanying drawings are used to distinguish similar objects and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the sequential relationship of the indicated technical features. "At least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist, for example, A and / or B, which can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart.
[0050] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0051] The method, apparatus, and medium for remote command interaction of virtual machines in distributed heterogeneous test ranges provided in this application address the problem of inconvenient batch command issuance in distributed heterogeneous test ranges. This application provides users with a pre-arranged mode for batch command execution and an interaction mode for single remote command interaction through a front-end page. The corresponding remote command execution request is issued to one or more target virtual machines specified by the user. Data communication between different network test ranges is achieved through the automatic issuance of agent programs. When it is detected that the target virtual machine does not have an agent program installed, the main test range service network automatically pushes and deploys the agent program to the target virtual machine through the server. This facilitates users to issue remote commands to different virtual machines in distributed heterogeneous test ranges, providing users with a unified virtual machine remote command issuance and execution function. It supports the selection of multiple virtual machines for batch issuance and execution, solving the problems of cumbersome and inefficient traditional manual login execution methods, and providing support for functions such as automatic deployment and operation of offensive and defensive weapons and tools.
[0052] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0053] Reference Figure 1 , Figure 1 This is a system framework diagram of a method for remote command interaction in a virtual machine provided in an embodiment of the present invention.
[0054] In some embodiments, the system relies on a network range system to provide distributed heterogeneous range users with the function of issuing and executing remote commands to virtual machines, and supports batch execution, enabling the selection of multiple virtual machines for simultaneous execution to improve user operation efficiency. It also provides external interfaces to support functions such as automatic assembly and operation of offensive and defensive weapons and tools.
[0055] It is understood that this embodiment divides the system used for the virtual machine remote command interaction method into two major subsystems: a remote command execution server and a virtual machine agent program. The remote command execution server is deployed on the main target range business network and is internally divided into a virtual machine management submodule 100, a command scheduling and execution submodule 200, a front-end subsystem 300, a message service module 400, and a database module 500. The functions of each module are as follows:
[0056] Virtual Machine Management Submodule 100: Manages user-operable virtual machine information, deploys, installs, and configures virtual machine agent programs.
[0057] Command scheduling and execution submodule 200: Responsible for issuing and executing remote commands, publishing commands and parameters to the relevant virtual machine agents via the notification service, receiving and summarizing the responses from the virtual machine agents and saving them, and handling exceptions such as command execution timeouts. It also creates and maintains task sessions in interactive mode.
[0058] Front-end subsystem 300: includes a front-end page, used to receive remote command execution requests issued by users, and to create interactive dialog boxes on the front-end page, etc.
[0059] Message service module 400: Used to return the output results reported by the virtual machine agent to the user and send the user's input to the corresponding virtual machine agent program.
[0060] Database module 500: Used to store the response results of the virtual machine agent and handle command execution timeouts, etc.
[0061] It should be noted that the virtual machine agent is installed and deployed in the virtual machine in the test range. It establishes a network connection with the remote command execution server through the data channel, receives server instructions, calls the local system interface to execute the issued commands, and returns the execution results to the server.
[0062] It will be understood by those skilled in the art that Figure 1 The system framework shown in the figure does not constitute a limitation on the embodiments of the present invention. It may include more or fewer components than shown, or combine certain components, or have different component arrangements. The virtual machine remote command interaction method in this embodiment will be described in detail below.
[0063] Reference Figure 2 The present application provides a method for remote command interaction in a virtual machine, including but not limited to the following steps S100 to S400.
[0064] Step S100: Receive the user's query request and return the virtual machine information of the virtual machines that can receive remote commands. The virtual machine information is used by the user to select the target virtual machine from the virtual machines to which the remote command needs to be issued.
[0065] In some embodiments, a user's query request is received, the information of operable virtual machines in a distributed heterogeneous test range is determined, and the virtual machine information of virtual machines that can accept remote commands is returned through the test range interface, so as to facilitate the unified control of virtual machines in the future.
[0066] Step S200: Receive a remote command execution request sent by the user through the front-end page;
[0067] It should be noted that the remote command execution request is used to issue remote commands to the target virtual machine specified by the user. The front-end page supports pre-arrangement mode and interactive mode. The pre-arrangement mode is used to create a command execution workflow based on multiple commands from the user and generate the first remote command execution request. The interactive mode is used to provide an interactive dialog box to the user. The interactive dialog box is used to receive a single remote command from the user each time and generate a second remote command execution request.
[0068] In some embodiments, a remote command execution request sent by a user through a front-end page is received to determine the target virtual machine for the user-specified operation, and to facilitate the subsequent sending of remote commands to the target virtual machine specified by the user.
[0069] Step S300: Check whether all target virtual machines have an agent program installed. If the target virtual machine does not have an agent program installed, deploy the agent program to the target virtual machine without an agent program installed through the server port of the main target range business network.
[0070] In some embodiments, it is checked whether all target virtual machines have an agent program installed. If the target virtual machine does not have an agent program installed, the agent program is deployed to the target virtual machine without an agent program installed through the server port of the main target range business network, thereby realizing the comprehensive deployment of the target virtual machines, facilitating the unified management of the target virtual machines, and enabling encoding based on the input of the interactive device, thereby improving the encoding speed and the smoothness of the interaction.
[0071] Understandably, if an agent program is installed on the target virtual machine, remote command execution requests can be directly sent to the agent program in the target virtual machine, and the returned results can be received.
[0072] Step S400: If all target virtual machines have an agent program installed, send the remote command execution request to the agent program in the target virtual machine and receive the remote command execution result returned by the agent program.
[0073] It should be noted that the execution result of the first remote command execution request corresponds to the execution result of the command execution workflow, and the execution result of the second remote command execution request corresponds to the execution result of a single remote command.
[0074] In some embodiments, if it is determined that all target virtual machines have an agent program installed, remote command execution requests can be directly sent to the agent program in the target virtual machine. The execution result of the first remote command execution request corresponds to the execution result of the command execution workflow, and the execution result of the second remote command execution request corresponds to the execution result of a single remote command. It can send instructions in batches through two modes: pre-arrangement mode and interactive mode, and receive the remote command execution results returned by the agent program. This realizes the provision of a unified virtual machine remote command sending and execution function to users, solving the problem of the cumbersome process of the traditional manual login execution method.
[0075] Reference Figure 3 , Figure 3 Yes Figure 2 Further explanation of step S300: Step S300 includes, but is not limited to, steps S310 to S330.
[0076] Step S310: Determine the target network where the heterogeneous target sites are located;
[0077] Step S320: Map the server port of the main target range service network to the target network;
[0078] Step S330: Push and deploy the agent program to the target virtual machine that does not have the agent program installed through the server port.
[0079] In steps S310 to S330 of some embodiments, during the process of deploying the agent program to the target virtual machine without the agent program installed, it is necessary to first determine the target network where the heterogeneous target sites are located, and then map the server port of the main target site network service to the target network to determine the target site type where the target virtual machine is located. The agent program is then pushed and deployed to the target virtual machine without the agent program installed through the server port, thereby realizing the deployment of target virtual machines in different target site types and achieving accurate deployment of target virtual machines.
[0080] Reference Figure 4 , Figure 4 Yes Figure 3 Further explanation of step S330: Step S330 includes, but is not limited to, step S331.
[0081] Step S331: When the target virtual machine without the agent program is located in the main target range, call the target range interface of the main target range to push and deploy the agent program.
[0082] In some embodiments, when the target virtual machine without an agent program is located in the main target range, the target range interface of the main target range can be called directly and the agent program can be deployed to deploy the target virtual machine in the main target range.
[0083] Reference Figure 5 , Figure 5 Yes Figure 3 Further explanation of step S330: Step S330 includes, but is not limited to, step S332.
[0084] Step S332: When the target virtual machine without the agent program is located in a sub-targeting range, select the agent virtual machine in the sub-targeting range that is connected to the main targeting range, and push and deploy the agent program through the agent virtual machine.
[0085] It should be noted that an agent program has already been deployed in the agent virtual machine.
[0086] In some embodiments, when the target virtual machine without an agent program is located in a sub-targeting range, it is necessary to first select the main targeting range virtual machine that can be connected in the target network as the agent virtual machine, and push and deploy the agent program through the agent virtual machine. That is, remotely copy the file to the sub-targeting range virtual machine and issue a command to execute the installation and deployment of the agent program already deployed in the agent virtual machine, so as to achieve the deployment of the sub-targeting range virtual machine.
[0087] Reference Figure 6 , Figure 6 Yes Figure 4 Further explanation of step S331: Step S331 includes, but is not limited to, steps S3310 to S3311.
[0088] Step S3310: Push the program installation package and configuration file to the target virtual machine that does not have the agent program installed;
[0089] Step S3311: After confirming that the target virtual machine without the agent program has successfully received the program installation package and configuration file, a deployment command is issued to execute the installation and deployment.
[0090] In steps S3310 to S3311 of some embodiments, when the target virtual machine is located in the target range as the main target range, the program installation package and configuration file are pushed to the target virtual machine that has not installed the agent program. After confirming that the target virtual machine that has not installed the agent program has successfully received the program installation package and configuration file, a deployment command is issued to execute the installation and deployment, thereby realizing the installation of the deployment agent program.
[0091] It should be noted that if the target virtual machine that has not installed the agent fails to receive the installation package and configuration file, an error will occur during the installation process, and a failure message will be returned to the user directly through the front-end page.
[0092] Reference Figure 7 , Figure 7 Yes Figure 3 Further explanation of step S320: Step S320 includes, but is not limited to, steps S321 to S323.
[0093] Step S321: Select a virtual machine in the main target range as the push virtual machine, and determine the subnet where the push virtual machine is located;
[0094] Step S322: Call the data transmission interface of the main target range to open a data channel to the subnet where the push virtual machine is located;
[0095] Step S323: Map the server port of the main target range service network to the target network, and send the agent program installation package and configuration file through the data transmission channel.
[0096] In steps S321 to S323 of some embodiments, during the process of mapping the server port of the main target range service network to the target network, it is necessary to first select a virtual machine in the main target range as the push virtual machine, and determine the subnet where the push virtual machine is located from the target network. Then, the data transmission interface of the main target range is called to open a data channel to the subnet where the push virtual machine is located, thereby realizing data transmission from the main target range to the push virtual machine. Finally, the server of the main target range service network is mapped to the target network, and the agent program installation package and configuration file are sent through the data transmission channel to install and start the agent program. This enables the agent program to publish commands and parameters to the relevant virtual machines, supports the distribution of remote commands to virtual machines in the main target range and sub-target ranges for scheduling and execution, and can combine the input of the interactive device for encoding, thereby improving the encoding speed and the smoothness of interaction.
[0097] In some embodiments, the main target range service network also includes an external interface. The external interface is used to receive multiple commands sent by external terminals in pre-arranged mode and generate a third remote command execution request based on the multiple commands. This allows command data to be constructed directly based on the external interface, and operations such as calling the results to be executed to improve user operation efficiency. It can also provide support for functions such as automatic assembly and operation of offensive and defensive weapons and tools, thus broadening the application scenarios.
[0098] In some embodiments, the pre-arrangement mode is specifically used for: receiving multiple commands to be executed by the user in a front-end page; creating a command execution workflow based on the multiple commands; determining the execution method of the command execution workflow and the input-output relationship of the nodes in the target range, wherein the execution method includes serial execution, parallel execution, and serial-parallel execution of multiple commands; and arranging the command data, execution method, and input-output relationship of the nodes in the target range for the command execution workflow to construct unified workflow data, namely, the first remote command execution request.
[0099] In some embodiments, the interactive mode is specifically used for: creating an interactive dialog box on the front-end page when connected to the target virtual machine, thereby enabling real-time reception of user input instructions and realizing real-time interaction between the user and the distributed heterogeneous target range; when a remote command arranged by the user in the interactive dialog box is received, creating a task session corresponding to the remote command and sending the remote command to the agent program of the target virtual machine; receiving the execution result of the remote command and displaying it on the interface of the task session; and closing the interactive dialog box when a user's task completion request is received.
[0100] It should be noted that in interactive mode, each task only supports executing a single command on a single virtual machine. After execution, an interactive input / output dialog box is provided, through which users can input commands in real time and view the command execution results.
[0101] The following example illustrates the virtual machine remote command interaction method of this application.
[0102] Example 1:
[0103] Example 1 illustrates the specific flow of the virtual machine remote command interaction method provided in this application's embodiments:
[0104] Reference Figure 8 , Figure 8 This is a system architecture diagram of the distributed heterogeneous target range provided in the embodiments of this application;
[0105] In some embodiments, the distributed heterogeneous test range includes a main test range 600 and a sub-test range 700. Both the main test range 600 and the sub-test range 700 include at least one virtual machine. The sub-test range 700 is connected to the main test range service network through the main test range 600. The main test range service network is used to provide users with remote command scheduling and execution services for virtual machines.
[0106] Understandably, data exchange between different network test ranges is achieved through the automatic distribution of proxy programs, and the main test range's business network is equipped with a server cluster. This server cluster is used to push and proxy programs to the target virtual machines. The following section will use... Figure 8 Based on the system architecture, this paper provides a detailed explanation of the remote command interaction method for virtual machines.
[0107] Step 1: Query the information of operable virtual machines and obtain the information of virtual machines that can be issued commands through the target range interface;
[0108] It should be noted that the operable virtual machine information can be obtained by querying through user query requests, or it can be the original virtual machine information stored in a distributed heterogeneous test range. This embodiment does not impose any specific restrictions.
[0109] Step 2: Construct a remote command execution request. Here, the user can select the virtual machine to which the remote command is to be executed through the front-end page, and configure the command and parameters to be executed.
[0110] It should be noted that the system supports two modes: pre-arrangement and interactive. In pre-arrangement mode, multiple commands to be executed can be arranged through the front-end page to create command execution workflows. It supports serial and parallel execution modes and their combinations, and allows setting input and output relationships between command nodes. After the arrangement is completed, unified workflow data is generated. In interactive mode, each task can only execute a single command on a single virtual machine. After execution, an interactive input and output dialog box is provided, through which users can input commands in real time and view the command execution results.
[0111] It is worth noting that the system also provides an external interface in a pre-arranged mode, allowing external modules to directly construct command data and execute the results.
[0112] Step 3: Command issuance and execution. The remote command execution request is issued to the command scheduling and execution submodule. The command scheduling and execution submodule first checks whether the virtual machine that needs to execute the command has installed the agent program. If the agent program is installed, proceed directly to step 5; otherwise, execute step 4.
[0113] Step 4: Install and configure the agent program. Select the subnet where the main target virtual machine is located from the target network, call the main target interface to open the data channel, map the server port to the target network, and then push the agent program installation package and configuration file to the virtual machine to install and start the agent program.
[0114] It should be noted that if an error occurs during the installation process, a failure message will be returned directly to the user.
[0115] It is worth noting that in a distributed heterogeneous test range environment, for virtual machines assigned to the main test range, files can be pushed directly by calling the test range interface and commands can be issued to execute the installation and deployment of the agent program. For virtual machines in sub-test ranges, it is necessary to first select the main test range virtual machine that can be connected in the target network as the agent virtual machine. Through the agent program in the agent virtual machine, files can be remotely copied to the sub-test range virtual machine and commands can be issued to execute the installation and deployment.
[0116] Step 5: Command scheduling and execution, sending command requests to the corresponding virtual machine's agent program, receiving and summarizing the execution results returned by each agent program, and handling exceptions such as execution timeouts;
[0117] It should be noted that in pre-arranged mode, the virtual machine agent parses and schedules the command execution workflow, and returns the results to the user after execution. In interactive mode, a session is created for the task, continuously returning the command execution output stream to the user, while simultaneously sending the user's input to the corresponding virtual machine agent, which then forwards it to the input stream of the corresponding command execution process.
[0118] Step Six: Command execution completes, and the result is returned. In pre-arranged mode, the result is returned directly after execution, and the task ends; in interactive mode, the user must actively close the session or enter the exit command to end the task.
[0119] Understandably, the requested data and execution results are saved to the database simultaneously, and a query interface is provided to support queries.
[0120] In some embodiments, the virtual machine agent is installed and deployed in a virtual machine in the test range. It establishes a network connection with the remote command execution server via a data channel, receives server instructions, calls the local system interface to execute the issued commands, and returns the execution results to the server. In pre-arranged mode, the virtual machine agent parses the issued command execution workflow and schedules the execution of corresponding commands. After all commands are executed, it returns the execution results to the server. In interactive mode, after command execution, it asynchronously reads the output stream and returns it to the server. Simultaneously, it receives subsequent commands from the server, writes them to the input stream of the corresponding command process, and closes the command execution process upon receiving a task completion notification, or detects that the command execution process has exited, thus ending the task.
[0121] It is understood that this embodiment supports the distribution of remote commands to virtual machines in the main target range and sub-target range for scheduled execution, returns the execution results, supports pre-arranged remote command execution workflows, supports the serial and parallel execution of multiple commands and their combinations, and provides an external calling interface.
[0122] This application also provides a virtual machine remote command interaction device, including at least one processor and a memory for communicatively connecting to the at least one processor; the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the aforementioned virtual machine remote command interaction method.
[0123] Reference Figure 9 Taking the virtual machine remote command interaction device 1000, where the control processor 1001 and memory 1002 are connected via a bus as an example, the memory 1002, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, the memory 1002 may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1002 may optionally include memory remotely located relative to the control processor 1001, and these remote memories can be connected to the encoding device 1000 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0124] Those skilled in the art will understand that Figure 9 The device structure shown does not constitute a limitation on the virtual machine remote command interaction device 1000, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0125] This application also provides a computer-readable storage medium storing computer-executable instructions that are executed by one or more control processors, for example, by... Figure 7 One of the control processors 1001 executes, which can cause the above-mentioned one or more control processors to execute the virtual machine remote command interaction method in the above method embodiment.
[0126] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
Claims
1. A method for remote command interaction of virtual machines in a distributed heterogeneous test range, characterized in that, The distributed heterogeneous test range includes a main test range and sub-test ranges. Both the main test range and the sub-test ranges include at least one virtual machine. The sub-test ranges are connected to the main test range service network through the main test range. The main test range service network is used to provide users with remote command scheduling and execution services for the virtual machines. The method includes: The system receives user query requests and returns virtual machine information of virtual machines that can receive remote commands. The virtual machine information is used by the user to select the target virtual machine from the virtual machines from which to issue remote commands. The system receives remote command execution requests from users via a front-end page. These requests are used to send remote commands to a target virtual machine specified by the user. The front-end page supports pre-arrangement mode and interactive mode. The pre-arrangement mode is used to create a command execution workflow based on multiple user commands and generate a first remote command execution request. The interactive mode provides an interactive dialog box to the user. This dialog box is used to receive a single remote command from the user each time and generate a second remote command execution request. Check whether all the target virtual machines have an agent program installed. If the target virtual machine does not have the agent program installed, deploy the agent program to the target virtual machine that does not have the agent program installed through the server port of the main target range business network. When the agent program is installed on all the target virtual machines, the remote command execution request is sent to the agent program in the target virtual machine, and the remote command execution result returned by the agent program is received. The execution result of the first remote command execution request corresponds to the execution result of the command execution workflow, and the execution result of the second remote command execution request corresponds to the execution result of the single remote command.
2. The virtual machine remote command interaction method according to claim 1, characterized in that, Deploying the agent program to the target virtual machine that does not have the agent program installed via the server port of the main test range service network includes: Determine the target network in which the distributed heterogeneous target sites reside; Map the server ports of the main target range service network to the target network; The agent program is pushed and deployed to the target virtual machine that does not have the agent program installed via the server port.
3. The virtual machine remote command interaction method according to claim 2, characterized in that, The step of pushing and deploying the agent program to the target virtual machine that does not have the agent program installed via the server port includes: When the target virtual machine where the agent program is not installed is located is the main target area, the target area interface of the main target area is called to push and deploy the agent program; When the target virtual machine where the agent program is not installed is located is the sub-target field, the agent virtual machine in the sub-target field that is connected to the main target field is selected, and the agent program is pushed and deployed through the agent virtual machine, which already has the agent program deployed in the agent virtual machine.
4. The virtual machine remote command interaction method according to claim 3, characterized in that, The process of pushing and deploying the agent program includes: Push the program installation package and configuration file to the target virtual machine that does not have the agent program installed; After confirming that the target virtual machine, which has not installed the agent program, has successfully received the program installation package and the configuration file, a deployment command is issued to execute the installation and deployment.
5. The virtual machine remote command interaction method according to claim 2, characterized in that, The step of mapping the server port of the main target range service network to the target network includes: Select one virtual machine from the main target range as the push virtual machine, and determine the subnet where the push virtual machine is located; The data transmission interface of the main target range is invoked to open a data channel to the subnet where the push virtual machine is located; The server port of the main target range service network is mapped to the target network, and the program installation package and configuration file of the agent program are sent through the data transmission channel.
6. The virtual machine remote command interaction method according to claim 1, characterized in that, The main target range service network also includes an external interface, which is used to receive multiple commands sent by external terminals in the pre-arrangement mode, and generate a third remote command execution request based on the multiple commands.
7. The virtual machine remote command interaction method according to claim 1, characterized in that, The pre-arrangement mode is specifically used for: The front-end page receives multiple commands to be executed, which are arranged by the user. Create a command execution workflow based on the multiple commands; The execution method of the command execution workflow and the input-output relationship of the nodes in the target range are determined. The execution method includes serial execution, parallel execution, and serial-parallel execution of multiple commands. The first remote command execution request is constructed based on the command data, execution method, and input-output relationship of nodes in the target range of the command execution workflow.
8. The virtual machine remote command interaction method according to claim 1, characterized in that, The interaction mode is specifically used for: When connected to the target virtual machine, the interactive dialog box is created on the front-end page; When a remote command is received from the user in the interactive dialog box, a task session corresponding to the remote command is created, and the remote command is sent to the agent program of the target virtual machine; Receive the execution result of the remote command and display it on the interface of the task session; When a user requests to end their task, the interactive dialog box is closed.
9. A virtual machine remote command interaction device, characterized in that, It includes at least one processor and a memory for communicatively connecting with said at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the virtual machine remote command interaction method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the virtual machine remote command interaction method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Remote access to hosted virtual machines by enterprise users
CN102420846A
Network attack and defense virtual simulation system based on hyper-converged infrastructure
CN106790046A