The content of the invention
The technical problems to be solved by the invention are, there is provided a kind of auxiliary activities that software systems are realized using script
Method.
To solve above technical problem, the present invention provides a kind of auxiliary activities implementation method based on script, including step
Suddenly:
Server reads in the script file for the auxiliary activities for being used for realization software systems, wherein, the auxiliary activities is used for
The software systems are aided in carry out data processing;
The script file is compiled using script interpreter, obtains the corresponding assembly instruction of the script file;
When the server needs to call the script file, obtain parameter needed for the script file and be converted to two
Binary data block;
The corresponding binary data blocks of parameter needed for the script file are added into the corresponding compilation of the script file
Instruction, obtains executable object code, and the object code is locked;
The server performs the object code after locking, and obtains the binary data blocks returned after performing, and to described
The object code unlock of locking;
The server reads in the binary data blocks of the return, and therefrom parses after the object code performs
As a result;
The software systems are handled according to the result after the execution, so as to fulfill auxiliary activities.
Further, the software systems are handled according to the result after the execution, so as to fulfill auxiliary activities, it
After further include step:
When script file updates and forms new script file, the server directly reads in the new script file;
The server is compiled the new script file using script interpreter, obtains the new script file pair
The object code answered;
The corresponding object code of the new script file is locked, and former object code is updated to the new script file
Corresponding object code, afterwards unlocks the corresponding object code of the new script file;
When the software systems need to realize auxiliary activities, the corresponding object code of the new script file is performed.
Present invention also offers a kind of implementation method of the spam processing based on script, including step:
Anti-garbage mail system server reads in the foot for the spam processing business for being used for realization anti-garbage mail system
This document;
The script file is compiled using script interpreter, obtains the corresponding assembly instruction of the script file;
When the anti-garbage mail system server needs to call the script file, obtain needed for the script file
Parameter is simultaneously converted to binary data blocks;
The corresponding binary data blocks of parameter needed for the script file are added into the corresponding compilation of the script file
Instruction, obtains executable object code, and the object code is locked;
The anti-garbage mail system server performs the object code after locking, and obtains the binary number returned after performing
Unlocked according to block, and to the object code of the locking;
The anti-garbage mail system server reads in the binary data blocks of the return, and therefrom parses the mesh
The mail that mark code obtains after performing judges result and corresponding operation;
The anti-garbage mail system is judged according to the mail as a result, to being determined as the mail of spam according to described
Corresponding operation is handled.
Further, the anti-garbage mail system judges the postal as a result, to being determined as spam according to the mail
Part is handled according to the corresponding operation, further includes step afterwards:
When script file updates and forms new script file, described in the anti-garbage mail system server is directly read in
New script file;
The anti-garbage mail system server is compiled the new script file using script interpreter, obtains institute
State the corresponding object code of new script file;
The corresponding object code of the new script file is locked, and former object code is updated to the new script file
Corresponding object code, afterwards unlocks the corresponding object code of the new script file;
When the anti-garbage mail system needs to carry out spam processing, the corresponding mesh of the new script file is performed
Mark code.
Implement the present invention, have the advantages that:
1st, the auxiliary activities (such as spam processing) of software systems is realized using script, can be during program be run
Make dynamic as the case may be to adjust.Auxiliary activities is not cured and is realized in a program, but outer hang in script realizes have
High availability, reduces service downtime.
2 while support a variety of widely used scripts, and by server calls script and obtain script return
Manage result.
3rd, during program is run, script can be changed, as long as heavily loaded script after modification, you can new logic is applied, and
Service need not be restarted.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art obtained without creative efforts it is all its
His embodiment, belongs to the scope of protection of the invention.
Fig. 1 is the flow diagram for the auxiliary activities implementation method based on script that the embodiment of the present invention 1 provides, including step
Suddenly:
S101, server read in the script file for the auxiliary activities for being used for realization software systems.
Wherein, the auxiliary activities is used to aid in the software systems to carry out data processing, such as the login of software systems
The function script files such as verification are that the function to be realized according to auxiliary activities of programmer is write.The programming of the script file
Language is lua or perl, but does not limit both language.
S102, using script interpreter be compiled the script file, obtains the corresponding compilation of the script file
Instruction.
Specifically, step S102 specifically includes step:Syntax check is carried out to the script file using script interpreter,
For detecting whether the script file has syntax error;If the script file does not have syntax error, using the script
Interpreter is compiled the script file, obtains the corresponding assembly instruction of the script file.Wherein, script interpretation utensil
It can be built-in script interpreter that body, which is,.
S103, when the server needs to call the script file, obtain parameter needed for the script file and turn
It is changed to binary data blocks.
Specifically, step S103 includes:When the server needs to call the script file, the script text is obtained
Parameter needed for part and be binary data blocks according to the protocol conversion of script.
Wherein, auxiliary activities usually requires to be handled according to parameter, for example, it is necessary to obtain when spam is handled
The IP address of mail is as parameter, and for whether judging the IP address of mail in blacklist or white list, whether mail is black
List or white list etc..
S104, that the corresponding binary data blocks of parameter needed for the script file are added into the script file is corresponding
Assembly instruction, obtains executable object code, and the object code is locked.
Wherein, it is to avoid having reload instruction action during execution object code to be locked, and causes to conflict.Computer operation
System can provide locking calling interface.After have invoked locking operation, obtaining the thread of lock can work normally.And if due to other
Thread have been obtained for locking, it tries the thread of locking will block the sleep state into operating system, allow other thread
First continue to execute, until lock is released.
S105, the server perform the object code after locking, and obtain the binary data blocks returned after performing, and right
The object code unlock of the locking.
S106, the server read in the binary data blocks of the return, and therefrom parse the object code and hold
Result after row.
S107, the software systems are handled according to the result after the execution, so as to fulfill auxiliary activities.
Fig. 2 is the flow diagram for the auxiliary activities implementation method based on script that the embodiment of the present invention 2 provides, including step
Suddenly:
S201, server read in the script file for the auxiliary activities for being used for realization software systems.
Wherein, the auxiliary activities is used to aiding in the software systems to carry out data processing, script file be programmer by
Write according to the function that auxiliary activities to be realized.The programming language of the script file is lua or perl, but do not limit this two
Kind language.
S202, using script interpreter be compiled the script file, obtains the corresponding compilation of the script file
Instruction.
Specifically, step S202 specifically includes step:Syntax check is carried out to the script file using script interpreter,
For detecting whether the script file has syntax error;If the script file does not have syntax error, using the script
Interpreter is compiled the script file, obtains the corresponding assembly instruction of the script file.Wherein, script interpretation utensil
It can be built-in script interpreter that body, which is,.
S203, when the server needs to call the script file, obtain parameter needed for the script file and turn
It is changed to binary data blocks.
Specifically, step S203 includes:When the server needs to call the script file, the script text is obtained
Parameter needed for part and be binary data blocks according to the protocol conversion of script.
Wherein, auxiliary activities usually requires to be handled according to parameter, for example, it is necessary to obtain when spam is handled
The IP address of mail is as parameter, and for whether judging the IP address of mail in blacklist or white list, whether mail is black
List or white list etc..
S204, that the corresponding binary data blocks of parameter needed for the script file are added into the script file is corresponding
Assembly instruction, obtains executable object code, and the object code is locked.
Wherein, it is to avoid having reload instruction action during execution object code to be locked, and causes to conflict.Computer operation
System can provide locking calling interface.After have invoked locking operation, obtaining the thread of lock can work normally.And if due to other
Thread have been obtained for locking, it tries the thread of locking will block the sleep state into operating system, allow other thread
First continue to execute, until lock is released.
S205, the server perform the object code after locking, and obtain the binary data blocks returned after performing, and right
The object code unlock of the locking.
S206, the server read in the binary data blocks of the return, and therefrom parse the object code and hold
Result after row.
S207, the software systems are handled according to the result after the execution, so as to fulfill auxiliary activities.
S208, when script file updates and forms new script file, the server directly reads in new script text
Part;
S209, the server are compiled the new script file using script interpreter, obtain the new script
The corresponding object code of file;
S210, lock the corresponding object code of the new script file, and former object code is updated to the new foot
The corresponding object code of this document, afterwards unlocks the corresponding object code of the new script file;
S211, when the software systems need to realize auxiliary activities, perform the new script file corresponding target generation
Code.
Fig. 3 is the flow diagram of the implementation method for the processing of the spam based on script that the embodiment of the present invention 3 provides,
Including step:
S301, anti-garbage mail system server read in the spam processing business for being used for realization anti-garbage mail system
Script file.
Wherein, script file is that the function to be realized according to auxiliary activities of programmer is write.The script file
Programming language is lua or perl, but does not limit both language.
S302, using script interpreter be compiled the script file, obtains the corresponding compilation of the script file
Instruction.
Specifically, step S302 specifically includes step:Grammer inspection is carried out to the script file using script interpreter
Look into, for detecting whether the script file has syntax error;If the script file does not have syntax error, using the foot
This interpreter is compiled the script file, obtains the corresponding assembly instruction of the script file.Wherein, script interpreter
It specifically can be built-in script interpreter.
S303, when the anti-garbage mail system server needs to call the script file, obtain script text
Parameter needed for part is simultaneously converted to binary data blocks.
Specifically, step S303 includes:When the anti-garbage mail system server needs to call the script file,
Obtain parameter needed for the script file and be binary data blocks according to the protocol conversion of script.
Wherein, parameter needed for the script file is how some finally handle mail useful information (including but not
It is limited to the rule for whether having hit Administrator, mail is whether in the white list of user, and whether mail is in the address of user
In this, judgement of the anti-spam system algorithm to mail was as a result, whether receiver with addresser once had communication relations, addresser
In the amount of transmitting of the past period, domain name is transmitted in amount of transmitting of the past period etc.), these information can influence mail
Finally how to handle, it is possible that needing frequent modification preferably to balance filtering spam and to avoid erroneous judgement normal
Mail.
S304, that the corresponding binary data blocks of parameter needed for the script file are added into the script file is corresponding
Assembly instruction, obtains executable object code, and the object code is locked.
Wherein, it is to avoid having reload instruction action during execution object code to be locked, and causes to conflict.Computer operation
System can provide locking calling interface.After have invoked locking operation, obtaining the thread of lock can work normally.And if due to other
Thread have been obtained for locking, it tries the thread of locking will block the sleep state into operating system, allow other thread
First continue to execute, until lock is released.
S305, the anti-garbage mail system server perform the object code after locking, and obtain two returned after performing
Binary data block, and the object code of the locking is unlocked.
S306, the anti-garbage mail system server read in the binary data blocks of the return, and therefrom parse
The mail that the object code obtains after performing judges result and corresponding operation.
S307, the anti-garbage mail system judged according to the mail as a result, to be determined as the mail of spam by
Handled according to the corresponding operation.
Wherein, mail judge result be specifically return be mail whether spam, it is corresponding operation be to mail such as
Where reason operating result (include but not limited to bounce, abandon, be saved in Junk E-Mail folder, be saved in promotional literature folder,
Specified mailbox is forwarded to, specified mailbox is forwarded to and abandons former mail).
Fig. 4 is the flow diagram of the implementation method for the processing of the spam based on script that the embodiment of the present invention 4 provides,
Including step:
S401, anti-garbage mail system server read in the spam processing business for being used for realization anti-garbage mail system
Script file.
Wherein, script file is that the function to be realized according to auxiliary activities of programmer is write.The script file
Programming language is lua or perl, but does not limit both language.
S402, using script interpreter be compiled the script file, obtains the corresponding compilation of the script file
Instruct
Specifically, step S402 specifically includes step:Syntax check is carried out to the script file using script interpreter,
For detecting whether the script file has syntax error;If the script file does not have syntax error, using the script
Interpreter is compiled the script file, obtains the corresponding assembly instruction of the script file.Wherein, script interpretation utensil
It can be built-in script interpreter that body, which is,.
S403, when the anti-garbage mail system server needs to call the script file, obtain script text
Parameter needed for part is simultaneously converted to binary data blocks.
Specifically, step S403 includes:When the anti-garbage mail system server needs to call the script file,
Obtain parameter needed for the script file and be binary data blocks according to the protocol conversion of script.
Wherein, parameter needed for the script file is how some finally handle mail useful information (including but not
It is limited to the rule for whether having hit Administrator, mail is whether in the white list of user, and whether mail is in the address of user
In this, judgement of the anti-spam system algorithm to mail was as a result, whether receiver with addresser once had communication relations, addresser
In the amount of transmitting of the past period, domain name is transmitted in amount of transmitting of the past period etc.), these information can influence mail
Finally how to handle, it is possible that needing frequent modification preferably to balance filtering spam and to avoid erroneous judgement normal
Mail.
S404, be added into the script file by the corresponding binary data blocks of parameter needed for the script file and correspond to
Assembly instruction, obtain executable object code, and the object code is locked.
Wherein, it is to avoid having reload instruction action during execution object code to be locked, and causes to conflict.Computer operation
System can provide locking calling interface.After have invoked locking operation, obtaining the thread of lock can work normally.And if due to other
Thread have been obtained for locking, it tries the thread of locking will block the sleep state into operating system, allow other thread
First continue to execute, until lock is released.
S405, the anti-garbage mail system server perform the object code after locking, and obtain two returned after performing
Binary data block, and the object code of the locking is unlocked.
S406, the anti-garbage mail system server read in the binary data blocks of the return, and therefrom parse
The mail that the object code obtains after performing judges result and corresponding operation.
S407, the anti-garbage mail system judged according to the mail as a result, to be determined as the mail of spam by
Handled according to the corresponding operation.
Wherein, mail judge result be specifically return be mail whether spam, it is corresponding operation be to mail such as
Where reason operating result (include but not limited to bounce, abandon, be saved in Junk E-Mail folder, be saved in promotional literature folder,
Specified mailbox is forwarded to, specified mailbox is forwarded to and abandons former mail).
S408, when script file updates and forms new script file, the anti-garbage mail system server is directly read
Enter the new script file.
S409, the anti-garbage mail system server are compiled the new script file using script interpreter,
Obtain the corresponding object code of the new script file.
S410, lock the corresponding object code of the new script file, and former object code is updated to the new foot
The corresponding object code of this document, afterwards unlocks the corresponding object code of the new script file.
S411, when the anti-garbage mail system need carry out spam processing when, perform the new script file pair
The object code answered.
Implement the present invention, have the advantages that:
1st, the auxiliary activities (such as spam processing) of software systems is realized using script, can be during program be run
Make dynamic as the case may be to adjust.Auxiliary activities is not cured and is realized in a program, but outer hang in script realizes have
High availability, reduces service downtime.
2 while support a variety of widely used scripts, and by server calls script and obtain script return
Manage result.
3rd, during program is run, script can be changed, as long as heavily loaded script after modification, you can new logic is applied, and
Service need not be restarted.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property includes, so that process, method, article or device including a series of elements not only include those key elements, and
And other elements that are not explicitly listed are further included, or further include as this process, method, article or device institute inherently
Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this
Also there are other identical element in the process of key element, method, article or device.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Professional further appreciates that, with reference to each exemplary unit of the embodiments described herein description
And algorithm steps, can be realized with electronic hardware, computer software or the combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software, generally describes each exemplary composition and step according to function in the above description.These
Function is performed with hardware or software mode actually, application-specific and design constraint depending on technical solution.Specialty
Technical staff can realize described function to each specific application using distinct methods, but this realization should not
Think beyond the scope of this invention.
Can directly it be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processor
Capable software module, or the two combination are implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology
In any other form of storage medium well known in field.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or use the present invention.
A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention
The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase
Consistent most wide scope.