CN108647043B - Method and system for realizing command line input - Google Patents

Method and system for realizing command line input Download PDF

Info

Publication number
CN108647043B
CN108647043B CN201810289981.4A CN201810289981A CN108647043B CN 108647043 B CN108647043 B CN 108647043B CN 201810289981 A CN201810289981 A CN 201810289981A CN 108647043 B CN108647043 B CN 108647043B
Authority
CN
China
Prior art keywords
optional
command line
input
keyword
keywords
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201810289981.4A
Other languages
Chinese (zh)
Other versions
CN108647043A (en
Inventor
陶阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201810289981.4A priority Critical patent/CN108647043B/en
Publication of CN108647043A publication Critical patent/CN108647043A/en
Application granted granted Critical
Publication of CN108647043B publication Critical patent/CN108647043B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30094Condition code generation, e.g. Carry, Zero flag
    • 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions

Abstract

A method and a system for realizing command line input relate to the technical field of command line analysis, and the method comprises the following steps: defining a self-defined command line, wherein optional keywords and parameters are placed behind the input keys and replaced by character strings; defining a custom parsing function for analyzing the custom command line, and binding the custom parsing function with the custom command line registered on a command tree; and judging whether the optional keywords and the parameters are legal or not through the custom analytic function, and automatically supplementing part of the input optional keywords according to custom command line prototypes on the command tree. The invention supports random combination input of selectable keywords and parameters, does not need to consider the number and sequence problems of the selectable keywords and the parameters, is convenient for registering and realizing a command line, reduces the workload, and can be expanded subsequently.

Description

Method and system for realizing command line input
Technical Field
The invention relates to the technical field of command line analysis, in particular to a method and a system for realizing command line input.
Background
Existing various products for data communication, such as switches, routers, firewalls, modems, PONs (Passive Optical networks), GTNs (General Transport networks), PTNs (Packet Transport networks), and so on, provide a management means called a command line, that is, a user inputs a specific command line (shown as a string of characters), and the command line core parser in the device parses the command line core to obtain the operation intention of the user, and then executes and feeds back the result to the user. A simple example, such as a ping in a windows operating system, is a command line. It is common practice in the industry to store all command line prototypes in the form of a command tree. And after receiving the user input, the command line kernel analysis program traverses from the crown to the root of the command tree, searches for a command line prototype matched with the command line input by the user, and executes an execution function corresponding to the command line after finding the matched command line prototype.
As shown in fig. 1, a schematic diagram of a command tree is shown, wherein the command tree is a data structure for storing command line strings in a tree structure. The branches of the command tree are the nodes of the command line, and the prototype of the command line is hung under each node.
The command line input by the user is a character string, and the command line kernel analysis program carries out matching according to the character string to sense the intention of the user. The parameters of the command line input by the user are specified, the parameters of the command line registered on the command tree are ranged, and the specified parameters input by the user are considered to be matched as long as the specified parameters belong to the legal range of the parameters of the command line on the command tree. However, such matching rules are relatively rigid and must strictly adhere to sequence and integrity.
Taking ping command as an example:
TABLE 1
Figure BDA0001617218400000021
Table 1 is a command line prototype and user input command line match table on a command tree. Taking the serial number 2 as an example, when a user inputs, after the keywords ping and the ip address are input, the keyword-w must be input first, then the keyword-s can be input, and the 2 keywords and the parameters must be input, so that legal operation is performed, and the serial number 2 command line prototype can be successfully matched. If the user only wants to enter-w, the actual match is the prototype sequence number 1 command line on the command tree, not sequence number 2. Or inputting-s and then-w, the command line prototype with sequence number 3 in the command tree is actually matched. If the user inputs ping 1.1.1.1-s 20-w 10, i.e. the keyword is followed by a parameter, and the command line prototype ping (a.b.c.d) -s <1-100> -w <1-200> without sequence number 3 in the command tree, the command line kernel parser cannot match the command line prototype, and it is determined that the user input is illegal, resulting in that the command line cannot be executed. This is the sequentiality and integrity that conventional command line kernel parsers impose.
However, some command lines have many optional keywords and parameters besides the keywords and parameters that must be input, and when a user inputs these optional keywords and parameters, the combination of the optional keywords and parameters is arbitrary and irregular, which results in many combination forms of the command lines. Taking ping command as an example:
C:\Users\ytao>ping/?
use of ping [ -t ] [ -a ] [ -n count ] [ -l size ] [ -f ] [ -i TTL ] [ -v TOS ]
[-r count][-s count][[-j host-list]|[-k host-list]]
[-w timeout][-R][-S srcaddr][-4][-6]target_name
Selecting:
-t Ping specified host until stop.
If the statistical information needs to be checked and the operation is continued, please enter Control-Break; if stop-please enter Control-C.
-a resolving the address to a hostname.
-number of echo requests to send by n counts.
-l size send buffer size.
F sets the "not fragment" flag in the packet (applicable only to IPv 4).
-i TTL time to live.
V TOS service type (only applicable to ipv 4. this setting has been disapproved for use and has no impact on the service field type in the IP header).
R count records count routes for hops (applicable only to IPv 4).
S count counts the time stamp of the hops (applicable only to IPv 4).
Loose source routing of j host-list together with host list (applicable only to IPv 4).
Strict source routing of-k host-list together with host list (applicable only to IPv 4).
W timeout waits for timeout (milliseconds) for each reply.
R also tests reverse routing using the route header (applicable only to IPv 6).
-source address to be used by S srcadr.
-4 mandatory use of IPv 4.
-6 mandatory use of IPv 6.
The Ping command includes 16 optional keys in addition to the target _ name that must be specified. Moreover, these optional keys have parameters (e.g., -n/-l/-i) and no parameters (e.g., -t/-a/-f), which results in a very wide variety of combinations of ping command line prototypes. These combinations are too numerous to be exhaustive, apparently impractical for all combinations, and are labor intensive, pose certain difficulties for registration and later implementation, and are not scalable.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and a system for realizing command line input, which support random combination input of selectable keywords and parameters, do not need to consider the number and sequence problems of the selectable keywords and the parameters, are convenient for registering and realizing the command line, reduce the workload and can be expanded subsequently.
In order to achieve the above object, the present invention adopts a method for implementing command line input, comprising the steps of:
defining optional keywords and parameters in a custom command line to be placed behind the input, and replacing the optional keywords and the parameters by character strings;
defining a custom parsing function for analyzing the defined command line, and binding the custom parsing function with the custom command line registered on a command tree;
and judging whether the optional keywords and the parameters are legal or not through the custom analytic function, and automatically supplementing part of the input optional keywords according to custom command line prototypes on the command tree.
On the basis of the technical scheme, the user-defined analysis function analyzes the input command line, traverses the command tree, searches a command line prototype matched with the command line, and analyzes through the user-defined analysis function if the command line prototype is user-defined; if the command line prototype is not self-defined, analyzing through the original flow.
On the basis of the technical scheme, defining the custom command line comprises the following steps:
enumerating all optional keyword definitions needing to be supported in a user-defined command line;
defining a data structure, and associating each optional keyword, the corresponding help information and the corresponding parameter range information;
defining an array, the members of which are said data structure;
the form of the custom command line is defined with the keywords and parameters that must be entered in front and all optional keywords and parameters in the back.
On the basis of the above technical solution, in the data structure, if the selectable keyword does not have a parameter, the corresponding parameter range information is null.
On the basis of the technical scheme, the custom analysis function analyzes the custom command line, and if the currently input optional keyword is not matched with the optional keyword stored in the array or the currently input optional keyword and the input optional keyword have logic conflict, the input is considered to be illegal, and the process is ended.
On the basis of the technical scheme, the custom analysis function analyzes the custom command line, and if the currently input optional keyword is matched with the parameters stored in the array, the currently input optional keyword and the input optional keyword have no logic conflict, and the parameters continuously input by the user belong to the corresponding parameter range in the array, the currently input optional keyword and the corresponding parameters are legal.
On the basis of the technical scheme, the custom analysis function analyzes the custom command line, if the currently input optional keyword is partially the same as a certain optional keyword stored in the array, the current input optional keyword is matched, the current input optional keyword is directly supplemented according to the optional keyword stored in the array, and the optional keyword is extracted to replace a character string adopted when the corresponding optional keyword is registered, so that help information corresponding to the optional keyword and a corresponding parameter range are obtained.
On the basis of the technical scheme, the custom analysis function analyzes the custom command line, if the currently input optional keywords are partially the same as at least two optional keywords stored in the array, the matching is performed, all the partially same optional keywords are provided for selection, the selected optional keywords are used for replacing character strings adopted during registration of the corresponding optional keywords, and the help information corresponding to the optional keywords and the corresponding parameter ranges are obtained.
On the basis of the technical scheme, if the optional keyword has a corresponding parameter range and no parameter is subsequently input, or the subsequently input parameter does not belong to the corresponding parameter range in the comparison array, the parameter is determined to be in an illegal state, and the process is ended.
The invention also provides a system for realizing the command line input, which comprises:
the command line definition module is used for defining that the optional keywords and parameters in the command line are placed behind the input keys and replaced by character strings;
and the analysis module is used for automatically supplementing part of input optional keywords according to the registered self-defined command line and judging whether the input optional keywords and parameters are legal or not.
On the basis of the technical scheme, the command line definition module comprises a data structure and an array, wherein the data structure associates each optional keyword, corresponding help information and corresponding parameter range information; the members of the array are the data structures.
On the basis of the above technical solution, the parsing module includes:
the self-defined command line judging module is used for traversing the command tree and judging whether the input command line is a registered self-defined command line;
the keyword judging module is used for traversing the array to judge the validity of the currently input optional keyword;
and the parameter judging module is used for traversing the array to judge the legality of the subsequent input parameters of the currently input optional keywords.
On the basis of the above technical solution, the keyword determination module further includes an association unit, which is configured to supplement part of the input legal selectable keywords, and obtain help information corresponding to the selectable keywords and a corresponding parameter range.
On the basis of the technical scheme, if the currently input optional keyword is partially the same as a certain optional keyword stored in the array, the association unit supplements the currently input optional keyword directly according to the optional keyword stored in the array.
On the basis of the technical scheme, if the currently input optional keywords are partially the same as at least two optional keywords stored in the array, the association unit provides all the partially same optional keywords for selection, and the selected keywords are used for replacing character strings adopted when the corresponding optional keywords are registered.
The invention has the beneficial effects that:
1. defining a self-defined command line, replacing all selectable keywords and parameters thereof by character strings PS without practical significance, not paying attention to the sequence and permutation and combination problems of the selectable keywords, not exhaustively exhausting all combinations during registration, and greatly reducing the registration number of the command line. When the user inputs, the corresponding optional keywords or parameters in the array can be automatically associated and matched according to the input value of the user, and the character strings in the command line are replaced in return, so that the method is simple to implement, and is safe and reliable. The more selectable keywords the custom command line contains, the more obvious the benefits and advantages of the inventive method.
2. The original command line kernel analysis program is slightly changed, when the user-defined command line is registered, only the user-defined analysis function needs to be bound, and the non-user-defined command line can be unbound, so that the workload is reduced. Even if the custom analysis function is wrongly realized, only the current command line is influenced, and the analysis of other command lines is not influenced.
3. The existing command line kernel analysis program has no way to actively contain and judge the logic relation between the key words of each command line, because the information quantity is too large and too complex, and the processing logic cannot be realized. However, the invention can realize the judgment of the logic relation between the selectable keywords of the user-defined command line in the user-defined analytic function, thereby realizing the judgment of the input logic legality of the user. When the logic relation between various optional keywords of the user-defined command line changes, only the user-defined analysis function needs to be modified, and the method is independent of the kernel analysis program, convenient, quick and efficient.
Drawings
FIG. 1 is a diagram of a command tree in the background art;
FIG. 2 is a flowchart of a method according to a first embodiment of the present invention;
FIG. 3 is a system diagram illustrating a sixth embodiment of the present invention;
FIG. 4 is a system diagram illustrating a seventh embodiment of the present invention.
Reference numerals:
the command line definition module 1, the data structure 11 and the array 12;
the system comprises an analysis module 2, a custom command line judging module 21, a keyword judging module 22, a parameter judging module 23 and an association unit 230.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
The invention relates to a method for realizing command line input, which comprises the following steps:
defining a self-defined command line, wherein optional keywords and parameters are placed behind the input, and a character string PS is adopted for replacement;
defining a custom analysis function for analyzing the custom command line, and binding the custom analysis function with the custom command line registered on the command tree;
and judging whether the optional keywords and the parameters are legal or not through the custom analytic function, and automatically supplementing part of the input optional keywords according to custom command line prototypes on the command tree.
The first embodiment:
the invention relates to a method for realizing command line input, which comprises the following steps:
s101, enumerating according to definition of all optional keywords to be supported by a custom command line, wherein the form of the custom command line is defined as follows: the key words and parameters which must be input are placed in front of each other, the optional key words and parameters are placed in the back of all the keys which must be input, and the optional key words are not used for distinguishing the sequence. All optional keywords and parameters, except those that must be entered, are replaced with a string PS.
S102, defining a data structure cmd _ param _ t, and associating each optional keyword, corresponding help information and corresponding parameter range information, wherein if no parameter exists, the range can be represented by a null. The help information comprises Chinese and English, and is command line conventional information used for prompting the user operation.
S103, defining an array, wherein the members of the array are the data structure cmd _ param _ t defined in S102, and the size of the array is equal to the number of optional keywords supported by the current custom command line, namely the number enumerated in S101.
S104, a custom parsing function for parsing the custom command line is defined, for example, ping _ part _ function, the custom command line is registered in the command tree, and the custom parsing function is bound with the custom command line already registered in the command tree.
S105, when a user-defined command line input by a user is received, analyzing the input command line by a user-defined analytic function, traversing a command tree, finding a command line prototype matched with the command line, judging whether the command line is bound with the user-defined analytic function, and if so, entering S106; if not, the process proceeds to S107.
And S106, the user inputs a custom command line, and the custom analysis function is used for analyzing. Specifically, the custom parsing function can judge whether the input optional keywords and parameters are legal or not according to the corresponding custom command line prototype on the command tree, and can automatically supplement part of the input optional keywords through association in the judging process, and the optional keywords which cannot be automatically supplemented are illegal. And only after all the keywords and the parameters are legal, executing the self-defined command line according to the input parameters.
S107, the user inputs a common command line, and the common command line is analyzed through an existing command line kernel analysis program.
Second embodiment:
in this embodiment, the form, data structure, array, and parse command of the custom command line are defined in the first embodiment. On the basis of the first embodiment, when the custom parsing function parses a custom command line being input, whether a currently input optional keyword is matched with an optional keyword stored in an array is judged, if so, whether a logical conflict exists between the currently input optional keyword and the input optional keyword is further judged, if not, and if a parameter continuously input by a user belongs to a corresponding parameter range in the array, the current optional keyword and the corresponding parameter are legal, the current optional keyword is processed, and if a next keyword exists, the processing is continued; if not, the custom command line functionality can be performed.
If the optional keyword input before is not matched with the optional keyword stored in the array or the logic conflict exists between the optional keyword input currently and the optional keyword already input, the user input is considered to be illegal at this moment, and the whole process is ended.
The third embodiment:
in this embodiment, on the basis of the first embodiment and the second embodiment, when the custom parsing function determines whether the currently input optional keyword matches the optional keyword stored in the array, the currently partially input optional keyword may be automatically supplemented in an association manner.
And if the currently input optional keyword is partially the same as a certain optional keyword stored in the array, matching is performed if the currently input optional keyword is partially the same as the certain optional keyword stored in the array, supplementing the optional keyword input at the current part directly according to the optional keyword stored in the array, extracting the optional keyword to replace a character string PS adopted when the corresponding optional keyword is registered, and obtaining help information corresponding to the keyword and a corresponding parameter range.
For example: if the currently input optional keyword is trac and one optional keyword stored in the array is traceroute, the two parts are the same, the two parts are matched, and the traceroute is directly extracted to replace a character string PS adopted when the corresponding optional keyword is registered.
The fourth embodiment:
on the basis of the first embodiment and the second embodiment, when the custom analysis function judges whether the currently input optional keywords are matched with the optional keywords stored in the array, the currently partially input optional keywords can be automatically supplemented in an association manner. Another association is emphasized in this embodiment.
And if the currently input optional keyword is partially identical to at least two optional keywords stored in the array, matching, providing all partially identical optional keywords for selection, and replacing a character string PS adopted during registration of the corresponding optional keyword according to the optional keyword selected by the user to obtain help information corresponding to the optional keyword and a corresponding parameter range.
For example: the current input optional keyword is dh, the optional keywords stored in the array have dhcp and dhcpsinoping which are matched with the current input, the dhcp and the dhcpsinoping can be listed at the same time for the user to select, if the user selects the dhcp, the dhcp is used for replacing a character string PS adopted during the registration of the optional keyword, and the help information corresponding to the optional keyword and the corresponding parameter range are obtained at the same time.
Fifth embodiment:
on the basis of the third and fourth embodiments, if the selectable keyword has a corresponding parameter range, but no parameter is subsequently input to the selectable keyword, or the parameter subsequently input to the selectable keyword does not belong to the corresponding parameter range in the contrast array, it is determined that the parameter of the keyword is in an illegal state, and the process is ended.
Sixth embodiment:
the invention relates to a system for realizing command line input, which comprises a command line definition module 1 and an analysis module 2.
The command line defining module 1 is used for defining the form of the command line, the key words and parameters which must be input are placed in front, the optional key words and parameters are placed in the back of all the keys which must be input, the optional key words are not used for distinguishing the sequence, and all the optional key words and parameters can be replaced by character strings PS. Specifically, the command line definition module 1 includes a data structure 11 and an array 12, and the data structure associates each optional keyword, corresponding help information, and corresponding parameter range information; the members of array 12 are data structures 11.
The analysis module 2 automatically supplements part of the input optional keywords according to the registered self-defined command line through a self-defined analysis function of an analysis definition command line, and is also used for judging whether the input optional keywords and parameters are legal or not. And only if all the input optional keywords and parameters are legal, executing the self-defined command line according to the input parameters.
Seventh embodiment:
on the basis of the sixth embodiment, in this embodiment, the system for implementing command line input includes a command line definition module 1 and an analysis module 2, where the command line definition module 1 includes a data structure 11 and an array 12, and a member of the array 12 is the data structure 11. The analysis module 2 comprises a custom command line distinguishing module 21, a keyword distinguishing module 22 and a parameter distinguishing module 23.
The custom command line determination module 21 is configured to traverse the command tree and determine whether the input command line is a registered custom command line. If not, the description is a normal command line, then the resolution is performed by the existing command line kernel resolution program. If yes, the keyword discrimination module 22 traverses the array 12 to determine the validity of the currently input optional keyword. The currently entered alternate key is only declared legitimate if it matches the alternate key stored in array 12 and there is no logical conflict between the currently entered alternate key and the already entered alternate key.
The parameter discrimination module 23 is configured to traverse the array 12 and determine the validity of the subsequent input parameter of the currently input optional keyword. When the subsequent input parameters of the selectable keyword belong to the corresponding parameter range in the array 12, the parameter corresponding to the current selectable keyword is legal.
Otherwise, if the currently input optional keyword does not match the optional keyword stored in the array 12, a logic conflict exists between the currently input optional keyword and the already input optional keyword, or the subsequent input parameter of the optional keyword does not belong to the corresponding parameter range in the array 12, the judgment is illegal, and the corresponding module directly ends the judgment.
In addition, the keyword determination module 23 further includes an association unit 230, configured to supplement part of the input legal optional keywords, and obtain help information and corresponding parameter ranges corresponding to the optional keywords.
Wherein, if the currently input optional keyword is partially the same as a certain optional keyword stored in the array 12, the association unit 230 supplements the currently input optional keyword directly according to the optional keyword stored in the array 12.
If the currently input optional keyword is partially identical to at least two optional keywords stored in the array 12, and the currently input optional keyword is matched with the at least two optional keywords stored in the array 12, the association unit 230 provides all the partially identical optional keywords for selection, and replaces the character string adopted when the corresponding optional keyword is registered with the selected keyword.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention. Those not described in detail in this specification are within the skill of the art.

Claims (13)

1. A method for implementing command line input is characterized by comprising the following steps:
defining a self-defined command line, wherein optional keywords and parameters are placed behind the input keys and replaced by character strings;
defining a custom parsing function for analyzing the custom command line, and binding the custom parsing function with the custom command line registered on a command tree;
judging whether the optional keywords and the parameters are legal or not through the custom analytic function, and automatically supplementing part of the input optional keywords according to custom command line prototypes on a command tree;
defining the custom command line includes:
enumerating all optional keyword definitions needing to be supported in a user-defined command line;
defining a data structure, and associating each optional keyword, the corresponding help information and the corresponding parameter range information;
defining an array, the members of which are said data structure;
defining the form of the self-defined command line, placing the key words and parameters which must be input in the front, and placing all the optional key words and parameters in the back;
the user-defined analysis function analyzes the input command line, traverses the command tree, searches a command line prototype matched with the command line, and analyzes through the user-defined analysis function if the command line prototype is user-defined; if the command line prototype is not self-defined, analyzing through the original flow.
2. A method of implementing command line input as recited in claim 1, wherein: in the data structure, if the optional keyword does not have a parameter, the corresponding parameter range information is null.
3. A method of implementing command line input as recited in claim 1, wherein: and the user-defined analysis function analyzes the user-defined command line, and if the currently input optional keyword is not matched with the optional keyword stored in the array or the currently input optional keyword and the input optional keyword have logic conflict, the input is considered to be illegal, and the process is ended.
4. A method of implementing command line input as recited in claim 1, wherein: and the custom analysis function analyzes the custom command line, and if the currently input optional keyword is matched with the parameters stored in the array, the currently input optional keyword and the input optional keyword have no logic conflict, and the parameters continuously input by the user belong to the corresponding parameter range in the array, the currently input optional keyword and the corresponding parameters are legal.
5. A method of implementing command line input as recited in claim 4, wherein: and the user-defined analysis function analyzes the user-defined command line, if the currently input optional keyword is partially the same as a certain optional keyword stored in the array, the currently input optional keyword is matched, the currently input optional keyword is directly supplemented according to the optional keyword stored in the array, and the optional keyword is extracted to replace a character string adopted when the corresponding optional keyword is registered, so that help information corresponding to the optional keyword and a corresponding parameter range are obtained.
6. A method of implementing command line input as recited in claim 4, wherein: and the custom analysis function analyzes the custom command line, if the currently input optional keyword is partially the same as at least two optional keywords stored in the array, the currently input optional keyword is matched with the at least two optional keywords stored in the array, all the partially same optional keywords are provided for selection, the selected optional keyword is used for replacing a character string adopted during registration of the corresponding optional keyword, and the help information corresponding to the optional keyword and the corresponding parameter range are obtained.
7. A method of implementing command line input as claimed in claim 5 or 6, wherein: if the selectable keyword has a corresponding parameter range, and no parameter is subsequently input, or the subsequently input parameter does not belong to the corresponding parameter range in the contrast array, the parameter is determined to be in an illegal state, and the process is ended.
8. A system for implementing command line input by using the method of claim 1, comprising:
the command line definition module is used for defining that the optional keywords and parameters in the command line are placed behind the input keys and replaced by character strings;
and the analysis module is used for automatically supplementing part of input optional keywords according to the registered self-defined command line and judging whether the input optional keywords and parameters are legal or not.
9. The system of claim 8, wherein: the command line definition module comprises a data structure and an array, wherein the data structure associates each optional keyword, corresponding help information and corresponding parameter range information; the members of the array are the data structures.
10. The system of claim 9, wherein the parsing module comprises:
the self-defined command line judging module is used for traversing the command tree and judging whether the input command line is a registered self-defined command line;
the keyword judging module is used for traversing the array to judge the validity of the currently input optional keyword;
and the parameter judging module is used for traversing the array to judge the legality of the subsequent input parameters of the currently input optional keywords.
11. The system of claim 9, wherein: the keyword distinguishing module also comprises an association unit which is used for supplementing part of input legal selectable keywords and acquiring help information corresponding to the selectable keywords and corresponding parameter ranges.
12. The system of claim 11, wherein: and if the currently input optional keyword is partially the same as a certain optional keyword stored in the array, matching, and directly supplementing the currently input optional keyword by the association unit according to the optional keyword stored in the array.
13. The system of claim 11, wherein: and if the currently input optional keywords are partially the same as at least two optional keywords stored in the array, matching the currently input optional keywords with the at least two optional keywords, providing all the partially same optional keywords for selection by the association unit, and replacing character strings adopted when the corresponding optional keywords are registered with the selected keywords.
CN201810289981.4A 2018-04-03 2018-04-03 Method and system for realizing command line input Active CN108647043B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810289981.4A CN108647043B (en) 2018-04-03 2018-04-03 Method and system for realizing command line input

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810289981.4A CN108647043B (en) 2018-04-03 2018-04-03 Method and system for realizing command line input

Publications (2)

Publication Number Publication Date
CN108647043A CN108647043A (en) 2018-10-12
CN108647043B true CN108647043B (en) 2021-03-16

Family

ID=63745573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810289981.4A Active CN108647043B (en) 2018-04-03 2018-04-03 Method and system for realizing command line input

Country Status (1)

Country Link
CN (1) CN108647043B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110196714A (en) * 2019-06-04 2019-09-03 上海合桀软件技术有限公司 A kind of conversion restoring method of original directive, storage equipment and terminal
CN112804076B (en) * 2019-11-14 2022-11-04 大唐移动通信设备有限公司 Instruction response method and network equipment
CN111443915B (en) * 2020-03-30 2023-05-16 山东华辰连科通信网络有限公司 Method and system for realizing CLI command interface on singlechip
CN113504958A (en) * 2021-05-25 2021-10-15 曙光网络科技有限公司 Command execution method based on command line interface, electronic equipment and storage medium
CN113922979B (en) * 2021-08-23 2023-07-04 北京天融信网络安全技术有限公司 Network security equipment configuration system, configuration method and computer equipment
CN113722009A (en) * 2021-08-27 2021-11-30 上海矽昌微电子有限公司 Parameter analysis method, system, terminal equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490977A (en) * 2002-10-17 2004-04-21 华为技术有限公司 Analysis of universal route platform command lines
CN1534460A (en) * 2003-03-28 2004-10-06 烽火通信科技股份有限公司 Management method possessing real time helping function in insertion type system
CN101193109A (en) * 2006-12-01 2008-06-04 中兴通讯股份有限公司 A method for supporting interactive command in command line interface of communication device
CN101944023A (en) * 2010-09-14 2011-01-12 南京联创科技集团股份有限公司 Implement method of universal command line interface of UNIX server software
CN102880471A (en) * 2012-09-24 2013-01-16 中兴通讯股份有限公司 Command execution method based on command line and command line operating system
CN102902547A (en) * 2012-10-18 2013-01-30 上海师范大学 Command construction and analysis method of command line interface
CN103532756A (en) * 2013-10-15 2014-01-22 上海寰创通信科技股份有限公司 Command line system and command line operation method based on webmaster system
US8707252B1 (en) * 2008-09-03 2014-04-22 Emc Corporation Techniques for automatic generation of parsing code
CN105354021A (en) * 2015-10-08 2016-02-24 盛科网络(苏州)有限公司 Implementation method for integrating command lines in Linux kernel
CN106951213A (en) * 2017-03-27 2017-07-14 杭州迪普科技股份有限公司 A kind of command analysis method and device
CN107426041A (en) * 2017-09-21 2017-12-01 杭州迪普科技股份有限公司 A kind of method and apparatus of resolve command

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9400675B1 (en) * 2015-07-28 2016-07-26 International Business Machines Corporation Tagging virtual machine instances based on commands
US10621298B2 (en) * 2015-10-26 2020-04-14 Synopsys, Inc. Automatically generated schematics and visualization

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490977A (en) * 2002-10-17 2004-04-21 华为技术有限公司 Analysis of universal route platform command lines
CN1534460A (en) * 2003-03-28 2004-10-06 烽火通信科技股份有限公司 Management method possessing real time helping function in insertion type system
CN101193109A (en) * 2006-12-01 2008-06-04 中兴通讯股份有限公司 A method for supporting interactive command in command line interface of communication device
US8707252B1 (en) * 2008-09-03 2014-04-22 Emc Corporation Techniques for automatic generation of parsing code
CN101944023A (en) * 2010-09-14 2011-01-12 南京联创科技集团股份有限公司 Implement method of universal command line interface of UNIX server software
CN102880471A (en) * 2012-09-24 2013-01-16 中兴通讯股份有限公司 Command execution method based on command line and command line operating system
CN102902547A (en) * 2012-10-18 2013-01-30 上海师范大学 Command construction and analysis method of command line interface
CN103532756A (en) * 2013-10-15 2014-01-22 上海寰创通信科技股份有限公司 Command line system and command line operation method based on webmaster system
CN105354021A (en) * 2015-10-08 2016-02-24 盛科网络(苏州)有限公司 Implementation method for integrating command lines in Linux kernel
CN106951213A (en) * 2017-03-27 2017-07-14 杭州迪普科技股份有限公司 A kind of command analysis method and device
CN107426041A (en) * 2017-09-21 2017-12-01 杭州迪普科技股份有限公司 A kind of method and apparatus of resolve command

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
命令行接口管理系统的设计与实现;解震春 等;《无线电工程》;20021231;第32卷(第11期);第45-56页 *
用于IPv6的RIPng路由器研究;朱新宇;《中国优秀硕士学位论文全文数据库(电子期刊) 信息科技辑》;20091115;第2009年卷(第11期);论文第52-62页 *

Also Published As

Publication number Publication date
CN108647043A (en) 2018-10-12

Similar Documents

Publication Publication Date Title
CN108647043B (en) Method and system for realizing command line input
KR102402176B1 (en) Apparatus and method of generating lookups and making decisions for packet modifying and forwarding in software-defined network engine
US6954789B2 (en) Method and apparatus for monitoring traffic in a network
CN112468370B (en) High-speed network message monitoring and analyzing method and system supporting custom rules
US7299282B2 (en) State processor for pattern matching in a network monitor device
US9825841B2 (en) Method of and network server for detecting data patterns in an input data stream
US6771646B1 (en) Associative cache structure for lookups and updates of flow records in a network monitor
US8264976B2 (en) Network monitoring based on pointer information
US9336203B2 (en) Semantics-oriented analysis of log message content
US8442931B2 (en) Graph-based data search
US7636787B2 (en) Parser for parsing text-coded protocol
US20150095359A1 (en) Volume Reducing Classifier
US20150262009A1 (en) Apparatus for, a Method of, and a Network Server for Detecting Data Patterns in a Data Stream
CN112672381B (en) Data association method, device, terminal equipment and medium
CN102364897A (en) Gateway-level on-line network message detection filtering method and apparatus thereof
CN110336798B (en) Message matching filtering method and device based on DPI
CN101741745B (en) Method and system for identifying application traffic of peer-to-peer network
US9807204B2 (en) Optimized message processing
CN112054992B (en) Malicious traffic identification method and device, electronic equipment and storage medium
JPWO2005036834A1 (en) Statistical information collection method and apparatus
CN108170812B (en) Data filtering method and equipment
US9577669B2 (en) Methods, systems, and computer readable media for optimized message decoding
CN109743260A (en) A kind of device and method that network flow is filtered based on improved ACBM algorithm
CN112565259B (en) Method and device for filtering DNS tunnel Trojan communication data
KR101881797B1 (en) Multipattern policy detection system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant