CN1889442A - Method and apparatus for identifying terminal command line - Google Patents

Method and apparatus for identifying terminal command line Download PDF

Info

Publication number
CN1889442A
CN1889442A CNA2006100872439A CN200610087243A CN1889442A CN 1889442 A CN1889442 A CN 1889442A CN A2006100872439 A CNA2006100872439 A CN A2006100872439A CN 200610087243 A CN200610087243 A CN 200610087243A CN 1889442 A CN1889442 A CN 1889442A
Authority
CN
China
Prior art keywords
state
order
terminal
input
command
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.)
Granted
Application number
CNA2006100872439A
Other languages
Chinese (zh)
Other versions
CN100452706C (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.)
Zhejiang Qi Polytron Technologies Inc
Original Assignee
Qizhi Information Science & Technology Co Ltd Hangzhou
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 Qizhi Information Science & Technology Co Ltd Hangzhou filed Critical Qizhi Information Science & Technology Co Ltd Hangzhou
Priority to CNB2006100872439A priority Critical patent/CN100452706C/en
Publication of CN1889442A publication Critical patent/CN1889442A/en
Priority to HK07105875.2A priority patent/HK1098612A1/en
Priority to PCT/CN2007/001872 priority patent/WO2007147339A1/en
Application granted granted Critical
Publication of CN100452706C publication Critical patent/CN100452706C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/105Program control for peripheral devices where the programme performs an input/output emulation function
    • G06F13/107Terminal emulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A method for identifying command line of terminal includes obtaining input and output data between terminal and host, carrying out analog on output data by analog terminal to obtain output content having display content and terminal state, carrying out identification of output content by utilizing input data to obtain command line of terminal. The device for realizing said method is also disclosed.

Description

A kind of method and apparatus of identification terminal order line
Technical field
The present invention relates to the capable method and apparatus of a kind of recognition command, particularly relate to a kind of method and apparatus of identification terminal order line.
Background technology
Terminal has a wide range of applications in all kinds of Unix main frames and communication system, by terminal operate and management have direct, safe and reliable, resource occupation is little, the efficient advantages of higher.Terminal mainly is made up of keyboard that is used to import and the display that is used to export, and display is a character pattern, and the row and column of some is arranged, and itself does not have disposal ability, only is a kind of input/output medium of type mode.Terminal can be the equipment of hardware, couples together by communication line and host computer system; Also can be the virtual terminal of software, for example the terminal software that moves on the PC can arrive one or more main frame that connects by network entry.
Many and large-scale host computer system or the core communication apparatus of terminal is connected, and this just has very high requirement to the stability and the fail safe of its operation, therefore will audit to user's terminal operation, and the execution of high-risk operation is limited.The operation of terminal mainly is divided into order line and real-time, interactive dual mode, and is also inequality to the method that this dual mode is audited: can simply carry out playback to terminal output to the real-time, interactive mode; To command line mode, each bar order that hope can recording user be carried out and corresponding execution result.And command line mode is audited and limited, at first just must realize that recognition command is capable.
The method that existing recognition command is capable has three classes:
The method of the first kind is, carries out work by terminal mode, and input data and dateout through terminal are carried out record, when needing record reset, and therefrom seeks information and the operation that needs.These class methods are more original, shortcoming is: just terminal data itself is simply write down and playback, can only see that concrete operation meets, can't directly see the tabulation of all orders, the efficient of audit is very low, and can't block high-risk order in real time by said method.
The method of second class is, shell at this operating system is installed in the operating system of main frame, because this program is to move as the part of operating system, so the identification and the judgement of operating system are at first passed through in user's operation, operating system transfers user's input to system executable operational order, and operating system writes journal file to order line by shell earlier before carrying out mentioned order, so that further audit and control.The shortcoming of these class methods is: need make amendment to the operating system of main frame operation, and the content that different operating system is revised differs greatly, so workload big, safeguard complicatedly, risk is higher, it is very big to implement difficulty; When relating to multiple operating system, the versatility of shell is very low.
The method of the 3rd class is, simulation of dateout process and conversion to terminal, the word of respectively composing a piece of writing that is finally shown, then the literal that shows is coupled together and write a big text, on each row, seek the CMD of main frame, if being arranged, prompt just thinks that this row is an order, gets off the content behind the prompt then as command record.These class methods rely on specific CMD, but owing to prompt can change by the setting of operating system, or CMD also may be only with the form appearance of text sometimes, and therefore, the reliability of these class methods is poor.
In said method, prior art adopts second class or the 3rd class methods more, so have following shortcoming and problem: the reliability of identification is relatively poor, or realization is complicated, cost is high, versatility is poor.Reliability is difficult to realize simultaneously with low-cost, high universalizable.
Summary of the invention
Technical problem to be solved by this invention provides a kind of method of identification terminal order line, relatively poor with the reliability that solves the identification that exists in the above-mentioned prior art, or realize complicated, cost is high, the shortcoming and the problem of versatility difference, realizes that low-cost, high universalizable guarantees the reliability of discerning simultaneously.
The present invention also provide a kind of identification terminal order line device.
The method of identification terminal order line provided by the invention comprises the following steps:
Obtain input data and dateout between terminal and the main frame;
Dateout is simulated by pseudo-terminal, obtained output content, described output content comprises displaying contents and SOT state of termination;
In conjunction with the input data output content is discerned, obtained terminal command line.
The method that method of intercepting by network intercepting or communication line or software are transmitted is obtained input data and the dateout between terminal and the main frame.
Output content is discerned in conjunction with the input data according to following step:
Check output content;
When CMD appears in output content, check whether the input data are arranged;
If the input data are arranged, think that then the displaying contents behind the CMD is an order line in the output content;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
Preferably, output content is discerned in conjunction with the input data according to following step:
Set up a command library, comprise all orders of operating system in the command library;
Check output content;
When CMD appears in output content, check whether the input data are arranged;
If the input data are arranged, then first field of displaying contents behind the CMD and the order in the command library are mated; If the order that can mate is arranged, think that then the displaying contents behind the CMD is an order line;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
Preferably, output content is discerned in conjunction with the input data according to following step:
Wait for input data or output content;
Obtain the current command status recognition;
When the command recognition state is the order input state, think that then the displaying contents of output content is an order line;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
Obtain the current command status recognition according to following state exchange step:
Making default state is the program output state;
When receiving input character, state transfers the order input state to, the further input data of checking, and when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to.
Preferably, obtain the current command status recognition according to following state exchange step:
Making default state is the program output state;
When receiving input character, state transfers the order input state to;
Further check the input data under the order input state, if the input data are for helping character, state transfers the command cue state to;
The further input data of checking under the order input state, when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to;
Under the command cue state, when input data when being non-help character, state transfers the order input state to.
Preferably, obtain the current command status recognition according to following state exchange step:
Making default state is the program output state;
When dateout is that state transfers the interactive application state to when entering the characteristic sequence of interaction mode;
When receiving input character, state transfers the order input state to;
Further check the input data under the order input state, if the input data are for helping character, state transfers the command cue state to;
The further input data of checking under the order input state, when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to;
Under the command cue state, when input data when being non-help character, state transfers the order input state to;
Under the interactive application state, when dateout is that state transfers the program output state to when withdrawing from the characteristic sequence of interaction mode.
Described help character be the TAB key or "? " key.
The described characteristic sequence that enters interaction mode is:
No. 47, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1047, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1049, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1, the pattern that is provided with of VT100 and compatible terminal.
The described characteristic sequence that withdraws from interaction mode is:
No. 47, the removing pattern of VT102 and compatible terminal, and/or No. 1047, the removing pattern of VT102 and compatible terminal, and/or No. 1049, the removing pattern of VT102 and compatible terminal, and/or No. 1, the removing pattern of VT100 and compatible terminal.
The invention also discloses a kind of device of the identification terminal order line based on said method, described device comprises:
The terminal data acquisition equipment is responsible for obtaining input data and dateout between terminal and the main frame;
The terminal simulation device, dateout is obtained output content by the simulation of pseudo-terminal;
Command recognition unit is discerned output content in conjunction with the input data, obtains terminal command line.
Described command recognition unit comprises:
Output content is differentiated sub-device, checks output content, and when CMD appearred in the output content of pseudo-terminal, sub-device was differentiated in the prompting input;
Sub-device is differentiated in input, differentiate the prompting of sub-device according to output content, obtain order line, when i.e. prompting CMD and terminal occur input is arranged, think that then the displaying contents of output content of the pseudo-terminal behind the prompt is an order line, when order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
Preferably, described command recognition unit comprises:
Command library comprises all orders of system in the command library;
Output content is differentiated sub-device, checks output content, and when CMD appearred in the output content of pseudo-terminal, sub-device was differentiated in the prompting input;
Sub-device is differentiated in input, differentiate the prompting of sub-device according to output content, obtain order line, when promptly CMD appears in prompting, then first field that pseudo-terminal behind the CMD is shown and the order in the command library are mated, if coupling thinks that then the displaying contents of output content of the pseudo-terminal behind the prompt is an order line, when order acknowledgement key or command execution key or order cancellation key appear in the input data, think that then an order line finishes.
Preferably, described command recognition unit comprises:
Sub-device is differentiated in input, checks whether terminal has input;
The command recognition state is determined sub-device, judges the current command status recognition according to input data and dateout;
Obtain the sub-device of order line, the current command status recognition is order during input state, thinks that then the displaying contents of output content of pseudo-terminal is an order line, when order acknowledgement key or command execution key appear in the input data, think that then an order line finishes, obtain the capable and preservation of mentioned order; When the order cancellation key appears in the input data, think that an order line finishes, but it is capable not preserve mentioned order.
Described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user.
Preferably, described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user;
The command cue state, expression is in the assist command input state of order completion at present.
Preferably, described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user;
The interactive application state represents that this computer-chronograph is in the interactive application state of some full frame interactive programs of operation;
The command cue state, expression is in the assist command input state of order completion at present.
Compared with prior art, the present invention have simultaneously realize simple, cost is low, versatility is good, the advantage of high reliability, has guaranteed the reliability of identification when realizing low-cost, high universalizable, and is specific as follows:
1, realization is simple, cost is low;
Because above-mentioned method and apparatus at first obtains input data and dateout between terminal and the main frame, simulate dateout then and obtain output content, in conjunction with the input data output content is discerned thereafter, obtain station command.Above-mentioned application and installation all are independent of the operating system of main frame, need not the software on every computer is made amendment, and complexity and risk are all lower, so realization is simple, cost is low
2, versatility is good;
Because the data basis of above-mentioned method and apparatus operation is the initial data of the input and output of terminal and main frame, the data format that does not relate to operating system or application software, therefore can be applied to have good versatility under the environment of various operating systems and application software eaily.
3, high reliability
Because above-mentioned method and apparatus is not only to discern at input data or dateout, but after obtaining input data and dateout between terminal and the main frame, dateout is simulated demonstration, obtain output content, in conjunction with the input data output content is discerned then, and multiple method in conjunction with identification is disclosed, therefore the identification that realizes has very high reliability.
Description of drawings
Fig. 1 is the basic step flow chart of the capable method of recognition command of the present invention;
Fig. 2 is the flow chart of steps of the method that recognition command of the present invention is capable among the embodiment 1;
Fig. 3 is the apparatus structure block diagram that recognition command of the present invention is capable among the embodiment 2;
Fig. 4 is the flow chart of steps of the method that recognition command of the present invention is capable among the embodiment 3;
Fig. 5 is the capable apparatus structure block diagrams of recognition command of the present invention for embodiment 4;
Fig. 6 is the flow chart of steps of the embodiment 5 of the capable method of recognition command of the present invention;
Fig. 7 is the apparatus structure block diagram of the capable embodiment of recognition command of the present invention 6;
Fig. 8 is for judging method one flow chart of steps of the current command status recognition;
Fig. 9 is for judging the method two flow chart of steps of the current command status recognition;
Figure 10 is for judging method three flow chart of steps of the current command status recognition.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
The invention discloses a kind of method and apparatus of identification terminal order line, described method and apparatus is based on that following step realizes:
With reference to Fig. 1,
At first, obtain input data and dateout between terminal and the main frame, intercept and capture or intercept the communication data between terminal use and the main frame, obtain the input and output data flow of terminal.Specifically can realize according to terminal type is different with deployed environment by the mode that network intercepting, communication line are intercepted or software is transmitted.
Then, use pseudo-terminal that dateout is simulated, obtain output content, visible pseudo-terminal is the transducer that dateout is transferred to output content, and common pseudo-terminal has: VT102 and compatible pseudo-terminal, VT100 and compatible pseudo-terminal etc.The operation principle and the step of pseudo-terminal are: pseudo-terminal inside mainly contains maintenance terminal state and two main states of output buffer: SOT state of termination is made up of the position at the size of current terminal, cursor place, current screen etc.; Preserve the content of current cursor be expert at before newline in the output buffer.The process major cycle of simulation is carried out around each terminal output character, and the normal exit criteria of major cycle is that terminal is closed.At each output character of reading, pseudo-terminal is judged its type, can belong to general character, simple control character and three kinds of situations of terminal control sequence.General character mainly comprises letter, numeral and various symbol and space; Simple control character defines in standard A SCII sign indicating number, realizes the control character of simple terminal control function, as backspace, carriage return, line feed, tab etc.; The terminal control sequence is to define in the VT102 terminal protocol, form by a series of characters, be used for to terminal carry out complicated state and function control as cursor position and state are set, character and background color are set, roll screen, to whole section literal of full line delete, screen switching etc.Various output characters and sequence can exert an influence to the state and the output buffer of terminal, and effects such as screen switching, cursor position change and content modification take place.These influences can take place usually simultaneously, as export " a " character, can be the character change of the current cursor position of terminal " a ", then cursor are moved forward a position; If cursor has arrived last row of terminal before, then cursor can advance to first row of next line; If simultaneously cursor has arrived last column of terminal before, then can produce the make progress action of roll screen of a single file, after the delegation that makes new advances clearly cursor is set to first row of newline.Pseudo-terminal comes the more state and the output buffer of new terminal according to these rules according to each character of reading, finally obtains output content.Output content comprises displaying contents and SOT state of termination.
In conjunction with the input data output content is discerned,, realized that the approach of identification has so several: input data or dateout are discerned from existing technology; To import data be converted to the input content discern; Dateout is converted to output content to be discerned.Scheme disclosed by the invention is to discerning through the output content that obtains after the analog-converted dateout in conjunction with the input data.This method in conjunction with identification can realize identification low-cost, efficiently and have good versatility.
By above-mentioned steps, finally obtain terminal command line.Can store the order line that identification obtains, also can offer other system and be further processed, as order audit, dangerous blocking-up of ordering or the like.
Following embodiment all is based on above-mentioned steps or principle, and discloses several in conjunction with importing the concrete scheme that data are discerned output content.
Embodiment 1
With reference to Fig. 2, present embodiment discloses a kind of concrete scheme of method of identification terminal order line.At first, obtain input data and dateout between terminal and the main frame.Then dateout is simulated by pseudo-terminal, obtained output content, described output content comprises displaying contents and SOT state of termination.In conjunction with the input data output content being discerned concrete grammar is: when CMD appears in the output content of pseudo-terminal, check whether terminal has the input data; Then do not continue to check output content if there are the input data,, think that then the displaying contents of the output content behind the prompt is an order line if terminal has input; The displaying contents of the pseudo-terminal behind the record prompt is checked the input data simultaneously, when order acknowledgement key, command execution key or order cancellation key appear in the input data, thinks that then an order line finishes.By above-mentioned steps, identification obtains terminal command line.
Embodiment 2
With reference to Fig. 3, this is a kind of device of the identification terminal order line based on embodiment 1 scheme.This device comprises terminal data acquisition equipment 31, terminal simulation device 32 and command recognition unit 33, and wherein command recognition unit 33 comprises that output content is differentiated sub-device 34 and sub-device 35 is differentiated in input.
Terminal data acquisition equipment 31 is responsible for obtaining the input and output data 101 between terminal and the main frame, and the input and output data of obtaining 101 are divided into dateout 102 and input data 103; 32 pairs of dateouts of terminal simulation device 102 are simulated, and obtain the output content 104 of terminal, and described output content comprises displaying contents and SOT state of termination; Command recognition unit 33 is discerned in conjunction with output content 104 and input data 103, and wherein output content is differentiated sub-device 34, checks output content 104, and when CMD appearred in the output content 104 of pseudo-terminal, sub-device 35 was differentiated in the prompting input; Input is differentiated sub-device 35 and is differentiated the prompting of sub-device 34 according to output content, when CMD appears in the output content 104 of pseudo-terminal, checks then whether input data 103 are arranged; Do not continue to wait for prompting if there are 103 of input data,, think that then the displaying contents of output content 104 of the pseudo-terminal behind the prompt is an order line if terminal has input; The output content 104 of the pseudo-terminal behind the record prompt when order acknowledgement key, command execution key or order cancellation key appear in input data 103, thinks that then an order line finishes.By above-mentioned steps, identification obtains terminal command line 105.
Embodiment 3
With reference to Fig. 4, present embodiment discloses the concrete scheme of the method for another kind of identification terminal order line.At first, obtain input data and dateout between terminal and the main frame.Then dateout is simulated by pseudo-terminal, obtained output content, described output content comprises displaying contents and SOT state of termination.In conjunction with the input data output content being discerned concrete grammar is: set up a command library, comprise all orders of operating system in the command library; Check the output content of pseudo-terminal; When CMD appears in output content, check whether terminal has input; Then do not continue to check output content if there are the input data; If terminal has input, then first field that pseudo-terminal behind the CMD is shown and the order in the command library are mated; Then do not continue to check output content if there is the order of coupling; If the order that can mate is arranged, think that then the displaying contents of the output content behind the prompt is an order line; Displaying contents behind the record prompt is checked the input data simultaneously, when order acknowledgement key, command execution key or order cancellation key appear in the input data, thinks that then an order line finishes.By above-mentioned steps, identification obtains terminal command line.
Embodiment 4
With reference to Fig. 5, this is a kind of device of the identification terminal order line based on embodiment 3 schemes.This device comprises terminal data acquisition equipment 51, terminal simulation device 52 and command recognition unit 53, and wherein command recognition unit 53 comprises that output content is differentiated sub-device 54, sub-device 55 and command library 56 are differentiated in input.
Terminal data acquisition equipment 51 is responsible for obtaining the input and output data 101 between terminal and the main frame, and the input and output data of obtaining 101 are divided into dateout 102 and input data 103; 52 pairs of dateouts of terminal simulation device 102 are simulated, and obtain the output content 104 of terminal, and described output content comprises displaying contents and SOT state of termination; Command recognition unit 53 is discerned in conjunction with output content 104 and input data 103, and wherein output content is differentiated sub-device 54, checks output content 104, and when CMD appearred in the output content 104 of pseudo-terminal, sub-device 55 was differentiated in the prompting input; Input is differentiated sub-device 55 and is differentiated the prompting of sub-device 34 according to output content, when CMD appears in the output content 104 of pseudo-terminal, checks then whether input data 103 are arranged; Do not continue to wait for prompting if there are 103 of input data, if terminal has input, then feed back to output content and differentiate sub-device 54, output content is differentiated first field that 54 in sub-device shows pseudo-terminal behind the CMD and the order in the command library 56 is mated; Then do not continue to check output content 104 if there is the order of coupling; If the order that can mate is arranged, think that then the displaying contents of output content 104 of the pseudo-terminal behind the prompt is an order line; The displaying contents of the pseudo-terminal behind the record prompt, input is simultaneously differentiated sub-device 55 and is checked input data 103, when order acknowledgement key, command execution key or order cancellation key appearred in input data 103, the notice output content was differentiated 54 1 order lines of sub-device and is finished.By above-mentioned steps, identification obtains terminal command line 105.
Embodiment 5
With reference to Fig. 6,8,9,10, present embodiment discloses a kind of concrete scheme of method of identification terminal order line.At first, obtain input data and dateout between terminal and the main frame.Then dateout is simulated by pseudo-terminal, obtained output content, described output content comprises displaying contents and SOT state of termination.
Wait for input data or output content; When input, judge the state that the current command is discerned according to input data and dateout, about the method for judging the state that the current command is discerned following three kinds of methods are arranged, be applicable to different concrete applied environments:
Method one, with reference to Fig. 8, establishing default state is the program output state; When receiving input data 802, state transfers the order input state to, is that state transfers the program output state to when ordering acknowledge character, command execution character or order cancellation character 203 until these input data or input data afterwards.
For the ease of understanding the method one in the present embodiment, with the following example that is operating as: when the user after CMD " [user@host dir] ", input command " 1s-1 ", and carry out by carriage return; Computer is carried out the 1s program, shows the output result, and then display command prompt " [user@host dir] $ ".
For the mentioned order input, from user key-press, the state of command recognition becomes the order input state from the program output state variable.At this moment the displaying contents of terminal simulator is " [user@host dir] $ ", and writing down prompt length simultaneously is 17 (spaces that comprise afterbody).When the user pressed enter key by the time, the displaying contents of terminal simulator became " [user@host dir] $1s-1 ", just thought at this moment in the buffering area that the displaying contents behind the 17th character is exactly the order of user's input and gives record; Be the status modifier of command recognition the program output state then, after this show occur from this command execution to next prompt before the terminal output content all regard the direct record of output of program as, so but next prompt itself do not stopped can not exporting immediately as yet owing to this row by line feed character.Write down the order line of identification, this moment, the state of command recognition was got back to the program output state again, waited the order line of next input to be identified.
If the input process of last example is, at first input " 1-1 " moves to cursor by the CTRL-A Macintosh then and presses " s " after capable head moves to second lattice to cursor with Right Arrow or CTRL-F Macintosh again and return the car operation then.Although can produce more complicated terminal control sequence, the displaying contents that is obtained by terminal simulator at last all is the same, and order line still can be by correct identification.
Method two: with reference to Fig. 9, default state is the program output state; When receiving input data 802, state transfers the order input state to, is that state transfers the program output state to when ordering acknowledge character, command execution character or order cancellation character 203 until these input data or input data afterwards; When the input data when helping character 204, state transfers the command cue state to, until when to import data be non-help character 902, state transfers the order input state to.
For the ease of understanding the method two in the present embodiment, with the following example that is operating as: the user presses tab key after having imported " 1s-1R ", this moment tab key to be operated system definition be help button, " EADME " five characters of the automatic completion of operating system meeting back, the user directly carries out this order by carriage return then.
Concrete identifying is, the state of command recognition enters the order input state when the user begins to import, " EADME " that shows after the user presses TAB when terminal enters the buffering area of terminal simulator automatically, and this moment, displaying contents was correct order " 1s-1 README ".
In last example, if the file with the R beginning under the current directory has " README " and " RELEASES " two, the user presses the TAB key after having imported " 1s-1R ", operating system is replenished the E character at first automatically, line feed shows " README " and " RELEASES " two filenames then, again the part order " 1s-1RE " that enters a new line the display command prompt afterwards and finished, the user sees prompting back input A character and presses the TAB key that the automatic completion of operating system " DME " character forms complete order " 1s-1 README ".
Concrete identifying is, system is receiving the user when importing the TAB character, the state of command recognition enters the command cue state, operating system shows that newline, optional file name are pointed out and order line is not finished in the demonstration that enters a new line again afterwards, and the terminal output of this moment can be recorded to the output procedure file but can not be considered to order carries out record.Press A key and last enter key up to the user, the state of command recognition reenters the order input state again, so complete order " 1s-1 README " can go on record.
Method three: with reference to Figure 10, default state is the program output state; When dateout is that state transfers the interactive application state to when entering the characteristic sequence 206 of interaction mode, until being that state transfers the program output state to when withdrawing from the characteristic sequence 207 of interaction mode when dateout; When receiving input data 802, state transfers the order input state to, is that state transfers the program output state to when ordering acknowledge character, command execution character or order cancellation character 203 until these data data or input data afterwards; When the input data when helping character 204, state transfers the command cue state to, until when to import data be non-help character 902, state transfers the order input state to.
For the ease of understanding the method three in the present embodiment, with the following example that is operating as: user's utility command " viREADME " operation vi program is edited the file of a README by name.He need add that content is the delegation of " [user@host dir] $hello " in end of file, therefore he moves on to tail of file to cursor by the G key earlier, sets up a newline by the o key again, word for word squeezes into after this row content by carriage return, press esc key then, ZZ preserves file and withdraws from.
Concrete identifying is, under the VT102 terminal, vi can be by show state when entering interactive editor's pattern sequence " ESC[? 1049h " switch to standby screen (alternative screen), after detecting this sequence, the state of command recognition switches to the interactive application state, ensuing operation can not be recorded, withdraw from vi up to the user, the sequence of terminal output show state " ESC[? 10491 " switch back original screen, after detecting this sequence, the state of command recognition becomes the program output state.Wait for next step operation of terminal use.
Above-mentioned help character 204 be tab key or "? " key.Above-mentioned common character is the input character except helping character or order acknowledge character or command execution character.The above-mentioned characteristic sequence 206 that enters interaction mode is: No. 47, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1047, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1049, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1, the pattern that is provided with of VT100 and compatible terminal.The above-mentioned characteristic sequence 207 that withdraws from interaction mode is: No. 47, the removing pattern of VT102 and compatible terminal, and/or No. 1047, the removing pattern of VT102 and compatible terminal, and/or No. 1049, the removing pattern of VT102 and compatible terminal, and/or No. 1, the removing pattern of VT100 and compatible terminal.
When the current command status recognition is the order input state, think that then the displaying contents of pseudo-terminal is an order line, the record output content; When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.By above-mentioned steps, can discern easily and accurately and obtain terminal command line.
Embodiment 6
With reference to Fig. 7,8,9,10, this is a kind of device of the identification terminal order line based on embodiment 5 schemes.This device comprises terminal data acquisition equipment 71, terminal simulation device 72 and command recognition unit 73, and wherein command recognition unit 73 comprises that obtaining the sub-device 74 of order line, the input sub-device 75 of differentiation and command recognition state determines sub-device 76.
Terminal data acquisition equipment 71 is responsible for obtaining the input and output data 101 between terminal and the main frame, and the input and output data of obtaining 101 are divided into dateout 102 and input data 103.72 pairs of dateouts of terminal simulation device 102 are simulated, and obtain the output content 104 of terminal, and described output content comprises displaying contents and SOT state of termination.Command recognition unit 73 is discerned in conjunction with output content 104 and input data 103, and detailed process is as follows: input is differentiated sub-device 75 and is checked whether terminal has input, and when input, input is differentiated sub-device 75 prompt command status recognitions and determined sub-device 76; The command recognition state determines that sub-device 76 is according to importing the state that data 103 and dateout 102 judge that the current command is discerned, be based among the embodiment 5 three kinds about the process of the state of judging the current command identification and judge what the status method of the current commands identification were carried out, when the current command status recognition is the order input state, think that then the displaying contents of pseudo-terminal is an order line, the command recognition state determines that 76 promptings of sub-device obtain the sub-device 74 of order line; Obtain the sub-device 74 record output contents 104 of order line; When order acknowledgement key, command execution key or order cancellation key appearred in the input data, input was differentiated sub-device 75 promptings and is obtained the sub-device 74 of order line, obtains the sub-device 74 of order line and thinks that promptly an order line finishes.By above-mentioned steps, identification obtains terminal command line 105.
More than to a kind of identification terminal order line method provided by the present invention, device, be described in detail, used specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (18)

1, a kind of method of identification terminal order line is characterized in that, comprising:
Obtain input data and dateout between terminal and the main frame;
Dateout is simulated by pseudo-terminal, obtained output content, described output content comprises displaying contents and SOT state of termination;
In conjunction with the input data output content is discerned, obtained terminal command line.
2, the method for identification terminal order line according to claim 1 is characterized in that, the method that method of intercepting by network intercepting or communication line or software are transmitted is obtained input data and the dateout between terminal and the main frame.
3, the method for identification terminal order line according to claim 1 is characterized in that, output content is discerned in conjunction with the input data according to following step:
Check output content;
When CMD appears in output content, check whether the input data are arranged;
If the input data are arranged, think that then the displaying contents behind the CMD is an order line in the output content;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
4, the method for identification terminal order line according to claim 1 is characterized in that, output content is discerned in conjunction with the input data according to following step:
Set up a command library, comprise all orders of operating system in the command library;
Check output content;
When CMD appears in output content, check whether the input data are arranged;
If the input data are arranged, then first field of displaying contents behind the CMD and the order in the command library are mated; If the order that can mate is arranged, think that then the displaying contents behind the CMD is an order line;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
5, the method for identification terminal order line according to claim 1 is characterized in that, output content is discerned in conjunction with the input data according to following step:
Wait for input data or output content;
Obtain the current command status recognition;
When the command recognition state is the order input state, think that then the displaying contents of output content is an order line;
When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
6, the method for identification terminal order line according to claim 5 is characterized in that, obtains the current command status recognition according to following state exchange step:
Making default state is the program output state;
When receiving input character, state transfers the order input state to;
The further input data of checking under the order input state, when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to.
7, the method for identification terminal order line according to claim 5 is characterized in that, obtains the current command status recognition according to following state exchange step:
Making default state is the program output state;
When receiving input character, state transfers the order input state to;
Further check the input data under the order input state, if the input data are for helping character, state transfers the command cue state to;
The further input data of checking under the order input state, when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to;
Under the command cue state, when input data when being non-help character, state transfers the order input state to.
8, the method for identification terminal order line according to claim 5 is characterized in that, obtains the current command status recognition according to following state exchange step:
Making default state is the program output state;
When dateout is that state transfers the interactive application state to when entering the characteristic sequence of interaction mode;
When receiving input character, state transfers the order input state to;
Further check the input data under the order input state, if the input data are for helping character, state transfers the command cue state to;
The further input data of checking under the order input state, when being order acknowledge character, command execution character or order cancellation character as if the input data, state transfers the program output state to;
Under the command cue state, when input data when being non-help character, state transfers the order input state to;
Under the interactive application state, when dateout is that state transfers the program output state to when withdrawing from the characteristic sequence of interaction mode.
9, according to the method for claim 7 or 8 described identification terminal order lines, it is characterized in that, described help character be the TAB key or "? " key.
10, the method for identification terminal order line according to claim 8 is characterized in that, the described characteristic sequence that enters interaction mode is:
No. 47, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1047, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1049, the pattern that is provided with of VT102 and compatible terminal, and/or No. 1, the pattern that is provided with of VT100 and compatible terminal.
11, the method for identification terminal order line according to claim 8 is characterized in that, the described characteristic sequence that withdraws from interaction mode is:
No. 47, the removing pattern of VT102 and compatible terminal, and/or No. 1047, the removing pattern of VT102 and compatible terminal, and/or No. 1049, the removing pattern of VT102 and compatible terminal, and/or No. 1, the removing pattern of VT100 and compatible terminal.
12, a kind of device of the identification terminal order line based on claim 1 is characterized in that, comprising:
The terminal data acquisition equipment is responsible for obtaining input data and dateout between terminal and the main frame;
The terminal simulation device, dateout is obtained output content by the simulation of pseudo-terminal;
Command recognition unit is discerned output content in conjunction with the input data, obtains terminal command line.
13, the device of identification terminal order line according to claim 12 is characterized in that, described command recognition unit comprises:
Output content is differentiated sub-device, checks output content, and when CMD appearred in the output content of pseudo-terminal, sub-device was differentiated in the prompting input;
Sub-device is differentiated in input, differentiates the prompting of sub-device according to output content, obtains order line, i.e. when prompting CMD and terminal occur input is arranged, think that then the displaying contents of output content of the pseudo-terminal behind the prompt is an order line; When order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
14, the device of identification terminal order line according to claim 12 is characterized in that, described command recognition unit comprises:
Command library comprises all orders of system in the command library;
Output content is differentiated sub-device, checks output content, and when CMD appearred in the output content of pseudo-terminal, sub-device was differentiated in the prompting input;
Sub-device is differentiated in input, differentiate the prompting of sub-device according to output content, obtain order line, when promptly CMD appears in prompting, then first field that pseudo-terminal behind the CMD is shown and the order in the command library are mated, if coupling thinks that then the displaying contents of output content of the pseudo-terminal behind the prompt is an order line, when order acknowledgement key, command execution key or order cancellation key appear in the input data, think that then an order line finishes.
15, the device of identification terminal order line according to claim 12 is characterized in that, described command recognition unit comprises:
Sub-device is differentiated in input, checks whether terminal has input;
The command recognition state is determined sub-device, judges the current command status recognition according to input data and dateout;
Obtain the sub-device of order line, the current command status recognition is order during input state, thinks that then the displaying contents of output content of pseudo-terminal is an order line, when order acknowledgement key or command execution key appear in the input data, think that then an order line finishes, obtain the capable and preservation of mentioned order; When the order cancellation key appears in the input data, think that an order line finishes, but it is capable not preserve mentioned order.
16, the device of identification terminal order line according to claim 15 is characterized in that, described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user.
17, the device of identification terminal order line according to claim 15 is characterized in that, described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user;
The command cue state, expression is in the assist command input state of order completion at present.
18, the device of identification terminal order line according to claim 15 is characterized in that, described command recognition state comprises:
The program output state represents that at this moment terminal is just exported in the result of generating routine;
The order input state, the user is just at input command in expression, from user's button input under the program output state, confirms or the cancellation input up to the user;
The interactive application state represents that this computer-chronograph is in the interactive application state of some full frame interactive programs of operation;
The command cue state, expression is in the assist command input state of order completion at present.
CNB2006100872439A 2006-06-14 2006-06-14 Method and apparatus for identifying terminal command line Active CN100452706C (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CNB2006100872439A CN100452706C (en) 2006-06-14 2006-06-14 Method and apparatus for identifying terminal command line
HK07105875.2A HK1098612A1 (en) 2006-06-14 2007-06-04 A method and apparatus for identifying a command line of a terminal
PCT/CN2007/001872 WO2007147339A1 (en) 2006-06-14 2007-06-14 Method and device for identifying terminal command line

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100872439A CN100452706C (en) 2006-06-14 2006-06-14 Method and apparatus for identifying terminal command line

Publications (2)

Publication Number Publication Date
CN1889442A true CN1889442A (en) 2007-01-03
CN100452706C CN100452706C (en) 2009-01-14

Family

ID=37578703

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100872439A Active CN100452706C (en) 2006-06-14 2006-06-14 Method and apparatus for identifying terminal command line

Country Status (3)

Country Link
CN (1) CN100452706C (en)
HK (1) HK1098612A1 (en)
WO (1) WO2007147339A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571774A (en) * 2011-12-27 2012-07-11 浙江省电力公司 Character operating command identification method and device
CN103258021A (en) * 2013-05-03 2013-08-21 杭州安恒信息技术有限公司 Character terminal feature data extraction method based on behavioral analysis
CN103744701A (en) * 2014-01-06 2014-04-23 浪潮电子信息产业股份有限公司 Method for system for complementing and installing smart commands under Linux
CN103841115B (en) * 2014-03-21 2017-02-08 成都安恒信息技术有限公司 Character terminal command real-time approval method and application layer structure
US11200078B1 (en) 2020-11-06 2021-12-14 International Business Machines Corporation Facilitating use of an unfamiliar command line tool via a familiar command line tool

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4791566A (en) * 1987-03-27 1988-12-13 Digital Equipment Corporation Terminal device session management protocol
US5933621A (en) * 1997-03-25 1999-08-03 Lam Research Corporation Method and Apparatus for terminal emulation in a semiconductor fabricating facility
KR100338604B1 (en) * 2000-05-29 2002-05-27 배영주 remote network management system via serial port
CN1141659C (en) * 2001-12-04 2004-03-10 上海复旦光华信息科技股份有限公司 Remote user operation process recording and restoring method
CN1256663C (en) * 2003-03-28 2006-05-17 烽火通信科技股份有限公司 Management method possessing real time helping function in insertion type system
CN1556636A (en) * 2004-01-02 2004-12-22 南京金鹰国际集团软件系统有限公司 Character terminal monitoring system
CN1674504A (en) * 2004-03-24 2005-09-28 威达电股份有限公司 Long-distance terminal machine emulation system and method
CN1960273A (en) * 2005-11-01 2007-05-09 杭州帕拉迪网络科技有限公司 Method for dynamic real time capturing logic commands input from UNIX terminal user

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571774A (en) * 2011-12-27 2012-07-11 浙江省电力公司 Character operating command identification method and device
CN102571774B (en) * 2011-12-27 2015-10-21 浙江省电力公司 A kind of character operating command identification method and device
CN103258021A (en) * 2013-05-03 2013-08-21 杭州安恒信息技术有限公司 Character terminal feature data extraction method based on behavioral analysis
CN103258021B (en) * 2013-05-03 2016-02-03 杭州安恒信息技术有限公司 The character terminal characteristic extracting method that a kind of Behavior-based control is analyzed
CN103744701A (en) * 2014-01-06 2014-04-23 浪潮电子信息产业股份有限公司 Method for system for complementing and installing smart commands under Linux
CN103744701B (en) * 2014-01-06 2017-06-30 浪潮电子信息产业股份有限公司 A kind of order completion intelligent under linux and the method for installation system
CN103841115B (en) * 2014-03-21 2017-02-08 成都安恒信息技术有限公司 Character terminal command real-time approval method and application layer structure
US11200078B1 (en) 2020-11-06 2021-12-14 International Business Machines Corporation Facilitating use of an unfamiliar command line tool via a familiar command line tool

Also Published As

Publication number Publication date
HK1098612A1 (en) 2007-07-20
WO2007147339A1 (en) 2007-12-27
CN100452706C (en) 2009-01-14

Similar Documents

Publication Publication Date Title
CN1530817A (en) Guide of effective content: execution of task and structural content
CN1666197A (en) Method and apparatus for moving focus for navigation in interactive mode
US20090037801A1 (en) Method and apparatus for automatic user manual generation
CN1889442A (en) Method and apparatus for identifying terminal command line
CN101069198A (en) Language conversion system and service method moving in combination with messenger
CN1851667A (en) Graphic user interface test method and system
TW201518933A (en) Testing device and testing method thereof
CN1896946A (en) Planning scheme of electronic device with multiple display screen parallel
CN100388690C (en) Automatic testing system and method for command of command line interface of data communication apparatus
CN101035090A (en) Instant communication method
CN101771894A (en) Testing system and method for recording track of remote controller and digital television receiving terminal
CN112612699A (en) General automatic test equipment for HID (high intensity discharge) human-computer interaction scene use case
CN1934533A (en) Display processing device and display processing method
CN1110737C (en) Method and device for transmitting key operation information and transmission-reception system
CN106358083A (en) Method and system for updating television application
CN1662055A (en) Apparatus and method for transmitting video data from mobile communication terminal
CN1371043A (en) Numeral operation system
CN1249611C (en) Image data editing deviceand method, and image data display method and device
US9904461B1 (en) Method and system for remote text selection using a touchscreen device
CN1136506C (en) Multi-media title playing apparatus
CN102546809A (en) Unified control method of large-scale server cluster
CN101222740A (en) Method, device and system for controlling and configuring equipment with multi-version under testing
CN105915975B (en) The asynchronous control system and method for LED screen content are updated with mobile device
CN114416533A (en) Artificial intelligence-based use case generation method and system for vehicle-mounted electronic product
CN109032907B (en) Data monitoring method and system for equipment application

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1098612

Country of ref document: HK

C14 Grant of patent or utility model
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1098612

Country of ref document: HK

C56 Change in the name or address of the patentee

Owner name: ZHEJIANG QIZHI SCIENCE + TECHNOLOGY CO., LTD.

Free format text: FORMER NAME: QIZHI INFORMATION SCIENCE + TECHNOLOGY CO., LTD., HANGZHOU

CP03 Change of name, title or address

Address after: 310012, room 19, building 1, 509 staff Road, Hangzhou, Zhejiang, Xihu District

Patentee after: Zhejiang Qi Technology Co., Ltd.

Address before: 310013 No. 453, Wensanlu Road, Zhejiang, Hangzhou

Patentee before: Qizhi Information Science & Technology Co., Ltd., Hangzhou

C56 Change in the name or address of the patentee
CP02 Change in the address of a patent holder

Address after: Hangzhou City, Zhejiang province 310051 Binjiang District West Street Binsheng Road No. 1505 Yinfeng building room 905

Patentee after: Zhejiang Qi Technology Co., Ltd.

Address before: 310012, room 19, building 1, 509 staff Road, Hangzhou, Zhejiang, Xihu District

Patentee before: Zhejiang Qi Technology Co., Ltd.

C56 Change in the name or address of the patentee
CP01 Change in the name or title of a patent holder

Address after: Hangzhou City, Zhejiang province 310051 Binjiang District West Street Binsheng Road No. 1505 Yinfeng building room 905

Patentee after: Zhejiang Qi Polytron Technologies Inc

Address before: Hangzhou City, Zhejiang province 310051 Binjiang District West Street Binsheng Road No. 1505 Yinfeng building room 905

Patentee before: Zhejiang Qi Technology Co., Ltd.