WO2017167103A1 - Remote command processing method and device - Google Patents

Remote command processing method and device Download PDF

Info

Publication number
WO2017167103A1
WO2017167103A1 PCT/CN2017/077727 CN2017077727W WO2017167103A1 WO 2017167103 A1 WO2017167103 A1 WO 2017167103A1 CN 2017077727 W CN2017077727 W CN 2017077727W WO 2017167103 A1 WO2017167103 A1 WO 2017167103A1
Authority
WO
WIPO (PCT)
Prior art keywords
remote command
command
response data
switch parameter
remote
Prior art date
Application number
PCT/CN2017/077727
Other languages
French (fr)
Chinese (zh)
Inventor
肖雄
吴堃
谢晓辉
郝建青
孙成浩
Original Assignee
阿里巴巴集团控股有限公司
肖雄
吴堃
谢晓辉
郝建青
孙成浩
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 肖雄, 吴堃, 谢晓辉, 郝建青, 孙成浩 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017167103A1 publication Critical patent/WO2017167103A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a remote command processing method and a remote command processing device.
  • IT Information Technology
  • Fabric is a remotely executed execution framework for remote commands such as SSH (Secure Shell Protocol, Secure Shell) commands widely used in the open source community. Its functions include: executing local or remote commands, uploading/downloading files, and others. Accessibility features such as prompting user input, aborting execution, etc. Based on Fabric, companies can easily develop their own operation and maintenance systems.
  • SSH Secure Shell Protocol
  • Secure Shell Secure Shell
  • the current remote command may specifically include: an interactive command and a non-interactive command.
  • the interactive command may be a command that requires the client to interact in order to continue execution during the execution of the command; the most common scenario is: when deleting an interactive command for a system file, the operation and maintenance system outputs the input required.
  • the prompt for the administrator password, and the interactive command is executed after the administrator enters the administrator password.
  • Non-interactive commands can be commands that complete the entire command execution process without the need for the client to interact during command execution.
  • the client intercepts the return data of the remote command, and finds whether the returned data contains a preset keyword, and if so, confirms The current remote command requires the client to interact. If it does not, confirm that the current remote command does not require the client to interact.
  • the above The process of finding whether the returned keyword includes the preset keyword may include: the client may continuously read the return data of the server, and determine whether the returned data includes preset keywords such as password, sudo, and input.
  • the traditional scheme will also perform corresponding interception and lookup operations.
  • the above interception and lookup operations will occupy IO (Input-Output) processing between the client and the server. time.
  • IO Input-Output
  • the return data is intercepted and searched by segments, it is necessary to repeatedly perform multiple interception and search operations for the return data of a single remote command, thereby greatly reducing the number of interception and search operations.
  • IO handles performance and reduces the speed of execution of remote commands. For large-scale operation and maintenance systems, the time consumption of remote commands will seriously slow down the processing speed of the entire operation and maintenance system.
  • the technical problem to be solved by the embodiments of the present application is to provide a method for processing a remote command, which can save time and cost of intercepting and searching operations of return data, thereby improving IO processing performance and improving execution speed of remote commands. .
  • the embodiment of the present application further provides a remote command processing device to ensure implementation and application of the foregoing method.
  • the present application discloses a method for processing a remote command, including:
  • the response data is output when the switch parameter corresponding to the remote command is off.
  • the trigger request carries the address information of the command file, and the basis is The steps of triggering the request, obtaining the remote command and its corresponding switch parameters, including:
  • the triggering request carries the address information of the command file and the switch parameter of the remote command in the command file, and the step of acquiring the remote command and the corresponding switch parameter according to the trigger request, including :
  • the method further includes:
  • the response data is intercepted when the switch parameter corresponding to the remote command is on;
  • the step of receiving the response data returned by the server for the remote command includes:
  • the response data segment returned by the server for the remote command is read from the client's socket interface.
  • the step of outputting the response data when the switch parameter corresponding to the remote command is off includes:
  • the response data is output when the content of the response data segment is not empty and the switch parameter corresponding to the remote command is off.
  • a remote command processing apparatus including:
  • a first receiving module configured to receive a trigger request of a remote command
  • An acquiring module configured to acquire a remote command and a corresponding switch parameter according to the trigger request
  • a sending module configured to send the remote command to a server
  • a second receiving module configured to receive response data returned by the server for the remote command
  • a first output module configured to output the response data when the switch parameter corresponding to the remote command is off.
  • the triggering request carries the address information of the command file
  • the acquiring module includes:
  • the first obtaining submodule is configured to read the remote command and the corresponding switch parameter from the command file according to the address information.
  • the triggering request carries the address information of the command file and the switch parameter of the remote command in the command file
  • the acquiring module includes:
  • the second obtaining submodule is configured to read the remote command from the command file according to the address information, and associate the read remote command with the switch parameter carried in the trigger request.
  • the device further includes:
  • An intercepting module configured to intercept the response data when a switch parameter corresponding to the remote command is turned on
  • a lookup module for finding an interactive command from the intercepted response data that requires the client to interact
  • a second output module configured to output interaction prompt information corresponding to the interactive command.
  • the embodiments of the present application include the following advantages:
  • the embodiment of the present application may obtain the remote command and the corresponding switch parameter according to the trigger request of the remote command, and output the response data when the switch parameter corresponding to the remote command is closed;
  • the switch parameter corresponding to the remote command is off, the interception and search operations of the return data may not be performed, thereby saving the interception of the returned data and
  • the time taken to find an operation can improve IO processing performance and can increase the execution speed of remote commands.
  • FIG. 1 is a schematic diagram of an application environment of a remote command processing method of the present application
  • FIG. 2 is a flow chart showing the steps of a first embodiment of a method for processing a remote command according to the present application
  • FIG. 3 is a flow chart showing the steps of a second embodiment of a method for processing a remote command according to the present application
  • Figure 4 is a schematic illustration of a response data of the present application.
  • FIG. 5 is a flow chart showing the steps of a third embodiment of a method for processing a remote command according to the present application.
  • FIG. 6 is a structural block diagram of an embodiment of a remote command processing apparatus of the present application.
  • the method for determining the non-interactive command in the large data volume transmission scenario in the conventional solution leads to a technical problem that the IO processing performance is low and the execution speed of the remote command is slow.
  • the embodiment of the present application can obtain the remote device according to the trigger request of the remote command. And the corresponding switch parameter, and when the switch parameter corresponding to the remote command is off, the response data is output; because the switch parameter corresponding to the remote command is off, the embodiment may not perform The interception and lookup operations of the data are returned, so that the time taken to intercept and find the return data can be saved, thereby improving the IO processing performance and improving the execution speed of the remote command.
  • the embodiment of the present application can be applied to an application scenario of an operation and maintenance system such as Fabric and Ansible, which is used to improve the IO processing performance and the execution speed of the remote command in the operation and maintenance system. It should be understood that the embodiments of the present application do not limit the specific application scenarios.
  • an operation and maintenance system such as Fabric and Ansible
  • the processing method of the remote command provided by the embodiment of the present application can be applied to the application environment shown in FIG. 1.
  • the client 100 and the server 200 can be located in a wired or wireless network, through the wired or wireless network.
  • the client 100 performs data interaction with the server 200.
  • the client 100 can run on a physical machine or a virtual machine, and can receive a trigger request of a remote command input by the user, obtain a remote command and its corresponding switch parameter according to the trigger request, and send the Remote command to cause the server 200 to obtain response data of the remote command.
  • the response data may include the interactive prompt information of the remote command when the remote command is an interactive command, and the response data may include the As a result of the processing of the remote command, it can be understood that the embodiment of the present application does not limit the specific response data.
  • the client 100 can also receive the response data returned by the server 200 for the remote command, and output the response data when the switch parameter corresponding to the remote command is off.
  • the foregoing switch parameter may specifically include turning off or on, wherein the closing may be used to indicate that the intercepting and searching operations of the response data are not performed, and the opening and the searching operation for indicating the response data may be indicated.
  • the application environment shown in FIG. 1 is only used as an application example.
  • One of the purposes of the input process in the embodiment of the present application is that when the switch parameter corresponding to the remote command is off, the interception and searching of the returned data may not be performed.
  • the operation can solve the technical problem that the judgment process of the non-interactive command in the large data volume transmission scenario leads to low IO processing performance and slow execution speed of the remote command, and the specific application environment of the remote command processing flow is not limited.
  • FIG. 2 a flow chart of the steps of the first embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
  • Step 201 Receive a trigger request of a remote command.
  • Step 202 Acquire a remote command and corresponding switch parameters according to the trigger request.
  • the trigger request may be input by a user, and may be used to trigger a remote command, so that the client sends a corresponding remote command to the server.
  • the client intercepts the returned data of the remote command and finds whether the returned data contains a preset keyword. If yes, it confirms that the current remote command requires the client to interact.
  • the process of searching for the preset keyword in the returned data may include: the client may continuously read the return data of the server, and determine whether the returned data includes preset keywords such as password, sudo, and input. .
  • the user in the embodiment of the present application may include: an operation and maintenance personnel with professional knowledge, and the operation and maintenance personnel are generally familiar with the remote command. Therefore, for the remote command to be triggered, the operation and maintenance personnel are familiar with whether the remote command includes the above.
  • the preset keyword is so as to be able to clarify whether it needs the client to perform the interaction. Therefore, the user of the embodiment of the present application has the ability to accurately set the switch parameters of the remote command to be triggered. Specifically, the remote command to be triggered requires the client.
  • the user can set the corresponding switch parameter to be on, or, when the remote command to be triggered does not require the client to interact (ie, is a non-interactive command), the user The corresponding switch parameter can be set to off.
  • the triggering request may carry the address information of the command file
  • the step 202 of acquiring the remote command and the corresponding switch parameter according to the triggering request may specifically include:
  • Step A1 Read the remote command and its corresponding switch parameter from the command file according to the address information.
  • one or more remote commands may be recorded in the command file, and the command The file is usually written by the user, so the user can accurately determine whether the preset keyword is included in the command file, so that it can be clear whether the remote command in the command file requires the client to interact. Therefore, on the basis that the user clarifies whether the remote command requires the client to interact in the command file, it can record the corresponding switch parameter in the command file.
  • the number of the switch parameters recorded in the command file may be one to indicate that there is a remote command in the command file that requires the client to interact. Alternatively, the number of switch parameters recorded in the command file can be the same as the number of remote commands to identify whether each remote command requires the client to interact. It can be understood that the specific recording manner of the switch parameters in the above command file is not limited in the embodiment of the present application.
  • the remote command and the switch parameter recorded by the command file may have corresponding preset positions.
  • the preset position of the switch parameter may be the first line or the last line or The line number is set, so step A1 may first load the above command file according to the above address information, and read the remote command and its corresponding switch parameter from the command file according to the preset position. It can be understood that the specific reading process of reading the remote command and its corresponding switch parameter from the command file according to the address information is not limited.
  • the trigger request may carry the address information of the command file and the switch parameter of the remote command in the command file, and the step of acquiring the remote command and the corresponding switch parameter according to the trigger request 202, specifically may include:
  • Step B1 Read a remote command from the command file according to the address information, and associate the read remote command with a switch parameter carried in the trigger request.
  • the foregoing association may associate the remote command with the corresponding switch parameter. If it is recorded that there are M remote commands in the command file, and the trigger request carries N switch parameters, the M remote commands and the N switch parameters may be established. The mapping relationship between.
  • step B1 The remote command can be read from the command file according to the address information, and the read remote command is associated with the switch parameter carried in the trigger request to obtain the remote command and its corresponding switch parameter.
  • the triggering request in the embodiment of the present application may be input by the user through a keyboard, a mouse, or the like.
  • the specific manner of obtaining the trigger request is not limited in the embodiment of the present application.
  • the foregoing technical solution 1 and technical solution 2 are only an optional technical solution for acquiring a remote command and its corresponding switch parameter according to the trigger request.
  • the triggering request the other technical solution for acquiring the remote command and its corresponding switch parameter, for example, may provide a preset interface, so that the user submits the trigger request through the preset interface, and carries the remote command and the trigger request in the trigger request
  • Corresponding switch parameters wherein the trigger request may carry multiple remote commands and their corresponding switch parameters, or may carry multiple remote commands and switch parameters corresponding to each remote command, etc.
  • the specific technical solution for triggering the request and obtaining the remote command and its corresponding switch parameters is not limited.
  • Step 203 Send the remote command to a server.
  • the client may send a string corresponding to the remote command to the server to notify the server to execute the remote command, where one remote command may be sent at a time, or multiple remote commands may be sent at a time.
  • the server may determine whether the remote command requires the client to interact (for example, whether a password is required, etc.), and if necessary, the corresponding interaction prompt may be carried in the response data sent to the client.
  • the information if not required, can carry the corresponding processing result in the response data sent to the client.
  • Step 204 Receive response data returned by the server for the remote command.
  • the step 204 of receiving the response data returned by the server for the remote command may specifically include:
  • Step C1 Read a response data segment returned by the server for the remote command from a SOCKET (socket) interface of the client.
  • the socket interface may be provided by a client operating system
  • the response data segment may include data of a large amount of data, for example, the length may be 4096 bytes. It is understood that the specific length of the above response data segment is not limited in the embodiment of the present application.
  • Step 205 Output the response data when the switch parameter corresponding to the remote command is off.
  • the step 205 of the step of outputting the response data may include: displaying the response data directly through the data stream when the switch parameter corresponding to the remote command is off On the display device, that is, the response data can be directly provided to the user; since the return data can be intercepted and searched for non-interactive commands, the cost of intercepting and searching for the returned data can be saved. Time.
  • the step 205 of outputting the response data may include: when the content of the response data segment is not empty, and the switch parameter corresponding to the remote command is off, The response data is output.
  • the optional embodiment may first determine whether the content of the response data segment is empty, and if not, determine whether the switch parameter corresponding to the remote command is off, and the content of the response data segment. The response data is output when it is not empty and the switch parameter corresponding to the remote command is off.
  • the embodiment of the present application can obtain the remote command and its corresponding switch parameter according to the trigger request of the remote command, and output the response data when the switch parameter corresponding to the remote command is off; For example, when the switch parameter corresponding to the remote command is off, the interception and search operations of the return data may not be performed, thereby saving time and time required for intercepting and searching operations of the returned data, thereby improving IO processing performance, and Can improve the execution speed of remote commands.
  • FIG. 3 a flow chart of the steps of the second embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
  • Step 301 Receive a trigger request of a remote command.
  • Step 302 Acquire a remote command and corresponding switch parameters according to the trigger request.
  • Step 303 Send the remote command to a server.
  • Step 304 Receive response data returned by the server for the remote command.
  • Step 305 Output the response data when the switch parameter corresponding to the remote command is off.
  • Step 306 When the switch parameter corresponding to the remote command is turned on, intercept the response data.
  • Step 307 Search for an interactive command that requires the client to interact from the intercepted response data.
  • Step 308 Output interactive prompt information corresponding to the interactive command.
  • step 306 to step 308 of the embodiment the response data is intercepted and searched to identify an interactive command from the response data that requires the client to interact, and then the pair can be obtained.
  • the interactive information should be prompted.
  • the foregoing step 307 may specifically include: intercepting the response data, cutting the intercepted response data by lines ( ⁇ r, ⁇ n, ⁇ r ⁇ n), and cutting Each current line determines whether it contains a preset keyword (sudo, password); if yes, it can output a prompt box to prompt the client to interact; if not, the response data corresponding to the current line can be output, and step 307 is performed. Continue to the next judgment until all response data has been processed
  • FIG. 4 there is shown a schematic diagram of a response data of the present application, wherein the fabric can intercept and search the response data returned by 10.125.0.171 (server), wherein the response data of a certain row is found to contain "password". "For keywords, you can output the interactive prompt message "out:[sudo]password for xiong.xiaox:” to prompt the user to enter the password.
  • the fabric can send the password entered by the user back to the 10.125.0.171 server.
  • the server is configured to authenticate the password; wherein, when the authentication of the password is passed, the server may continue to execute the corresponding remote command, and send corresponding response data to the client, where the response data may include execution of the remote command.
  • the server may refuse to execute the corresponding remote command, and send corresponding response data to the client, where the response data may include a password error result of the remote command.
  • the above is only an example of the processing procedure as the response data. In fact, the specific processing procedure of the response data is not limited in the embodiment of the present application.
  • FIG. 5 a flow chart of the steps of the third embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
  • Step 501 The client receives a trigger request of a remote command.
  • Step 502 The client obtains the remote command and its corresponding switch parameter according to the trigger request.
  • Step 503 The client sends the remote command to the server.
  • Step 504 The client reads, from the socket interface, a response data segment returned by the server for the remote command.
  • Step 505 the client determines whether the data of the response data segment is empty, and if so, the process ends; otherwise, step 506 is performed;
  • Step 506 the client determines whether the switch parameter corresponding to the remote command is off, and if so, step 507 is performed, otherwise, step 508 is performed;
  • Step 507 The client outputs the response data.
  • Step 508 The client intercepts the response data.
  • Step 509 The client searches for the interactive command that requires the client to interact from the intercepted response data.
  • Step 510 The client outputs the interaction prompt information corresponding to the interactive command.
  • step 507 may also write response data to the cache for processing requirements of the remote command.
  • FIG. 6 a structural block diagram of an embodiment of a remote command processing apparatus of the present application is shown, which may specifically include the following modules:
  • the first receiving module 601 is configured to receive a trigger request of the remote command
  • the obtaining module 602 is configured to obtain a remote command and a corresponding switch parameter according to the trigger request.
  • a sending module 603, configured to send the remote command to a server
  • a second receiving module 604 configured to receive response data returned by the server for the remote command
  • the first output module 605 is configured to output the response data when the switch parameter corresponding to the remote command is off.
  • the triggering request may carry the address information of the command file
  • the acquiring module 602 may specifically include:
  • the first obtaining submodule is configured to read the remote command and the corresponding switch parameter from the command file according to the address information.
  • the triggering request may include the address information of the command file and the switch parameter of the remote command in the command file, where the obtaining module 602 may specifically include:
  • the second obtaining submodule is configured to read the remote command from the command file according to the address information, and associate the read remote command with the switch parameter carried in the trigger request.
  • the apparatus may further include:
  • An intercepting module configured to intercept the response data when a switch parameter corresponding to the remote command is turned on
  • a lookup module for finding an interactive command from the intercepted response data that requires the client to interact
  • a second output module configured to output interaction prompt information corresponding to the interactive command.
  • the second receiving module 603 may specifically include:
  • Reading a submodule for reading a response data segment returned by the server for the remote command from a socket interface of the client is
  • the first output module 605 may specifically include:
  • an output submodule configured to output the response data when the content of the response data segment is not empty and the switch parameter corresponding to the remote command is off.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • embodiments of the embodiments of the present application can be provided as a method, apparatus, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is a computer readable medium Example.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-persistent computer readable media, such as modulated data signals and carrier waves.
  • Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine such that instructions are executed by a processor of a computer or other programmable data processing terminal device Generated for implementing a process or multiple processes and/or parties in a flowchart
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the instruction device implements the functions specified in one or more blocks of the flowchart or in a flow or block of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Selective Calling Equipment (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

Provided in embodiments of the present application are a remote command processing method and device, the method specifically comprising: receiving a trigger request of a remote command; acquiring, according to the trigger request, the remote command and an on-off parameter corresponding thereto; transmitting to a server the remote command; receiving response data returned by the server for the remote command; and if the on-off parameter corresponding to the remote command is off, then outputting the response data. The embodiments of the present application can reduce time consumed by intercepting and querying operation for returned data, thereby improving IO processing performance, and accelerating execution of a remote command.

Description

一种远程命令的处理方法和装置Method and device for processing remote command 技术领域Technical field
本申请涉及通信技术领域,特别是涉及一种远程命令的处理方法、以及一种远程命令的处理装置。The present application relates to the field of communications technologies, and in particular, to a remote command processing method and a remote command processing device.
背景技术Background technique
随着信息时代的持续发展,IT(信息技术,Information Technology)运维已经成为IT服务内涵中重要的组成部分。面对越来越复杂的业务,面对越来越多样化的用户需求,不断扩展的IT应用需要越来越合理的模式来保障IT服务能灵活便捷、安全稳定地持续保障,这种模式中的保障因素就是IT运维。With the continuous development of the information age, IT (Information Technology) operation and maintenance has become an important part of the IT service. Faced with increasingly complex businesses, in the face of increasingly diverse user needs, ever-expanding IT applications require more and more reasonable models to ensure that IT services are flexible, convenient, secure and stable. The guarantee factor is IT operation and maintenance.
Fabric是目前开源社区中被广泛使用的SSH(安全外壳协议,Secure Shell)命令等远程命令的远程下发执行框架,其提供的功能主要包括:执行本地或远程命令、上传/下载文件,以及其他辅助功能,如提示用户输入、中止执行等。基于Fabric,各企业可方便地开发出自身的运维系统。Fabric is a remotely executed execution framework for remote commands such as SSH (Secure Shell Protocol, Secure Shell) commands widely used in the open source community. Its functions include: executing local or remote commands, uploading/downloading files, and others. Accessibility features such as prompting user input, aborting execution, etc. Based on Fabric, companies can easily develop their own operation and maintenance systems.
目前的远程命令具体可以包括:交互式命令和非交互式命令两种。其中,交互式命令可以为在命令执行过程中,需要客户端进行交互才能继续执行的命令;最常见的场景为:在删除针对某个系统文件的交互式命令时,运维系统会输出需要输入管理员密码的提示,并且,在客户端输入管理员密码后,该交互式命令才被继续执行。非交互式命令可以为在命令执行过程中,不需要客户端进行交互即可完成整个命令执行过程的命令。The current remote command may specifically include: an interactive command and a non-interactive command. The interactive command may be a command that requires the client to interact in order to continue execution during the execution of the command; the most common scenario is: when deleting an interactive command for a system file, the operation and maintenance system outputs the input required. The prompt for the administrator password, and the interactive command is executed after the administrator enters the administrator password. Non-interactive commands can be commands that complete the entire command execution process without the need for the client to interact during command execution.
为了判断当前远程命令是否需要客户端进行交互,本领域中的传统方案通常为:客户端对远程命令的返回数据进行拦截,并查找该返回数据中是否包含预置关键字,若包含,则确认当前远程命令需要客户端进行交互,若不包含,则确认当前远程命令不需要客户端进行交互。例如,上述 查找该返回数据中是否包含预置关键字的过程具体可以包括:客户端可以不停地读取服务器的返回数据,并判断该返回数据中是否包含password、sudo、input等预置关键字。In order to determine whether the current remote command requires the client to interact, the conventional solution in the field is usually: the client intercepts the return data of the remote command, and finds whether the returned data contains a preset keyword, and if so, confirms The current remote command requires the client to interact. If it does not, confirm that the current remote command does not require the client to interact. For example, the above The process of finding whether the returned keyword includes the preset keyword may include: the client may continuously read the return data of the server, and determine whether the returned data includes preset keywords such as password, sudo, and input.
然而,在当前远程命令为非交互式命令时,传统方案也会进行相应的拦截和查找操作,上述拦截和查找操作将会占用客户端与服务器之间的IO(输入输出,Input-Output)处理时间。尤其是在上述返回数据为大数据量的数据时,由于是按段进行返回数据的拦截和查找操作,因此需要针对单个远程命令的返回数据重复执行多次拦截和查找操作,从而大大地降低了IO处理性能,并且,降低了远程命令的执行速度。而对于大规模的运维系统而言,其远程命令的耗时将严重拖慢整个运维系统的处理速度。However, when the current remote command is a non-interactive command, the traditional scheme will also perform corresponding interception and lookup operations. The above interception and lookup operations will occupy IO (Input-Output) processing between the client and the server. time. Especially when the above-mentioned return data is a large amount of data, since the return data is intercepted and searched by segments, it is necessary to repeatedly perform multiple interception and search operations for the return data of a single remote command, thereby greatly reducing the number of interception and search operations. IO handles performance and reduces the speed of execution of remote commands. For large-scale operation and maintenance systems, the time consumption of remote commands will seriously slow down the processing speed of the entire operation and maintenance system.
发明内容Summary of the invention
本申请实施例所要解决的技术问题是提供一种远程命令的处理方法,能够节省返回数据的拦截和查找操作所花费的耗时,从而能够提高IO处理性能,并且,能够提高远程命令的执行速度。The technical problem to be solved by the embodiments of the present application is to provide a method for processing a remote command, which can save time and cost of intercepting and searching operations of return data, thereby improving IO processing performance and improving execution speed of remote commands. .
相应的,本申请实施例还提供了一种远程命令的处理装置,用以保证上述方法的实现及应用。Correspondingly, the embodiment of the present application further provides a remote command processing device to ensure implementation and application of the foregoing method.
为了解决上述问题,本申请公开了一种远程命令的处理方法,包括:In order to solve the above problem, the present application discloses a method for processing a remote command, including:
接收远程命令的触发请求;Receiving a trigger request for a remote command;
依据所述触发请求,获取远程命令及其对应的开关参数;Obtaining a remote command and its corresponding switch parameter according to the trigger request;
向服务器发送所述远程命令;Sending the remote command to a server;
接收所述服务器针对所述远程命令返回的响应数据;Receiving response data returned by the server for the remote command;
在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。The response data is output when the switch parameter corresponding to the remote command is off.
可选地,所述触发请求中携带有命令文件的地址信息,则所述依据所 述触发请求,获取远程命令及其对应的开关参数的步骤,包括:Optionally, the trigger request carries the address information of the command file, and the basis is The steps of triggering the request, obtaining the remote command and its corresponding switch parameters, including:
依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。Reading the remote command and its corresponding switch parameter from the command file according to the address information.
可选地,所述触发请求中携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述依据所述触发请求,获取远程命令及其对应的开关参数的步骤,包括:Optionally, the triggering request carries the address information of the command file and the switch parameter of the remote command in the command file, and the step of acquiring the remote command and the corresponding switch parameter according to the trigger request, including :
依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。And reading, according to the address information, a remote command from the command file, and associating the read remote command with a switch parameter carried in the trigger request.
可选地,所述方法还包括:Optionally, the method further includes:
在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;The response data is intercepted when the switch parameter corresponding to the remote command is on;
从所拦截的响应数据中查找需要客户端进行交互的交互式命令;Find interactive commands that require client interaction from the intercepted response data;
输出所述交互式命令对应的交互提示信息。And outputting the interactive prompt information corresponding to the interactive command.
可选地,所述接收所述服务器针对所述远程命令返回的响应数据的步骤,包括:Optionally, the step of receiving the response data returned by the server for the remote command includes:
从客户端的套接字接口中读取所述服务器针对所述远程命令返回的响应数据段。The response data segment returned by the server for the remote command is read from the client's socket interface.
可选地,所述在所述远程命令对应的开关参数为关闭时,将所述响应数据输出的步骤,包括:Optionally, the step of outputting the response data when the switch parameter corresponding to the remote command is off includes:
在所述响应数据段的内容不为空、且所述远程命令对应的开关参数为关闭时,将所述响应数据输出。The response data is output when the content of the response data segment is not empty and the switch parameter corresponding to the remote command is off.
另一方面,本申请公开了一种远程命令的处理装置,包括:In another aspect, the present application discloses a remote command processing apparatus, including:
第一接收模块,用于接收远程命令的触发请求;a first receiving module, configured to receive a trigger request of a remote command;
获取模块,用于依据所述触发请求,获取远程命令及其对应的开关参数; An acquiring module, configured to acquire a remote command and a corresponding switch parameter according to the trigger request;
发送模块,用于向服务器发送所述远程命令;a sending module, configured to send the remote command to a server;
第二接收模块,用于接收所述服务器针对所述远程命令返回的响应数据;以及a second receiving module, configured to receive response data returned by the server for the remote command;
第一输出模块,用于在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。And a first output module, configured to output the response data when the switch parameter corresponding to the remote command is off.
可选地,所述触发请求中携带有命令文件的地址信息,则所述获取模块,包括:Optionally, the triggering request carries the address information of the command file, where the acquiring module includes:
第一获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。The first obtaining submodule is configured to read the remote command and the corresponding switch parameter from the command file according to the address information.
可选地,所述触发请求中携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述获取模块,包括:Optionally, the triggering request carries the address information of the command file and the switch parameter of the remote command in the command file, where the acquiring module includes:
第二获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。The second obtaining submodule is configured to read the remote command from the command file according to the address information, and associate the read remote command with the switch parameter carried in the trigger request.
可选地,所述装置还包括:Optionally, the device further includes:
拦截模块,用于在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;An intercepting module, configured to intercept the response data when a switch parameter corresponding to the remote command is turned on;
查找模块,用于从所拦截的响应数据中查找需要客户端进行交互的交互式命令;a lookup module for finding an interactive command from the intercepted response data that requires the client to interact;
第二输出模块,用于输出所述交互式命令对应的交互提示信息。And a second output module, configured to output interaction prompt information corresponding to the interactive command.
与现有技术相比,本申请实施例包括以下优点:Compared with the prior art, the embodiments of the present application include the following advantages:
本申请实施例可以依据远程命令的触发请求,获取远程命令及其对应的开关参数,并在所述远程命令对应的开关参数为关闭时,将所述响应数据输出;由于本申请实施例在所述远程命令对应的开关参数为关闭时,可以不进行返回数据的拦截和查找操作,因此,能够节省返回数据的拦截和 查找操作所花费的耗时,从而能够提高IO处理性能,并且,能够提高远程命令的执行速度。The embodiment of the present application may obtain the remote command and the corresponding switch parameter according to the trigger request of the remote command, and output the response data when the switch parameter corresponding to the remote command is closed; When the switch parameter corresponding to the remote command is off, the interception and search operations of the return data may not be performed, thereby saving the interception of the returned data and The time taken to find an operation can improve IO processing performance and can increase the execution speed of remote commands.
附图说明DRAWINGS
图1是本申请的一种远程命令的处理方法的应用环境的示意图;1 is a schematic diagram of an application environment of a remote command processing method of the present application;
图2是本申请的一种远程命令的处理方法实施例一的步骤流程图;2 is a flow chart showing the steps of a first embodiment of a method for processing a remote command according to the present application;
图3是本申请的一种远程命令的处理方法实施例二的步骤流程图;3 is a flow chart showing the steps of a second embodiment of a method for processing a remote command according to the present application;
图4是本申请的一种响应数据的示意;Figure 4 is a schematic illustration of a response data of the present application;
图5是本申请的一种远程命令的处理方法实施例三的步骤流程图;以及5 is a flow chart showing the steps of a third embodiment of a method for processing a remote command according to the present application;
图6是本申请的一种远程命令的处理装置实施例的结构框图。FIG. 6 is a structural block diagram of an embodiment of a remote command processing apparatus of the present application.
具体实施方式detailed description
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。The above described objects, features and advantages of the present application will become more apparent and understood.
针对传统方案中存在的大数据量传输场景中非交互式命令的判断过程导致IO处理性能低、以及远程命令的执行速度慢的技术问题,本申请实施例可以依据远程命令的触发请求,获取远程命令及其对应的开关参数,并在所述远程命令对应的开关参数为关闭时,将所述响应数据输出;由于本申请实施例在所述远程命令对应的开关参数为关闭时,可以不进行返回数据的拦截和查找操作,因此,能够节省返回数据的拦截和查找操作所花费的耗时,从而能够提高IO处理性能,并且,能够提高远程命令的执行速度。The method for determining the non-interactive command in the large data volume transmission scenario in the conventional solution leads to a technical problem that the IO processing performance is low and the execution speed of the remote command is slow. The embodiment of the present application can obtain the remote device according to the trigger request of the remote command. And the corresponding switch parameter, and when the switch parameter corresponding to the remote command is off, the response data is output; because the switch parameter corresponding to the remote command is off, the embodiment may not perform The interception and lookup operations of the data are returned, so that the time taken to intercept and find the return data can be saved, thereby improving the IO processing performance and improving the execution speed of the remote command.
本申请实施例可以应用于Fabric、Ansible等运维系统的应用场景中,用于提高上述运维系统的提高IO处理性能及远程命令的执行速度,可以 理解,本申请实施例对于具体的应用场景不加以限制。The embodiment of the present application can be applied to an application scenario of an operation and maintenance system such as Fabric and Ansible, which is used to improve the IO processing performance and the execution speed of the remote command in the operation and maintenance system. It should be understood that the embodiments of the present application do not limit the specific application scenarios.
本申请实施例提供的远程命令的处理方法可应用于图1所示的应用环境中,如图1所示,客户端100与服务器200可以位于有线或无线网络中,通过该有线或无线网络,客户端100与服务器200进行数据交互。The processing method of the remote command provided by the embodiment of the present application can be applied to the application environment shown in FIG. 1. As shown in FIG. 1, the client 100 and the server 200 can be located in a wired or wireless network, through the wired or wireless network. The client 100 performs data interaction with the server 200.
具体地,客户端100可以运行在物理机或者虚拟机上,其可以接收用户输入的远程命令的触发请求,依据所述触发请求,获取远程命令及其对应的开关参数,并向服务器发送所述远程命令,以使服务器200获取所述远程命令的响应数据。其中,在所述远程命令为交互式命令时,所述响应数据中可以包括所述远程命令的交互提示信息,在所述远程命令为非交互式命令时,所述响应数据中可以包括所述远程命令的处理结果,可以理解,本申请实施例对于具体的响应数据不加以限制。Specifically, the client 100 can run on a physical machine or a virtual machine, and can receive a trigger request of a remote command input by the user, obtain a remote command and its corresponding switch parameter according to the trigger request, and send the Remote command to cause the server 200 to obtain response data of the remote command. The response data may include the interactive prompt information of the remote command when the remote command is an interactive command, and the response data may include the As a result of the processing of the remote command, it can be understood that the embodiment of the present application does not limit the specific response data.
并且,客户端100还可以接收所述服务器200针对所述远程命令返回的响应数据,并在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。本申请实施例中,上述开关参数具体可以包括关闭或开启,其中,关闭可用于指示不进行响应数据的拦截和查找操作,开启可用于指示进行响应数据的拦截和查找操作。Moreover, the client 100 can also receive the response data returned by the server 200 for the remote command, and output the response data when the switch parameter corresponding to the remote command is off. In the embodiment of the present application, the foregoing switch parameter may specifically include turning off or on, wherein the closing may be used to indicate that the intercepting and searching operations of the response data are not performed, and the opening and the searching operation for indicating the response data may be indicated.
可以理解,上述图1所示应用环境只是作为应用示例,本申请实施例中输入流程的目的之一在于,在所述远程命令对应的开关参数为关闭时,可以不进行返回数据的拦截和查找操作,从而可以解决大数据量传输场景中非交互式命令的判断过程导致IO处理性能低、以及远程命令的执行速度慢的技术问题,而对远程命令的处理流程的具体应用环境不加以限制。It can be understood that the application environment shown in FIG. 1 is only used as an application example. One of the purposes of the input process in the embodiment of the present application is that when the switch parameter corresponding to the remote command is off, the interception and searching of the returned data may not be performed. The operation can solve the technical problem that the judgment process of the non-interactive command in the large data volume transmission scenario leads to low IO processing performance and slow execution speed of the remote command, and the specific application environment of the remote command processing flow is not limited.
方法实施例一Method embodiment 1
参照图2,示出了本申请的一种远程命令的处理方法实施例一的步骤流程图,具体可以包括如下步骤:Referring to FIG. 2, a flow chart of the steps of the first embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
步骤201、接收远程命令的触发请求; Step 201: Receive a trigger request of a remote command.
步骤202、依据所述触发请求,获取远程命令及其对应的开关参数;Step 202: Acquire a remote command and corresponding switch parameters according to the trigger request.
本申请实施例中,上述触发请求可由用户输入,其可用于触发远程命令,以使客户端向服务器发送对应远程命令。In the embodiment of the present application, the trigger request may be input by a user, and may be used to trigger a remote command, so that the client sends a corresponding remote command to the server.
本技术领域中,客户端会对远程命令的返回数据进行拦截,并查找该返回数据中是否包含预置关键字,若包含,则确认当前远程命令需要客户端进行交互。其中,查找该返回数据中是否包含预置关键字的过程具体可以包括:客户端可以不停地读取服务器的返回数据,并判断该返回数据中是否包含password、sudo、input等预置关键字。In the technical field, the client intercepts the returned data of the remote command and finds whether the returned data contains a preset keyword. If yes, it confirms that the current remote command requires the client to interact. The process of searching for the preset keyword in the returned data may include: the client may continuously read the return data of the server, and determine whether the returned data includes preset keywords such as password, sudo, and input. .
而本申请实施例中的用户可以包括:具有专业知识的运维人员,上述运维人员通常对远程命令比较熟悉,故对于即将触发的远程命令而言,运维人员熟悉远程命令中是否包含上述预置关键字、以至于能够明确其是否需要客户端进行交互,因此,本申请实施例的用户具备准确设置即将触发的远程命令的开关参数的能力,具体地,在即将触发的远程命令需要客户端进行交互(也即为交互式命令)时,用户可以将对应的开关参数设置为开启,或者,在即将触发的远程命令不需要客户端进行交互(也即为非交互式命令)时,用户可以将对应的开关参数设置为关闭。The user in the embodiment of the present application may include: an operation and maintenance personnel with professional knowledge, and the operation and maintenance personnel are generally familiar with the remote command. Therefore, for the remote command to be triggered, the operation and maintenance personnel are familiar with whether the remote command includes the above. The preset keyword is so as to be able to clarify whether it needs the client to perform the interaction. Therefore, the user of the embodiment of the present application has the ability to accurately set the switch parameters of the remote command to be triggered. Specifically, the remote command to be triggered requires the client. When the end interacts (that is, as an interactive command), the user can set the corresponding switch parameter to be on, or, when the remote command to be triggered does not require the client to interact (ie, is a non-interactive command), the user The corresponding switch parameter can be set to off.
本申请实施例可以提供依据所述触发请求,获取远程命令及其对应的开关参数的如下技术方案:The embodiment of the present application may provide the following technical solutions for acquiring a remote command and its corresponding switch parameters according to the trigger request:
技术方案1Technical solution 1
技术方案1中,所述触发请求中可以携带有命令文件的地址信息,则所述依据所述触发请求,获取远程命令及其对应的开关参数的步骤202,具体可以包括:In the technical solution 1, the triggering request may carry the address information of the command file, and the step 202 of acquiring the remote command and the corresponding switch parameter according to the triggering request may specifically include:
步骤A1、依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。Step A1: Read the remote command and its corresponding switch parameter from the command file according to the address information.
本申请实施例中,命令文件中可以记录有一个或多个远程命令,该命 令文件通常由用户编写得到,故用户能够准确地确定该命令文件中是否包含上述预置关键字、以至于能够明确该命令文件中远程命令是否需要客户端进行交互。因此,在用户明确该命令文件中远程命令是否需要客户端进行交互的基础上,其可以在该命令文件中记录对应的开关参数。其中,该命令文件中记录的开关参数的数目可以为一个,以说明该命令文件中存在需要客户端进行交互的远程命令。或者,该命令文件中记录的开关参数的数目可以与远程命令的数目相同,以标识每个远程命令是否需要客户端进行交互。可以理解,本申请实施例对于开关参数在上述命令文件中的具体记录方式不加以限制。In the embodiment of the present application, one or more remote commands may be recorded in the command file, and the command The file is usually written by the user, so the user can accurately determine whether the preset keyword is included in the command file, so that it can be clear whether the remote command in the command file requires the client to interact. Therefore, on the basis that the user clarifies whether the remote command requires the client to interact in the command file, it can record the corresponding switch parameter in the command file. The number of the switch parameters recorded in the command file may be one to indicate that there is a remote command in the command file that requires the client to interact. Alternatively, the number of switch parameters recorded in the command file can be the same as the number of remote commands to identify whether each remote command requires the client to interact. It can be understood that the specific recording manner of the switch parameters in the above command file is not limited in the embodiment of the present application.
在本申请的一种可选实施例中,上述命令文件所记录的远程命令及开关参数均可以具有对应的预设位置,例如,开关参数的预设位置可以为第一行或者最后一行或者预设行号等,故步骤A1可以首先依据上述地址信息加载上述命令文件,并按照上述预设位置从所述命令文件中读取远程命令及其对应的开关参数。可以理解,本申请实施例对于依据所述地址信息从所述命令文件中读取远程命令及其对应的开关参数的具体读取过程不加以限制。In an optional embodiment of the present application, the remote command and the switch parameter recorded by the command file may have corresponding preset positions. For example, the preset position of the switch parameter may be the first line or the last line or The line number is set, so step A1 may first load the above command file according to the above address information, and read the remote command and its corresponding switch parameter from the command file according to the preset position. It can be understood that the specific reading process of reading the remote command and its corresponding switch parameter from the command file according to the address information is not limited.
技术方案2Technical solution 2
技术方案2中,所述触发请求中可以携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述依据所述触发请求,获取远程命令及其对应的开关参数的步骤202,具体可以包括:In the technical solution 2, the trigger request may carry the address information of the command file and the switch parameter of the remote command in the command file, and the step of acquiring the remote command and the corresponding switch parameter according to the trigger request 202, specifically may include:
步骤B1、依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。其中,上述关联可以将远程命令与对应的开关参数关联,假设上述命令文件中记录有M个远程命令,触发请求中携带有N个开关参数,则可以建立M个远程命令与N个开关参数之间的映射关系。 Step B1: Read a remote command from the command file according to the address information, and associate the read remote command with a switch parameter carried in the trigger request. The foregoing association may associate the remote command with the corresponding switch parameter. If it is recorded that there are M remote commands in the command file, and the trigger request carries N switch parameters, the M remote commands and the N switch parameters may be established. The mapping relationship between.
相对于技术方案1在命令文件中同时记录远程命令和开关参数,技术方案2可以仅仅在命令文件中记录远程命令,并通过触发请求携带所述命令文件中远程命令的开关参数;这样,步骤B1可以依据所述地址信息从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联,以获取远程命令及其对应的开关参数。Compared with the technical solution 1, the remote command and the switch parameter are simultaneously recorded in the command file, and the technical solution 2 can record the remote command only in the command file, and carry the switch parameter of the remote command in the command file by triggering the request; thus, step B1 The remote command can be read from the command file according to the address information, and the read remote command is associated with the switch parameter carried in the trigger request to obtain the remote command and its corresponding switch parameter.
需要说明的是,本申请实施例中的触发请求可由用户通过键盘、鼠标等输入方式输入,本申请实施例对于上述触发请求的具体获取方式不加以限制。It should be noted that the triggering request in the embodiment of the present application may be input by the user through a keyboard, a mouse, or the like. The specific manner of obtaining the trigger request is not limited in the embodiment of the present application.
可以理解,上述技术方案1和技术方案2只是作为依据所述触发请求,获取远程命令及其对应的开关参数的可选技术方案,实际上,本领域技术人员还可以根据实际应用需求,采用依据所述触发请求,获取远程命令及其对应的开关参数的其他技术方案,例如,可以提供预置接口,以使用户通过该预置接口提交触发请求,并在该触发请求中携带远程命令及其对应的开关参数,其中,该触发请求中可以携带多个远程命令及其对应的开关参数、或者可以携带多个远程命令及每个远程命令对应的开关参数等,本申请实施例对于依据所述触发请求,获取远程命令及其对应的开关参数的具体技术方案不加以限制。It can be understood that the foregoing technical solution 1 and technical solution 2 are only an optional technical solution for acquiring a remote command and its corresponding switch parameter according to the trigger request. In fact, those skilled in the art may also adopt a basis according to actual application requirements. The triggering request, the other technical solution for acquiring the remote command and its corresponding switch parameter, for example, may provide a preset interface, so that the user submits the trigger request through the preset interface, and carries the remote command and the trigger request in the trigger request Corresponding switch parameters, wherein the trigger request may carry multiple remote commands and their corresponding switch parameters, or may carry multiple remote commands and switch parameters corresponding to each remote command, etc. The specific technical solution for triggering the request and obtaining the remote command and its corresponding switch parameters is not limited.
步骤203、向服务器发送所述远程命令;Step 203: Send the remote command to a server.
在本申请的一种应用示例中,客户端可以向服务器发送所述远程命令对应的字符串,以通知服务器执行上述远程命令,其中,可以一次发送一个远程命令,也可以一次发送多个远程命令。In an application example of the application, the client may send a string corresponding to the remote command to the server to notify the server to execute the remote command, where one remote command may be sent at a time, or multiple remote commands may be sent at a time. .
而服务器在接收到上述远程命令后,可以判断上述远程命令是否需要客户端进行交互(例如,是否需要输入密码等),若需要,则可以在向客户端发送的响应数据中携带对应的交互提示信息,若不需要,则可以在向客户端发送的响应数据中携带对应的处理结果。 After receiving the remote command, the server may determine whether the remote command requires the client to interact (for example, whether a password is required, etc.), and if necessary, the corresponding interaction prompt may be carried in the response data sent to the client. The information, if not required, can carry the corresponding processing result in the response data sent to the client.
步骤204、接收所述服务器针对所述远程命令返回的响应数据;Step 204: Receive response data returned by the server for the remote command.
在本申请的一种可选实施例中,所述接收所述服务器针对所述远程命令返回的响应数据的步骤204,具体可以包括:In an optional embodiment of the present application, the step 204 of receiving the response data returned by the server for the remote command may specifically include:
步骤C1、从客户端的SOCKET(套接字)接口中读取所述服务器针对所述远程命令返回的响应数据段。Step C1: Read a response data segment returned by the server for the remote command from a SOCKET (socket) interface of the client.
上述可选实施例可以适用于大数据量传输场景,其中,上述套接字接口可由客户端的操作系统提供,上述响应数据段中可以包含大数据量的数据,例如,其长度可以为4096bytes,可以理解,本申请实施例对于上述响应数据段的具体长度不加以限制。The foregoing optional embodiment may be applicable to a large data volume transmission scenario, where the socket interface may be provided by a client operating system, and the response data segment may include data of a large amount of data, for example, the length may be 4096 bytes. It is understood that the specific length of the above response data segment is not limited in the embodiment of the present application.
步骤205、在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。Step 205: Output the response data when the switch parameter corresponding to the remote command is off.
在本申请的一种可选实施例中,上述步骤205将所述响应数据输出的过程具体可以包括:在所述远程命令对应的开关参数为关闭时,直接通过数据流将上述响应数据展示在显示装置上,也即,可以直接将上述响应数据提供给用户;由于对于非交互式命令,可以不进行返回数据的拦截和查找操作,因此,能够节省返回数据的拦截和查找操作所花费的耗时。In an optional embodiment of the present application, the step 205 of the step of outputting the response data may include: displaying the response data directly through the data stream when the switch parameter corresponding to the remote command is off On the display device, that is, the response data can be directly provided to the user; since the return data can be intercepted and searched for non-interactive commands, the cost of intercepting and searching for the returned data can be saved. Time.
在本申请实施例的另一种可选实施例中,在从客户端的SOCKET(套接字)接口中读取所述服务器针对所述远程命令返回的响应数据段的情况下,所述在所述远程命令对应的开关参数为关闭时,将所述响应数据输出的步骤205,具体可以包括:在所述响应数据段的内容不为空、且所述远程命令对应的开关参数为关闭时,将所述响应数据输出。在实际应用中,本可选实施例可以首先判断响应数据段的内容是否为空,若不为空,则可以判断所述远程命令对应的开关参数是否为关闭,在所述响应数据段的内容不为空、且所述远程命令对应的开关参数为关闭时,将所述响应数据输出。 In another optional embodiment of the embodiment of the present application, in a case where the response data segment returned by the server for the remote command is read from a SOCKET (socket) interface of the client, the When the switch parameter corresponding to the remote command is off, the step 205 of outputting the response data may include: when the content of the response data segment is not empty, and the switch parameter corresponding to the remote command is off, The response data is output. In an actual application, the optional embodiment may first determine whether the content of the response data segment is empty, and if not, determine whether the switch parameter corresponding to the remote command is off, and the content of the response data segment. The response data is output when it is not empty and the switch parameter corresponding to the remote command is off.
在本申请的再一种可选实施例中,在所述响应数据段的内容为空时,可以结束本申请实施例中远程命令的处理流程。In a further optional embodiment of the present application, when the content of the response data segment is empty, the processing flow of the remote command in the embodiment of the present application may be ended.
综上,本申请实施例可以依据远程命令的触发请求,获取远程命令及其对应的开关参数,并在所述远程命令对应的开关参数为关闭时,将所述响应数据输出;由于本申请实施例在所述远程命令对应的开关参数为关闭时,可以不进行返回数据的拦截和查找操作,因此,能够节省返回数据的拦截和查找操作所花费的耗时,从而能够提高IO处理性能,并且,能够提高远程命令的执行速度。In summary, the embodiment of the present application can obtain the remote command and its corresponding switch parameter according to the trigger request of the remote command, and output the response data when the switch parameter corresponding to the remote command is off; For example, when the switch parameter corresponding to the remote command is off, the interception and search operations of the return data may not be performed, thereby saving time and time required for intercepting and searching operations of the returned data, thereby improving IO processing performance, and Can improve the execution speed of remote commands.
方法实施例二Method embodiment two
参照图3,示出了本申请的一种远程命令的处理方法实施例二的步骤流程图,具体可以包括如下步骤:Referring to FIG. 3, a flow chart of the steps of the second embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
步骤301、接收远程命令的触发请求;Step 301: Receive a trigger request of a remote command.
步骤302、依据所述触发请求,获取远程命令及其对应的开关参数;Step 302: Acquire a remote command and corresponding switch parameters according to the trigger request.
步骤303、向服务器发送所述远程命令;Step 303: Send the remote command to a server.
步骤304、接收所述服务器针对所述远程命令返回的响应数据;Step 304: Receive response data returned by the server for the remote command.
步骤305、在所述远程命令对应的开关参数为关闭时,将所述响应数据输出;Step 305: Output the response data when the switch parameter corresponding to the remote command is off.
相对于图2所示方法实施例一,本实施例的方法还可以包括:The method of this embodiment may further include:
步骤306、在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;Step 306: When the switch parameter corresponding to the remote command is turned on, intercept the response data.
步骤307、从所拦截的响应数据中查找需要客户端进行交互的交互式命令;Step 307: Search for an interactive command that requires the client to interact from the intercepted response data.
步骤308、输出所述交互式命令对应的交互提示信息。Step 308: Output interactive prompt information corresponding to the interactive command.
本实施例的步骤306-步骤308对响应数据进行拦截和查找处理,以从该响应数据中识别出需要客户端进行交互的交互式命令,进而可以得到对 应的交互提示信息信息。In step 306 to step 308 of the embodiment, the response data is intercepted and searched to identify an interactive command from the response data that requires the client to interact, and then the pair can be obtained. The interactive information should be prompted.
在本申请的一种可选实施例中,上述步骤307具体可以包括:对响应数据进行拦截,对所拦截的响应数据按行(\r、\n、\r\n)进行切割,并对每一个当前行判断其是否包含预置关键字(sudo、password);若是,则可以输出提示框,提示客户端进行交互;若否,则可以将当前行对应的响应数据输出,并通过步骤307继续下一次判断直至所有响应数据被处理完毕In an optional embodiment of the present application, the foregoing step 307 may specifically include: intercepting the response data, cutting the intercepted response data by lines (\r, \n, \r\n), and cutting Each current line determines whether it contains a preset keyword (sudo, password); if yes, it can output a prompt box to prompt the client to interact; if not, the response data corresponding to the current line can be output, and step 307 is performed. Continue to the next judgment until all response data has been processed
参照图4,示出了本申请的一种响应数据的示意,其中,Fabric可以对10.125.0.171(服务器)返回的响应数据进行拦截和查找处理,其中,在发现某行响应数据包含有“password”关键字时,可以输出交互提示信息“out:[sudo]password for xiong.xiaox:”,以提示用户输入密码,在用户输入密码之后,Fabric可以将用户输入的密码发送回10.125.0.171服务器,以使服务器对该密码进行认证;其中,在该密码的认证通过时,服务器可以继续执行对应的远程命令,并向客户端发送对应的响应数据,其中,该响应数据中可以包括远程命令的执行结果;而在该密码的认证不通过时,服务器可以拒绝执行对应的远程命令,并向客户端发送对应的响应数据,其中,该响应数据中可以包括远程命令的密码错误结果。可以理解,上述只是作为响应数据的处理过程示例,实际上,本申请实施例对于响应数据的具体处理过程不加以限制。Referring to FIG. 4, there is shown a schematic diagram of a response data of the present application, wherein the fabric can intercept and search the response data returned by 10.125.0.171 (server), wherein the response data of a certain row is found to contain "password". "For keywords, you can output the interactive prompt message "out:[sudo]password for xiong.xiaox:" to prompt the user to enter the password. After the user enters the password, the fabric can send the password entered by the user back to the 10.125.0.171 server. The server is configured to authenticate the password; wherein, when the authentication of the password is passed, the server may continue to execute the corresponding remote command, and send corresponding response data to the client, where the response data may include execution of the remote command. As a result, when the authentication of the password fails, the server may refuse to execute the corresponding remote command, and send corresponding response data to the client, where the response data may include a password error result of the remote command. It can be understood that the above is only an example of the processing procedure as the response data. In fact, the specific processing procedure of the response data is not limited in the embodiment of the present application.
方法实施例三Method embodiment three
参照图5,示出了本申请的一种远程命令的处理方法实施例三的步骤流程图,具体可以包括如下步骤:Referring to FIG. 5, a flow chart of the steps of the third embodiment of the remote command processing method of the present application is shown, which may specifically include the following steps:
步骤501、客户端接收远程命令的触发请求;Step 501: The client receives a trigger request of a remote command.
步骤502、客户端依据所述触发请求,获取远程命令及其对应的开关参数;Step 502: The client obtains the remote command and its corresponding switch parameter according to the trigger request.
步骤503、客户端向服务器发送所述远程命令; Step 503: The client sends the remote command to the server.
步骤504、客户端从套接字接口中读取所述服务器针对所述远程命令返回的响应数据段;Step 504: The client reads, from the socket interface, a response data segment returned by the server for the remote command.
步骤505、客户端判断上述响应数据段的数据是否为空,若是,则结束流程,否则,执行步骤506; Step 505, the client determines whether the data of the response data segment is empty, and if so, the process ends; otherwise, step 506 is performed;
步骤506、客户端判断所述远程命令对应的开关参数是否为关闭,若是,则执行步骤507,否则,执行步骤508; Step 506, the client determines whether the switch parameter corresponding to the remote command is off, and if so, step 507 is performed, otherwise, step 508 is performed;
步骤507、客户端将所述响应数据输出;Step 507: The client outputs the response data.
步骤508、客户端将所述响应数据进行拦截;Step 508: The client intercepts the response data.
步骤509、客户端从所拦截的响应数据中查找需要客户端进行交互的交互式命令;Step 509: The client searches for the interactive command that requires the client to interact from the intercepted response data.
步骤510、客户端输出所述交互式命令对应的交互提示信息。Step 510: The client outputs the interaction prompt information corresponding to the interactive command.
需要说明的是,在本申请的一种可选实施例中,步骤507还可以将响应数据写入缓存,以备远程命令的处理需要。It should be noted that, in an optional embodiment of the present application, step 507 may also write response data to the cache for processing requirements of the remote command.
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。It should be noted that, for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the embodiments of the present application are not limited by the described action sequence, because In accordance with embodiments of the present application, certain steps may be performed in other sequences or concurrently. In the following, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required in the embodiments of the present application.
装置实施例Device embodiment
参照图6,示出了本申请的一种远程命令的处理装置实施例的结构框图,具体可以包括如下模块:Referring to FIG. 6, a structural block diagram of an embodiment of a remote command processing apparatus of the present application is shown, which may specifically include the following modules:
第一接收模块601,用于接收远程命令的触发请求;The first receiving module 601 is configured to receive a trigger request of the remote command;
获取模块602,用于依据所述触发请求,获取远程命令及其对应的开关参数; The obtaining module 602 is configured to obtain a remote command and a corresponding switch parameter according to the trigger request.
发送模块603,用于向服务器发送所述远程命令;a sending module 603, configured to send the remote command to a server;
第二接收模块604,用于接收所述服务器针对所述远程命令返回的响应数据;以及a second receiving module 604, configured to receive response data returned by the server for the remote command;
第一输出模块605,用于在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。The first output module 605 is configured to output the response data when the switch parameter corresponding to the remote command is off.
在本申请的一种可选实施例中,所述触发请求中可以携带有命令文件的地址信息,则所述获取模块602,具体可以包括:In an optional embodiment of the present application, the triggering request may carry the address information of the command file, and the acquiring module 602 may specifically include:
第一获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。The first obtaining submodule is configured to read the remote command and the corresponding switch parameter from the command file according to the address information.
在本申请的另一种可选实施例中,所述触发请求中可以携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述获取模块602,具体可以包括:In another optional embodiment of the present application, the triggering request may include the address information of the command file and the switch parameter of the remote command in the command file, where the obtaining module 602 may specifically include:
第二获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。The second obtaining submodule is configured to read the remote command from the command file according to the address information, and associate the read remote command with the switch parameter carried in the trigger request.
在本申请的再一种可选实施例中,所述装置还可以包括:In still another optional embodiment of the present application, the apparatus may further include:
拦截模块,用于在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;An intercepting module, configured to intercept the response data when a switch parameter corresponding to the remote command is turned on;
查找模块,用于从所拦截的响应数据中查找需要客户端进行交互的交互式命令;a lookup module for finding an interactive command from the intercepted response data that requires the client to interact;
第二输出模块,用于输出所述交互式命令对应的交互提示信息。And a second output module, configured to output interaction prompt information corresponding to the interactive command.
在本申请的又一种可选实施例中,所述第二接收模块603,具体可以包括:In a further optional embodiment of the present application, the second receiving module 603 may specifically include:
读取子模块,用于从客户端的套接字接口中读取所述服务器针对所述远程命令返回的响应数据段。 Reading a submodule for reading a response data segment returned by the server for the remote command from a socket interface of the client.
在本申请的一种可选实施例中,所述第一输出模块605,具体可以包括:In an optional embodiment of the present application, the first output module 605 may specifically include:
输出子模块,用于在所述响应数据段的内容不为空、且所述远程命令对应的开关参数为关闭时,将所述响应数据输出。And an output submodule, configured to output the response data when the content of the response data segment is not empty and the switch parameter corresponding to the remote command is off.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in the present specification are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same similar parts between the various embodiments can be referred to each other.
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the embodiments of the present application can be provided as a method, apparatus, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
在一个典型的配置中,所述计算机设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质 的示例。计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非持续性的电脑可读媒体(transitory media),如调制的数据信号和载波。In a typical configuration, the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory. Memory is a computer readable medium Example. Computer readable media includes both permanent and non-persistent, removable and non-removable media. Information storage can be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-persistent computer readable media, such as modulated data signals and carrier waves.
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方 框图一个方框或多个方框中指定的功能的装置。Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine such that instructions are executed by a processor of a computer or other programmable data processing terminal device Generated for implementing a process or multiple processes and/or parties in a flowchart A block diagram of a device in a box or a function specified in a plurality of boxes.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The instruction device implements the functions specified in one or more blocks of the flowchart or in a flow or block of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device such that a series of operational steps are performed on the computer or other programmable terminal device to produce computer-implemented processing, such that the computer or other programmable terminal device The instructions executed above provide steps for implementing the functions specified in one or more blocks of the flowchart or in a block or blocks of the flowchart.
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。While a preferred embodiment of the embodiments of the present application has been described, those skilled in the art can make further changes and modifications to the embodiments once they are aware of the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including all the modifications and the modifications
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为 这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should also be noted that in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities. There is any such actual relationship or order between operations. Furthermore, the terms "comprises" or "comprising" or "comprising" or any other variations are intended to encompass a non-exclusive inclusion, such that a process, method, article, or terminal device that includes a plurality of elements includes not only those elements but also Other elements, or are included An element inherent in such a process, method, article or terminal device. An element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that comprises the element, without further limitation.
以上对本申请所提供的一种远程命令的处理方法和一种远程命令的处理装置,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。 The method for processing a remote command and the processing device for a remote command provided by the present application are described in detail above. The principle and implementation manner of the present application are described in the specific examples, and the description of the above embodiment is described. It is only used to help understand the method of the present application and its core ideas; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in specific implementation manners and application scopes. The contents of this specification are not to be construed as limiting the application.

Claims (10)

  1. 一种远程命令的处理方法,其特征在于,包括:A method for processing a remote command, comprising:
    接收远程命令的触发请求;Receiving a trigger request for a remote command;
    依据所述触发请求,获取远程命令及其对应的开关参数;Obtaining a remote command and its corresponding switch parameter according to the trigger request;
    向服务器发送所述远程命令;Sending the remote command to a server;
    接收所述服务器针对所述远程命令返回的响应数据;Receiving response data returned by the server for the remote command;
    在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。The response data is output when the switch parameter corresponding to the remote command is off.
  2. 根据权利要求1所述的方法,其特征在于,所述触发请求中携带有命令文件的地址信息,则所述依据所述触发请求,获取远程命令及其对应的开关参数的步骤,包括:The method according to claim 1, wherein the triggering request carries the address information of the command file, and the step of acquiring the remote command and its corresponding switch parameter according to the trigger request includes:
    依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。Reading the remote command and its corresponding switch parameter from the command file according to the address information.
  3. 根据权利要求1所述的方法,其特征在于,所述触发请求中携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述依据所述触发请求,获取远程命令及其对应的开关参数的步骤,包括:The method according to claim 1, wherein the trigger request carries address information of a command file and a switch parameter of a remote command in the command file, and the remote command is acquired according to the trigger request. The steps of the corresponding switch parameters include:
    依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。And reading, according to the address information, a remote command from the command file, and associating the read remote command with a switch parameter carried in the trigger request.
  4. 根据权利要求1至3中任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further comprises:
    在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;The response data is intercepted when the switch parameter corresponding to the remote command is on;
    从所拦截的响应数据中查找需要客户端进行交互的交互式命令;Find interactive commands that require client interaction from the intercepted response data;
    输出所述交互式命令对应的交互提示信息。And outputting the interactive prompt information corresponding to the interactive command.
  5. 根据权利要求1至3中任一所述的方法,其特征在于,所述接收所述服务器针对所述远程命令返回的响应数据的步骤,包括: The method according to any one of claims 1 to 3, wherein the step of receiving the response data returned by the server for the remote command comprises:
    从客户端的套接字接口中读取所述服务器针对所述远程命令返回的响应数据段。The response data segment returned by the server for the remote command is read from the client's socket interface.
  6. 根据权利要求5所述的方法,其特征在于,所述在所述远程命令对应的开关参数为关闭时,将所述响应数据输出的步骤,包括:The method according to claim 5, wherein the step of outputting the response data when the switch parameter corresponding to the remote command is off comprises:
    在所述响应数据段的内容不为空、且所述远程命令对应的开关参数为关闭时,将所述响应数据输出。The response data is output when the content of the response data segment is not empty and the switch parameter corresponding to the remote command is off.
  7. 一种远程命令的处理装置,其特征在于,包括:A remote command processing device, comprising:
    第一接收模块,用于接收远程命令的触发请求;a first receiving module, configured to receive a trigger request of a remote command;
    获取模块,用于依据所述触发请求,获取远程命令及其对应的开关参数;An acquiring module, configured to acquire a remote command and a corresponding switch parameter according to the trigger request;
    发送模块,用于向服务器发送所述远程命令;a sending module, configured to send the remote command to a server;
    第二接收模块,用于接收所述服务器针对所述远程命令返回的响应数据;以及a second receiving module, configured to receive response data returned by the server for the remote command;
    第一输出模块,用于在所述远程命令对应的开关参数为关闭时,将所述响应数据输出。And a first output module, configured to output the response data when the switch parameter corresponding to the remote command is off.
  8. 根据权利要求7所述的装置,其特征在于,所述触发请求中携带有命令文件的地址信息,则所述获取模块,包括:The device according to claim 7, wherein the triggering request carries the address information of the command file, and the acquiring module includes:
    第一获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令及其对应的开关参数。The first obtaining submodule is configured to read the remote command and the corresponding switch parameter from the command file according to the address information.
  9. 根据权利要求7所述的装置,其特征在于,所述触发请求中携带有命令文件的地址信息和所述命令文件中远程命令的开关参数,则所述获取模块,包括:The device according to claim 7, wherein the triggering request carries the address information of the command file and the switch parameter of the remote command in the command file, and the acquiring module includes:
    第二获取子模块,用于依据所述地址信息,从所述命令文件中读取远程命令,并将读取的远程命令与所述触发请求中携带的开关参数进行关联。 The second obtaining submodule is configured to read the remote command from the command file according to the address information, and associate the read remote command with the switch parameter carried in the trigger request.
  10. 根据权利要求7至9中任一所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 7 to 9, wherein the device further comprises:
    拦截模块,用于在所述远程命令对应的开关参数为开启时,将所述响应数据进行拦截;An intercepting module, configured to intercept the response data when a switch parameter corresponding to the remote command is turned on;
    查找模块,用于从所拦截的响应数据中查找需要客户端进行交互的交互式命令;a lookup module for finding an interactive command from the intercepted response data that requires the client to interact;
    第二输出模块,用于输出所述交互式命令对应的交互提示信息。 And a second output module, configured to output interaction prompt information corresponding to the interactive command.
PCT/CN2017/077727 2016-03-31 2017-03-22 Remote command processing method and device WO2017167103A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610202831.6 2016-03-31
CN201610202831.6A CN107291524B (en) 2016-03-31 2016-03-31 Remote command processing method and device

Publications (1)

Publication Number Publication Date
WO2017167103A1 true WO2017167103A1 (en) 2017-10-05

Family

ID=59962563

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/077727 WO2017167103A1 (en) 2016-03-31 2017-03-22 Remote command processing method and device

Country Status (3)

Country Link
CN (1) CN107291524B (en)
TW (1) TWI738726B (en)
WO (1) WO2017167103A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115314536A (en) * 2022-08-03 2022-11-08 平安付科技服务有限公司 Method and device for remotely executing command, storage medium and computer equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110336770A (en) * 2019-04-04 2019-10-15 平安科技(深圳)有限公司 Method, apparatus, equipment and the storage medium of long-range monitoring loophole
CN113190296A (en) * 2021-05-19 2021-07-30 瀚高基础软件股份有限公司 Paramiko-based interactive command execution method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102035748A (en) * 2010-12-31 2011-04-27 深圳市深信服电子科技有限公司 Application-based traffic control method and controller
US20150081688A1 (en) * 2006-07-26 2015-03-19 International Business Machines Corporation Results from search providers using a browsing-time relevancy factor
CN104486133A (en) * 2014-12-26 2015-04-01 大唐移动通信设备有限公司 Network element agency managing method and system
CN104796279A (en) * 2014-01-21 2015-07-22 腾讯科技(深圳)有限公司 Request packet processing method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100824792B1 (en) * 2006-07-11 2008-04-24 삼성전자주식회사 Command processing devices and method thereof, and systems having the same
CN102739440A (en) * 2012-05-24 2012-10-17 大唐移动通信设备有限公司 Method and device for accessing hardware device
WO2015045108A1 (en) * 2013-09-27 2015-04-02 三菱電機株式会社 Client/server program generation device and client/server program generation program
CN103746843A (en) * 2013-12-31 2014-04-23 百度在线网络技术(北京)有限公司 Method and equipment for processing RPC (Remote Procedure Call Protocol) command

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150081688A1 (en) * 2006-07-26 2015-03-19 International Business Machines Corporation Results from search providers using a browsing-time relevancy factor
CN102035748A (en) * 2010-12-31 2011-04-27 深圳市深信服电子科技有限公司 Application-based traffic control method and controller
CN104796279A (en) * 2014-01-21 2015-07-22 腾讯科技(深圳)有限公司 Request packet processing method and device
CN104486133A (en) * 2014-12-26 2015-04-01 大唐移动通信设备有限公司 Network element agency managing method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115314536A (en) * 2022-08-03 2022-11-08 平安付科技服务有限公司 Method and device for remotely executing command, storage medium and computer equipment
CN115314536B (en) * 2022-08-03 2024-02-02 平安付科技服务有限公司 Remote command execution method and device, storage medium and computer equipment

Also Published As

Publication number Publication date
TW201737065A (en) 2017-10-16
CN107291524A (en) 2017-10-24
CN107291524B (en) 2020-04-07
TWI738726B (en) 2021-09-11

Similar Documents

Publication Publication Date Title
CN107577427B (en) data migration method, device and storage medium for blockchain system
JP6963006B2 (en) Data storage, data checking, and data concatenation methods and equipment
JP6535031B2 (en) Data query method and apparatus
TW201909009A (en) Data processing method and device based on blockchain
TWI671642B (en) Method for sharing data across applications and web browser
WO2021082157A1 (en) Methods, systems and devices for data sharing, and data and metadata storage
WO2016165482A1 (en) File transfer method and apparatus
US9600567B2 (en) Local context search results improvements
US20130117218A1 (en) Cross-store electronic discovery
WO2017084348A1 (en) Management method and apparatus for ip hard disk
WO2017005094A1 (en) Data query method and device
US9110917B2 (en) Creating a file descriptor independent of an open operation
US9110820B1 (en) Hybrid data storage system in an HPC exascale environment
WO2017167103A1 (en) Remote command processing method and device
US10909086B2 (en) File lookup in a distributed file system
US20190213057A1 (en) Adding descriptive metadata to application programming interfaces for consumption by an intelligent agent
CN107423037B (en) Application program interface positioning method and device
CN110019048A (en) Document handling method, device, system and server based on MongoDB
WO2021204082A1 (en) Deduplication of encrypted data using multiple keys
US11157456B2 (en) Replication of data in a distributed file system using an arbiter
CN109657167B (en) Data acquisition method, device, server and storage medium
US9648103B2 (en) Non-uniform file access in a distributed file system
US10146791B2 (en) Open file rebalance
CN114547206A (en) Data synchronization method and data synchronization system
US10114864B1 (en) List element query support and processing

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17773133

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17773133

Country of ref document: EP

Kind code of ref document: A1