A cross-system host control method and system

CN120768890BActive Publication Date: 2026-10-30GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511010388.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-22
Publication Date
2026-10-30
Estimated Expiration
2045-07-22

AI Technical Summary

Technical Problem

[0002]Windows Subsystem for Linux(WSL)作为Windows系统(宿主机)的Linux兼容层,允许原生运行Linux二进制文件(如Ubuntu和Debian),由于WSL缺乏原生宿主机控制接口,默认无法直接控制宿主机硬件,在Linux环境中无法直接调用Windows系统命令,因此,如何实现跨系统的宿主机控制成为一个亟待突破的难题

Benefits of technology

[0024]在上述方案中,宿主机命名管道监听单元将宿主机映射文件写入所述宿主机命名管道,由监听脚本对宿主机命名管道进行监听,实时检测是否存在控制指令更新,若监听到控制指令更新,则文件解析单元将调用宿主机系统命令对宿主机命名管道中的宿主机映射文件进行解析,以获取对应的控制指令,控制单元通过控制指令对宿主机进行控制,通过构建从第一套接字到命名管道的指令代理链路,由网页直接对宿主机进行跨系统控制,最小化宿主机网络端口暴露面,提高宿主机控制可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120768890B_ABST
    Figure CN120768890B_ABST
Patent Text Reader

Abstract

The application provides a cross-system host control method and system, which comprises the following steps: receiving a control instruction generated by a client by accessing a webpage; creating a first socket and sending the control instruction to a corresponding compatible layer daemon process; based on the compatible layer daemon process, real-time monitoring of the first socket and generation of a host mapping file; and sending the host mapping file to a host naming pipe to control the host according to the corresponding control instruction in the host mapping file. The application solves the problem that the prior art cannot directly remotely control the host through the webpage, which easily exposes the network port of the host and causes poor host control reliability. The application designs an instruction agent link to remotely control the host through the webpage, thereby improving the host control reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of control, and more particularly to a cross-system host control method and system. Background Technology

[0002] Windows Subsystem for Linux (WSL) serves as a Linux compatibility layer for Windows systems (hosts), allowing native Linux binaries (such as Ubuntu and Debian) to run. However, WSL lacks a native host control interface and cannot directly control host hardware by default. It also cannot directly call Windows system commands in a Linux environment. Therefore, how to achieve cross-system host control has become a pressing problem that needs to be solved.

[0003] Currently, existing technologies generally adopt a web-based control solution for the host machine. However, existing web-based control solutions rely on a security protocol (Secure Shell, SSH) built on the application and transport layers. To remotely log in to the physical Windows host to execute commands or perform manual operations via SSH, the host's network port needs to be exposed during remote control. Therefore, existing technologies not only cannot directly remotely control the host machine via a web page, but also easily expose the host machine's network port, resulting in poor reliability of host machine control. Summary of the Invention

[0004] To address the aforementioned issues, this invention proposes a cross-system host control method and system, which constructs an instruction proxy link to enable remote control of the host machine directly via a webpage, thereby improving the reliability of host machine control.

[0005] To achieve the above objectives, embodiments of the present invention provide a cross-system host control method, comprising: receiving a control command generated by a client accessing a webpage; creating a first socket and sending the control command to a corresponding compatibility layer daemon; based on the compatibility layer daemon, monitoring the first socket in real time and generating a host mapping file; and sending the host mapping file to a host named pipe to control the host machine according to the control command corresponding to the host mapping file.

[0006] This invention proposes a cross-system host control method. It receives control commands generated by accessing a webpage from a client, creates a first socket, and sends the control commands to a compatibility layer daemon. The compatibility layer daemon then monitors the first socket in real time to generate a host mapping file. Finally, the host mapping file is sent to a host named pipe for further parsing of the control commands. This constructs a command proxy link from the first socket to the named pipe, enabling direct cross-system control of the host machine via a webpage, minimizing the host machine's network port exposure surface, and improving the reliability of host machine control.

[0007] Furthermore, receiving control instructions generated by the client through accessing a webpage includes: receiving the webpage operation type and timestamp recorded when the client accesses a webpage deployed in the compatibility layer; and generating corresponding control instructions based on the webpage operation type and timestamp.

[0008] In the above scheme, the operation type of the webpage accessed by the client and deployed in the compatibility layer is recorded to obtain the operation action of the control command. At the same time, the timestamp is also received for subsequent validity verification, so that the control command can still be reliable after it is transmitted to the host machine, thereby improving the control reliability of the host machine.

[0009] Furthermore, creating a first socket and sending the control command to the corresponding compatibility layer daemon process includes: creating a first socket and connecting the first socket to a second socket of the compatibility layer daemon process; setting a verification signature for the control command and sending the control command to the corresponding compatibility layer daemon process through the first socket.

[0010] In the above scheme, a first socket is created and connected to the second socket of the compatibility layer daemon process for transmitting control commands. A verification signature is set for the control commands for subsequent validity verification, so that the control commands can still be reliable after they are transmitted to the host machine, thereby improving the reliability of the host machine control.

[0011] Furthermore, based on the compatibility layer daemon, real-time monitoring of the first socket and generation of a host machine mapping file includes: real-time monitoring of the control commands stored in the first socket through the compatibility layer daemon; validating the control commands based on the timestamp and verification signature of the control commands; if the control commands pass the validity verification, mapping the first socket to the host machine to generate a host machine mapping file, wherein the host machine mapping file includes the control commands.

[0012] In the above scheme, the compatibility layer daemon listens to the first socket in real time to capture control commands. Then, it performs validity verification based on the pre-set timestamp and verification signature in the control command to ensure communication security and prevent the control command from being tampered with. When the control command passes the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file. The control command is mapped into a format that the host machine can parse for subsequent control of the host machine. This enables cross-system control of the host machine directly through a web page, minimizes the host machine's network port exposure surface, and improves the reliability of host machine control.

[0013] Furthermore, the host machine mapping file is sent to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file. This includes: writing the host machine mapping file into the host machine named pipe; listening to the host machine named pipe through the host machine's listening script to obtain the listening result; if the listening result indicates that there is an instruction update, then calling the host machine system command to parse the host machine mapping file to obtain the corresponding control instruction; and controlling the host machine through the control instruction.

[0014] In the above scheme, the host machine mapping file is written into the host machine named pipe. The listening script listens to the host machine named pipe to detect whether there are any control command updates in real time. If a control command update is detected, the host machine system command is called to parse the host machine mapping file in the host machine named pipe to obtain the corresponding control command and control the host machine. By constructing a command proxy link from the first socket to the named pipe, the webpage can directly control the host machine across systems, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0015] Furthermore, controlling the host machine through the control command includes: generating a temporary session ID after the control command arrives at the host machine; obtaining the webpage operation type and timestamp based on the temporary session ID and the control command; and controlling the host machine according to the webpage operation type when the timestamp is valid.

[0016] In the above scheme, after the control command arrives at the host machine, a temporary session ID is generated, and a second verification of the timestamp is performed to ensure that the timestamp is valid. Then, the host machine is controlled according to the web page operation type. A temporary ID firewall is built to minimize the network port exposure surface. Secondary verification is then used to ensure that the control command is not tampered with. In this way, the host machine can be directly controlled across systems through the web page, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0017] Furthermore, this embodiment of the invention proposes a cross-system host control method, which further includes: receiving a survival signal periodically sent by the host, and terminating the control command currently running on the host when the survival signal is abnormal.

[0018] In the above scheme, the system periodically receives the liveness signal sent by the host machine, sets up a heartbeat monitoring mechanism to terminate abnormal commands in a timely manner, and performs cross-system control of the host machine directly through the web page in the constructed command proxy link, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0019] This invention also provides a cross-system host control system, comprising: a control command acquisition module, a control command transmission module, a host machine mapping file acquisition module, and a host machine control module; the control command acquisition module is used to receive control commands generated by a client accessing a webpage; the control command transmission module is used to create a first socket and send the control commands to the corresponding compatibility layer daemon process; the host machine mapping file acquisition module is used to monitor the first socket in real time and generate a host machine mapping file based on the compatibility layer daemon process; the host machine control module is used to send the host machine mapping file to a host machine named pipe to control the host machine according to the corresponding control commands in the host machine mapping file.

[0020] This invention proposes a cross-system host control system. A control command acquisition module receives control commands generated by accessing a webpage from a client. A control command transmission module then creates a first socket and sends the control commands to a compatibility layer daemon. A host mapping file acquisition module then monitors the first socket in real time through the compatibility layer daemon to generate a host mapping file. Finally, the host control module sends the host mapping file to a host named pipe for further parsing of the control commands. This constructs a command proxy link from the first socket to the named pipe, enabling cross-system control of the host machine directly via a webpage, minimizing the host machine's network port exposure surface, and improving the reliability of host machine control.

[0021] Furthermore, the host machine mapping file acquisition module is used to monitor the first socket in real time and generate a host machine mapping file based on the compatibility layer daemon process, including: an instruction monitoring unit and an instruction mapping unit; the instruction monitoring unit is used to monitor the control instructions stored in the first socket in real time through the compatibility layer daemon process; the instruction mapping unit is used to verify the validity of the control instructions based on the timestamp and verification signature of the control instructions. If the control instructions pass the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file, wherein the host machine mapping file includes the control instructions.

[0022] In the above scheme, the command listening unit listens to the first socket in real time in the compatibility layer daemon process to capture control commands. The command mapping unit then performs validity verification based on the pre-set timestamp and verification signature in the control command to ensure communication security and prevent the control command from being tampered with. When the control command passes the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file, which maps the control command into a format that the host machine can parse for subsequent control of the host machine. This enables cross-system control of the host machine directly through a web page, minimizes the host machine's network port exposure surface, and improves the reliability of host machine control.

[0023] Furthermore, the host machine control module is used to send the host machine mapping file to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file. It includes: a host machine named pipe listening unit, a file parsing unit, and a control unit. The host machine named pipe listening unit is used to write the host machine mapping file into the host machine named pipe, listen to the host machine named pipe through the host machine's listening script, and obtain the listening result. The file parsing unit is used to, if the listening result indicates that there is an instruction update, call the host machine system command to parse the host machine mapping file to obtain the corresponding control instruction. The control unit is used to control the host machine through the control instruction.

[0024] In the above scheme, the host machine named pipe listening unit writes the host machine mapping file into the host machine named pipe. The listening script listens to the host machine named pipe to detect whether there are any control command updates in real time. If a control command update is detected, the file parsing unit will call the host machine system command to parse the host machine mapping file in the host machine named pipe to obtain the corresponding control command. The control unit controls the host machine through the control command. By constructing an instruction proxy link from the first socket to the named pipe, the webpage can directly control the host machine across systems, minimizing the host machine's network port exposure surface and improving the reliability of host machine control. Attached Figure Description

[0025] Figure 1 This is a flowchart illustrating the steps of a cross-system host control method according to a certain embodiment of the present invention.

[0026] Figure 2 This is a schematic diagram of the execution flow of a cross-system host control method provided in a certain embodiment of the present invention;

[0027] Figure 3 This is a schematic diagram of the module structure of a cross-system host control system provided in a certain embodiment of the present invention. Detailed Implementation

[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] In this embodiment, the host machine uniformly uses the Windows system, which will not be described again later.

[0030] See Figure 1 , Figure 1 This is a flowchart illustrating the steps of a cross-system host control method according to a certain embodiment of the present invention. Figure 1 As shown, this embodiment of the invention proposes a cross-system host control method, including steps 101 to 104, each step of which is as follows:

[0031] Step 101: Receive control commands generated by the client through accessing a webpage;

[0032] Step 102: Create the first socket and send the control command to the corresponding compatibility layer daemon process;

[0033] Step 103: Based on the compatibility layer daemon process, monitor the first socket in real time and generate a host machine mapping file;

[0034] Step 104: Send the host machine mapping file to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file.

[0035] One specific implementation method is described in [reference]. Figure 2 , Figure 2 This is a schematic diagram of the execution flow of a cross-system host control method according to a certain embodiment of the present invention; as shown below. Figure 2As shown, the client accesses the corresponding webpage through a browser. This webpage contains various web services, such as shutdown, restart, volume up, and volume down. The client accesses these web services, obtains the corresponding control commands, and sends these commands from the client to the backend. These control commands correspond to web services such as shutdown and reboot commands. The backend is deployed in the compatibility layer, specifically in WSL. A UNIX domain socket, such as / var / run / hostctl.sock, is then created to receive the control commands sent by the client. In this embodiment, the UNIX domain socket is referred to as the first socket. The UNIX domain socket is then sent to the compatibility layer daemon, which is denoted as WSL in this embodiment. The WSL daemon is worth mentioning. It's configured within WSL to monitor specific UNIX domain sockets. By monitoring these sockets and mapping them to the host machine (e.g., mapping ` / var / run / hostctl.sock` to `c: / / var / run / hostctl.sock` as the host machine's mapping file), and writing this mapping file to a named pipe on the host machine, a batch script continuously monitors the pipe. When it detects writing to the host machine's mapping file, it invokes the corresponding Windows system commands to parse the mapping file and obtain the necessary control instructions to manage the host machine.

[0036] This invention proposes a cross-system host control method. It receives control commands generated by accessing a webpage from a client, creates a first socket, and sends the control commands to a compatibility layer daemon. The compatibility layer daemon then monitors the first socket in real time to generate a host mapping file. Finally, the host mapping file is sent to a host named pipe for further parsing of the control commands. This constructs a command proxy link from the first socket to the named pipe, enabling direct cross-system control of the host machine via a webpage, minimizing the host machine's network port exposure surface, and improving the reliability of host machine control.

[0037] In a preferred embodiment, receiving control instructions generated by the client through accessing a webpage includes: receiving the webpage operation type and timestamp recorded when the client accesses a webpage deployed in the compatibility layer; and generating corresponding control instructions based on the webpage operation type and timestamp.

[0038] In one preferred implementation, the client accesses a webpage through a browser. This webpage offers various web services, such as shutdown, restart, volume up, and volume down. The client accesses these web services, obtains corresponding control commands, and sends these commands to the backend. These control commands include commands like shutdown and reboot. When the client accesses a webpage deployed in a Web Service Layer (WSL), the selected web service is automatically recorded. Each time a web service is selected, the operation type and timestamp are obtained. The operation type corresponds to shutdown, restart, volume up, and volume down, while the timestamp is used for subsequent validity verification. The operation type and timestamp are integrated into a corresponding control command and sent to the backend. The backend is deployed in a compatibility layer, i.e., within a WSL. It's worth noting that the host machine typically has several WSLs configured, so after the client accesses a web service and generates control commands, they can be sent to the corresponding WSL for processing.

[0039] In the above scheme, the operation type of the webpage accessed by the client and deployed in the compatibility layer is recorded to obtain the operation action of the control command. At the same time, the timestamp is also received for subsequent validity verification, so that the control command can still be reliable after it is transmitted to the host machine, thereby improving the control reliability of the host machine.

[0040] In a preferred embodiment, creating a first socket and sending the control command to the corresponding compatibility layer daemon process includes: creating a first socket and connecting the first socket to a second socket of the compatibility layer daemon process; setting a verification signature for the control command and sending the control command to the corresponding compatibility layer daemon process through the first socket.

[0041] One preferred implementation involves creating a UNIX domain socket, such as / var / run / hostctl.sock, to receive control commands sent by the client. In this embodiment, the UNIX domain socket is referred to as the first socket. Then, the UNIX domain socket is sent to a compatibility layer daemon, referred to as the WSL daemon in this embodiment. Notably, a WSL daemon is configured within the WSL layer, capable of listening to specific UNIX domain sockets. This connects the UNIX domain socket and the WSL daemon socket, enabling control commands to be transmitted within the corresponding WSL daemon. In this embodiment, the WSL daemon socket is referred to as the second socket. A verification signature is then set in the control command for subsequent validity verification. Finally, the control command is sent to the corresponding WSL daemon.

[0042] In the above scheme, a first socket is created and connected to the second socket of the compatibility layer daemon process for transmitting control commands. A verification signature is set for the control commands for subsequent validity verification, so that the control commands can still be reliable after they are transmitted to the host machine, thereby improving the reliability of the host machine control.

[0043] A preferred embodiment involves real-time monitoring of the first socket and generation of a host machine mapping file based on the compatibility layer daemon, comprising: real-time monitoring of the control commands stored in the first socket through the compatibility layer daemon; validating the control commands based on their timestamps and verification signatures; and mapping the first socket to the host machine to generate a host machine mapping file if the control commands pass the validity verification, wherein the host machine mapping file includes the control commands.

[0044] One preferred implementation involves the WSL daemon listening to UNIX domain sockets and mapping the UNIX domain sockets to the host machine. For example, mapping / var / run / hostctl.sock to c: / / var / run / hostctl.sock as the host machine mapping file. The WSL daemon monitors control commands stored in the UNIX domain socket in real time. Each control command contains a timestamp and a verification signature. To prevent command tampering, the control commands must be validated before mapping the UNIX domain socket to the host machine. Validation includes timestamp verification and signature verification. Timestamp verification checks the difference between the command's generation time and the current time. If it exceeds a set threshold, such as ±30 seconds, it is considered a replay attack and fails the validation. Signature verification verifies the signature generated by the HMAC-SHA256 algorithm. If the signature calculated by the host machine does not match the signature carried in the command, the command is considered tampered with and fails the validation. Only when the control command passes the validation can the mapping between the UNIX domain socket and the host machine be executed to generate the host machine mapping file. The mapping process involves mapping / var / run / hostctl.sock on the UNIX domain socket path to c: / / var / run / hostctl.sock on the host machine path. This process relies on the virtualized file system driver of the compatibility layer and does not require exposing real network ports.

[0045] In the above scheme, the compatibility layer daemon listens to the first socket in real time to capture control commands. Then, it performs validity verification based on the pre-set timestamp and verification signature in the control command to ensure communication security and prevent the control command from being tampered with. When the control command passes the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file. The control command is mapped into a format that the host machine can parse for subsequent control of the host machine. This enables cross-system control of the host machine directly through a web page, minimizes the host machine's network port exposure surface, and improves the reliability of host machine control.

[0046] In a preferred embodiment, the host machine mapping file is sent to a host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file. This includes: writing the host machine mapping file into the host machine named pipe; listening to the host machine named pipe using a host machine listening script to obtain a listening result; if the listening result indicates an instruction update, then calling a host machine system command to parse the host machine mapping file to obtain the corresponding control instructions; and controlling the host machine using the control instructions.

[0047] One preferred implementation involves writing a host machine mapping file to a host machine named pipe. A batch script continuously monitors the host machine named pipe. When a host machine mapping file is detected being written to the host machine named pipe, the corresponding Windows system command is invoked to parse the host machine mapping file and obtain the corresponding control instructions to control the host machine. In this embodiment, the batch script is referred to as the monitoring script, which monitors the host machine named pipe and sets a detection time interval, for example, checking for instruction updates in the host machine named pipe every 1 second. Whenever an instruction update occurs in the host machine named pipe, the host machine system command is invoked to parse the host machine mapping file, extracting the control instructions generated by the client accessing the Web service. Notably, the blocking read characteristic of the host machine named pipe is utilized; it remains in a dormant state when there are no instructions, and automatically creates a new pipe file when a new instruction is written, triggering the parse script to wake it up. The parse script is the host machine system command. Furthermore, the pipe file can be deleted after each invocation of the host machine system command to await the next update, reducing resource consumption.

[0048] In the above scheme, the host machine mapping file is written into the host machine named pipe. The listening script listens to the host machine named pipe to detect whether there are any control command updates in real time. If a control command update is detected, the host machine system command is called to parse the host machine mapping file in the host machine named pipe to obtain the corresponding control command and control the host machine. By constructing a command proxy link from the first socket to the named pipe, the webpage can directly control the host machine across systems, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0049] A preferred embodiment of controlling the host machine via the control command includes: generating a temporary session ID after the control command arrives at the host machine; obtaining a webpage operation type and a timestamp based on the temporary session ID and the control command; and controlling the host machine according to the webpage operation type when the timestamp is valid.

[0050] In one preferred implementation, to prevent port misuse, a temporary session ID is generated whenever a control command arrives at the host machine. This temporary session ID is typically set to 128 bits, consisting of a session key and a random number. Both parties agree on a data packet header, which includes the temporary session identifier, operation type code, and timestamp. This creates a temporary firewall-like mechanism. The timestamp of the control command is then verified to prevent command invalidation. Finally, the host machine is controlled based on the valid timestamp of the control command and its corresponding operation type from the web service, such as shutdown, restart, volume up, and volume down. Notably, to ensure command security, the temporary session ID expires immediately after command execution to prevent replay attacks. Furthermore, interaction is conducted through the local file system, eliminating the need to expose the real network port.

[0051] In the above scheme, after the control command arrives at the host machine, a temporary session ID is generated, and a second verification of the timestamp is performed to ensure that the timestamp is valid. Then, the host machine is controlled according to the web page operation type. A temporary ID firewall is built to minimize the network port exposure surface. Secondary verification is then used to ensure that the control command is not tampered with. In this way, the host machine can be directly controlled across systems through the web page, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0052] In a preferred embodiment of the present invention, a cross-system host control method is proposed, which further includes: receiving a survival signal periodically sent by the host, and terminating the control command currently running on the host when the survival signal is abnormal.

[0053] In a preferred implementation, to prevent erroneous operations, this embodiment of the invention also proposes a heartbeat monitoring scheme. During the host Windows service, a liveness signal is periodically sent to the WSL. After receiving the liveness signal, the WSL performs anomaly judgment on the signal. If the liveness signal is abnormal, it indicates that there may be an erroneous operation at this time. Therefore, the currently executing unfinished instruction is immediately terminated.

[0054] In the above scheme, the system periodically receives the liveness signal sent by the host machine, sets up a heartbeat monitoring mechanism to terminate abnormal commands in a timely manner, and performs cross-system control of the host machine directly through the web page in the constructed command proxy link, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0055] See Figure 3 , Figure 3 This is a schematic diagram of the module structure of a cross-system host control system provided in one embodiment of the present invention. Figure 3 As shown in the figure, this embodiment of the invention also provides a cross-system host control system, including: a control command acquisition module 201, a control command transmission module 202, a host machine mapping file acquisition module 203, and a host machine control module 204; the control command acquisition module 201 is used to receive control commands generated by a client through accessing a webpage; the control command transmission module 202 is used to create a first socket and send the control commands to the corresponding compatibility layer daemon process; the host machine mapping file acquisition module 203 is used to monitor the first socket in real time and generate a host machine mapping file based on the compatibility layer daemon process; the host machine control module 204 is used to send the host machine mapping file to the host machine named pipe to control the host machine according to the control commands corresponding to the host machine mapping file.

[0056] One specific implementation involves a client accessing a webpage through a browser. This webpage offers various web services, such as shutdown, restart, volume up, and volume down. The client accesses these services, retrieves corresponding control commands, and sends these commands to the backend. These control commands, including shutdown and reboot commands, are deployed in a compatibility layer (WSL). A UNIX domain socket, such as ` / var / run / hostctl.sock`, is created to receive the control commands from the client. In this embodiment, this UNIX domain socket is designated as the first socket. The UNIX domain socket is then sent to the compatibility layer daemon. This is referred to as the WSL daemon. It's worth noting that WSL includes a daemon that can monitor specific UNIX domain sockets. Therefore, by monitoring UNIX domain sockets and mapping them to the host machine—for example, mapping ` / var / run / hostctl.sock` to `c: / / var / run / hostctl.sock` as the host machine's mapping file—and writing this mapping file to a named pipe on the host machine, a batch script continuously monitors the host machine's named pipe. When it detects writing to the host machine's named pipe, it calls the corresponding Windows system commands to parse the mapping file and obtain the necessary control instructions to control the host machine.

[0057] This invention proposes a cross-system host control system. A control command acquisition module receives control commands generated by accessing a webpage from a client. A control command transmission module then creates a first socket and sends the control commands to a compatibility layer daemon. A host mapping file acquisition module then monitors the first socket in real time through the compatibility layer daemon to generate a host mapping file. Finally, the host control module sends the host mapping file to a host named pipe for further parsing of the control commands. This constructs a command proxy link from the first socket to the named pipe, enabling cross-system control of the host machine directly via a webpage, minimizing the host machine's network port exposure surface, and improving the reliability of host machine control.

[0058] In a preferred embodiment, the host machine mapping file acquisition module 203 is used to monitor the first socket in real time and generate a host machine mapping file based on the compatibility layer daemon process, including: an instruction monitoring unit 301 and an instruction mapping unit 302; the instruction monitoring unit 301 is used to monitor the control instructions stored in the first socket in real time through the compatibility layer daemon process; the instruction mapping unit 302 is used to verify the validity of the control instructions based on the timestamp and verification signature of the control instructions. If the control instructions pass the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file, wherein the host machine mapping file includes the control instructions.

[0059] In the above scheme, the command listening unit listens to the first socket in real time in the compatibility layer daemon process to capture control commands. The command mapping unit then performs validity verification based on the pre-set timestamp and verification signature in the control command to ensure communication security and prevent the control command from being tampered with. When the control command passes the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file, which maps the control command into a format that the host machine can parse for subsequent control of the host machine. This enables cross-system control of the host machine directly through a web page, minimizes the host machine's network port exposure surface, and improves the reliability of host machine control.

[0060] In a preferred embodiment, the host machine control module 204 is used to send the host machine mapping file to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file. The module includes: a host machine named pipe listening unit 401, a file parsing unit 402, and a control unit 403. The host machine named pipe listening unit 401 is used to write the host machine mapping file into the host machine named pipe and listen to the host machine named pipe through a listening script on the host machine to obtain a listening result. The file parsing unit 402 is used to, if the listening result indicates an instruction update, call a host machine system command to parse the host machine mapping file to obtain the corresponding control instruction. The control unit 403 is used to control the host machine through the control instruction.

[0061] In the above scheme, the host machine named pipe listening unit writes the host machine mapping file into the host machine named pipe. The listening script listens to the host machine named pipe to detect whether there are any control command updates in real time. If a control command update is detected, the file parsing unit will call the host machine system command to parse the host machine mapping file in the host machine named pipe to obtain the corresponding control command. The control unit controls the host machine through the control command. By constructing an instruction proxy link from the first socket to the named pipe, the webpage can directly control the host machine across systems, minimizing the host machine's network port exposure surface and improving the reliability of host machine control.

[0062] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

[0063] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the described specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0064] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

Claims

1. A cross-system host control method, characterized in that, Performed by the compatibility layer, including: Receiving control instructions generated by the client through accessing a webpage includes: receiving the webpage operation type and timestamp recorded when the client accesses a webpage deployed in the compatibility layer; and generating corresponding control instructions based on the webpage operation type and timestamp. Creating a first socket and sending the control command to the corresponding compatibility layer daemon process includes: creating a first socket and connecting the first socket to a second socket of the compatibility layer daemon process; setting a verification signature for the control command and sending the control command to the corresponding compatibility layer daemon process through the first socket; Based on the compatibility layer daemon process, real-time monitoring of the first socket and generation of a host machine mapping file includes: real-time monitoring of the control commands stored in the first socket through the compatibility layer daemon process; validating the control commands based on the timestamp and verification signature of the control commands; if the control commands pass the validity verification, mapping the first socket to the host machine to generate a host machine mapping file, wherein the host machine mapping file includes the control commands; The host machine mapping file is sent to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file.

2. The cross-system host control method as described in claim 1, characterized in that, Sending the host machine mapping file to the host machine named pipe to control the host machine according to the corresponding control instructions in the host machine mapping file includes: The host machine mapping file is written to the host machine named pipe, and the host machine's listening script listens to the host machine named pipe to obtain the listening result; If the monitoring result indicates that there is an instruction update, then the host system command is invoked to parse the host mapping file and obtain the corresponding control instruction; The host machine is controlled by the control commands.

3. The cross-system host control method as described in claim 2, characterized in that, Controlling the host machine via the control commands includes: When the control command arrives at the host machine, a temporary session ID is generated; Based on the temporary session ID and the control command, obtain the webpage operation type and timestamp; When the timestamp is valid, the host machine is controlled according to the webpage operation type.

4. A cross-system host control method as described in any one of claims 1-3, characterized in that, Also includes: Receives a survival signal periodically sent by the host machine. When the survival signal is abnormal, terminates the control commands currently running on the host machine.

5. A cross-system host control system, characterized in that, Performing a cross-system host control method as described in any one of claims 1 to 4, comprising: The system includes a control command acquisition module, a control command transmission module, a host machine mapping file acquisition module, and a host machine control module. The control instruction acquisition module is used to receive control instructions generated by the client through accessing a webpage, including: receiving the webpage operation type and timestamp recorded by the client accessing a webpage deployed in the compatibility layer; and generating corresponding control instructions based on the webpage operation type and timestamp. The control command transmission module is used to create a first socket and send the control command to the corresponding compatibility layer daemon process, including: creating a first socket and connecting the first socket to a second socket of the compatibility layer daemon process; setting a verification signature for the control command and sending the control command to the corresponding compatibility layer daemon process through the first socket; The host machine mapping file acquisition module is used to monitor the first socket in real time and generate a host machine mapping file based on the compatibility layer daemon process, including: an instruction monitoring unit and an instruction mapping unit; the instruction monitoring unit is used to monitor the control instructions stored in the first socket in real time through the compatibility layer daemon process; the instruction mapping unit is used to verify the validity of the control instructions based on the timestamp and verification signature of the control instructions. If the control instructions pass the validity verification, the first socket is mapped to the host machine to generate a host machine mapping file, wherein the host machine mapping file includes the control instructions; The host machine control module is used to send the host machine mapping file to the host machine named pipe, so as to control the host machine according to the corresponding control instructions in the host machine mapping file.

6. A cross-system host control system as described in claim 5, characterized in that, The host machine control module is used to send the host machine mapping file to the host machine named pipe, so as to control the host machine according to the corresponding control instructions in the host machine mapping file, including: Host machine named pipe listening unit, file parsing unit, and control unit; The host machine named pipe listening unit is used to write the host machine mapping file into the host machine named pipe, and to listen to the host machine named pipe through the host machine listening script to obtain the listening result; The file parsing unit is used to call the host system command to parse the host mapping file and obtain the corresponding control command if the monitoring result indicates that there is an instruction update. The control unit is used to control the host machine through the control commands.

Citation Information

Patent Citations

  • Docker container-oriented communication method and system for calling host machine command

    CN110673963A

  • Remote desktop implementation method and server

    CN118900265A