Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
The application's scheme is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the embodiment of the application's part, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
It should be noted that, term " first ", " second " etc. in the specification of the application and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged, in the appropriate case so that the embodiment of the application described herein.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
According to embodiments of the invention, provide a kind of simulation logon device method of website.The simulation logon device method of this website may operate on computer-processing equipment.
Fig. 1 is the flow chart of the simulation login method of website according to the embodiment of the present invention.As shown in Figure 1, the method comprises following step S102 to step S106:
Step S102, obtains trial website and simulates the request logged in.
It should be noted that, the history carrying website in above-mentioned request logs in record, history log in record can for logging in website by browser time server buffer to local record, such as, history log in record can be when logging in website by browser server buffer to local cookie.
Below for history log in be recorded as log in website by browser time server buffer elaborate the present invention to local cookie.
For any one website, as long as it is once by arbitrary browser, as IE browser, Google's browser etc. logged in, server will at its cookie of local cache; Certainly, if it is not by arbitrary browser, as IE browser, Google's browser etc. logged in, then server would not at its cookie of local cache, and now, the cookie of default website is empty.Server, when local cache is logged in the cookie of website, can arrange the term of validity (that is, life span) of cookie.The term of validity of cookie can carry out being set to random length according to the needs of user, and such as, 100 years, like this, from the moment that this cookie is buffered, in 100 years, it was all effective.
During enforcement, in order to log in targeted website (namely, the current website wanting to log in), client is while the request logged in is simulated in initiation trial website, can simulate in the request logged in current trial website by the cookie of copying and saving in this targeted website of this locality, log in the simulation of realize target website.
It should be noted that, such as, even if after the cookie of website is buffered, its simulation logs in logic neither be unalterable, can log in logic by the present day analog of amendment website, backstage.And once the present day analog of website logs in logic and is modified, buffer memory will lose efficacy to local cookie before, thus user cannot be logged in by the simulation to the cookie realize target website of this locality of buffer memory before again.
Step S104, judges whether request has asked successfully.
Step S106, if judge that request has been asked successfully, then logs in record simulation according to history and logs in website.
When implementing, can judge that whether request is normal, such as, effectively whether the cookie in request (comprising: whether cookie is empty, and also before the deadline whether, whether the simulation of website logs in logic and be modified cookie); If judge that request is normal, such as, the cookie in request effectively (comprising: cookie is not for empty, and cookie also before the deadline, the simulation of website logs in logic and is not modified), then log in website according to being buffered in local cookie simulation.
Pass through the embodiment of the present invention, log in because server buffer when logging in website by means of browser to the history of local website logs in the simulation that record carries out website, therefore without the need to asking one by one for different web sites, analyze and reappear various POST bag and various return datas etc., only need record the Cookie of website after by browser Website login, and the simulation that just can realize website in follow-up log on request by adding above-mentioned Cookie record logs in, the simulation that improve website logs in the applicability of the simulation login logic of efficiency and website, reach the effect that the simulation simplifying website logs in logic, achieve the automation that website simulation logs in.
Preferably, in embodiments of the present invention, after step S104 judges whether request has asked successfully, this simulation login method can also comprise:
S2, if judge that request asks failure, then logs in website by browser simulation.
When implementing, if judge that request is abnormal, such as, cookie in request be invalid (comprising: cookie for empty, cookie not before the deadline, namely, cookie is expired, and the simulation of website logs in logic and has been modified), then log in website by browser simulation.Like this, the simulation can expanding website logs in approach.
Further preferably, in embodiments of the present invention, S2 is logged in website can be comprised by browser simulation:
S4, starts at browser and when navigating to the login page of website, obtains logging on authentication; And
S6, logs in website according to logging on authentication simulation.
When implementing, can use third party control first start browser (as, IE browser and Google's browser etc.), and navigate to website (namely, targeted website) login page, obtain the logging on authentication of user's input again or obtain by the mode of searching the logging on authentication preserved in advance hereof that backstage inputs automatically, then, logging in website according to logging on authentication simulation.It should be noted that, after website simulation logs in successfully, can browser be closed.After simulation login failure, then can repeat aforesaid operations step, and upgrade corresponding Cookie.
Wherein, when obtaining logging on authentication, preferably, the logging on authentication of user's input can be obtained.Because when the mode by searching obtains the logging on authentication preserved in advance hereof that backstage inputs automatically, logging in website although also can simulate, adopting and simulating the impact of debarkation net standing-meeting by network itself in this way.Such as, if network speed is too slow, then may when the logon web page of website not yet load complete, backstage just have input logging on authentication automatically, causes website logins failure or website logins mistake etc.
In addition, in embodiments of the present invention, the form of logging on authentication can be various, does not limit at this, and such as, it can be the user name of not encrypted and the password etc. of not encrypted.
Further preferably, in embodiments of the present invention, while S6 logs in website according to logging on authentication simulation, this simulation login method can also comprise:
S8, generates the current of website and logs in record; And
S10, by the current record buffer memory that logs in of website to local, the current record that logs in is for logging in record as the history of attempting the website of carrying in the request when the request logged in is simulated in website next time.
Also namely, after the Successful login of website, preserve the Cookie of current page to local, like this, when client initiates above-mentioned request again, directly can copy the local Cookie preserved in request, log in the simulation realizing website.
By the embodiment of the present invention, the simulation not only can expanding website logs in approach, but also can log in for the follow-up simulation of website the Cookie providing buffer memory.
Preferably, in previous embodiment of the present invention, judge whether request has asked successfully can comprise:
Whether normal S12, judge that the history of the website of carrying in asking logs in record;
S14, if it is normal to judge that the history of the website of carrying in request logs in record, then determines that request has been asked successfully; And
S16, if judge that the history of the website of carrying in request logs in recording exceptional, then determines that request asks failure.
Such as, when implementing, can judge whether effectively the cookie of the website of carrying in asking (comprising: whether cookie is empty, and whether before the deadline, the simulation of website logs in logic and whether has been modified cookie); If judge that the cookie of the website of carrying in asking effectively (comprising: cookie is not for empty, and before the deadline, the simulation of website logs in logic and is not modified cookie), then determine that request has been asked successfully; If judge the cookie of the website of carrying in asking invalid (comprising: cookie is for empty, and not before the deadline, that is, cookie is expired for cookie, and the simulation of website logs in logic and has been modified), then determine that request asks failure.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the flow chart of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
According to embodiments of the invention, provide a kind of simulation logon device of website.It should be noted that, the simulation logon device method of the website that the embodiment of the present invention provides can be performed by the simulation logon device of the website of the embodiment of the present invention, and the simulation logon device of the website of the embodiment of the present invention also may be used for the simulation login method of the website performing the embodiment of the present invention.
Fig. 2 is the schematic diagram of the simulation logon device of website according to the embodiment of the present invention.As shown in Figure 2, this device comprises: acquiring unit 10, judging unit 20 and the first simulation login unit 30.
Acquiring unit 10 is attempted website and simulate for obtaining the request logged in, and the history carrying website in request logs in record, and history logs in and to be recorded as when logging in website by browser server buffer to the record of this locality.
It should be noted that, the history carrying website in above-mentioned request logs in record, history log in record can for logging in website by browser time server buffer to local record, such as, history log in record can be when logging in website by browser server buffer to local cookie.
Below for history log in be recorded as log in website by browser time server buffer elaborate the present invention to local cookie.
For any one website, as long as it is once by arbitrary browser, as IE browser, Google's browser etc. logged in, server will at its cookie of local cache; Certainly, if it is not by arbitrary browser, as IE browser, Google's browser etc. logged in, then server would not at its cookie of local cache, and now, the cookie of default website is empty.Server, when local cache is logged in the cookie of website, can arrange the term of validity (that is, life span) of cookie.The term of validity of cookie can carry out being set to random length according to the needs of user, and such as, 100 years, like this, from the moment that this cookie is buffered, in 100 years, it was all effective.
During enforcement, in order to log in targeted website (namely, the current website wanting to log in), client is while the request logged in is simulated in initiation trial website, can simulate in the request logged in current trial website by the cookie of copying and saving in this targeted website of this locality, log in the simulation of realize target website.
It should be noted that, such as, even if after the cookie of website is buffered, its simulation logs in logic neither be unalterable, can log in logic by the present day analog of amendment website, backstage.And once the present day analog of website logs in logic and is modified, buffer memory will lose efficacy to local cookie before, thus user cannot be logged in by the simulation to the cookie realize target website of this locality of buffer memory before again.
Judging unit 20 is for judging whether request has asked successfully.
First simulation login unit 30, for when judging that request is asked successful, logging in record simulation according to history and logging in website.
When implementing, can judge that whether request is normal, such as, effectively whether the cookie in request (comprising: whether cookie is empty, and also before the deadline whether, whether the simulation of website logs in logic and be modified cookie); If judge that request is normal, such as, the cookie in request effectively (comprising: cookie is not for empty, and cookie also before the deadline, the simulation of website logs in logic and is not modified), then log in website according to being buffered in local cookie simulation.
Pass through the embodiment of the present invention, log in because server buffer when logging in website by means of browser to the history of local website logs in the simulation that record carries out website, therefore without the need to asking one by one for different web sites, analyze and reappear various POST bag and various return datas etc., only need record the Cookie of website after by browser Website login, and the simulation that just can realize website in follow-up log on request by adding above-mentioned Cookie record logs in, the simulation that improve website logs in the applicability of the simulation login logic of efficiency and website, reach the effect that the simulation simplifying website logs in logic, achieve the automation that website simulation logs in.
Preferably, in embodiments of the present invention, this simulation logon device can also comprise: the second simulation login unit.Second simulation login unit is used for after judging whether request asks successfully, when judging that request is asked failed, logs in website by browser simulation.
When implementing, if judge that request is abnormal, such as, cookie in request be invalid (comprising: cookie for empty, cookie not before the deadline, namely, cookie is expired, and the simulation of website logs in logic and has been modified), then log in website by browser simulation.Like this, the simulation can expanding website logs in approach.
Further preferably, in embodiments of the present invention, this second simulation login unit can comprise: acquisition module and simulation log-in module.Acquisition module is used for starting at browser and when navigating to the login page of described website, obtaining logging on authentication; And simulation log-in module is used for logging in website according to logging on authentication simulation.
When implementing, can use third party control first start browser (as, IE browser and Google's browser etc.), and navigate to website (namely, targeted website) login page, obtain the logging on authentication of user's input again or obtain by the mode of searching the logging on authentication preserved in advance hereof that backstage inputs automatically, then, logging in website according to logging on authentication simulation.It should be noted that, after website simulation logs in successfully, can browser be closed.After simulation login failure, then can repeat aforesaid operations step, and upgrade corresponding Cookie.
Wherein, when obtaining logging on authentication, preferably, the logging on authentication of user's input can be obtained.Because when the mode by searching obtains the logging on authentication preserved in advance hereof that backstage inputs automatically, logging in website although also can simulate, adopting and simulating the impact of debarkation net standing-meeting by network itself in this way.Such as, if network speed is too slow, then may when the logon web page of website not yet load complete, backstage just have input logging on authentication automatically, causes website logins failure or website logins mistake etc.
In addition, in embodiments of the present invention, the form of logging on authentication can be various, does not limit at this, and such as, it can be the user name of not encrypted and the password etc. of not encrypted.
Further preferably, in embodiments of the present invention, this simulation logon device can also comprise: generation unit and buffer unit.Generation unit is used for, while logging in website according to logging on authentication simulation, generating the current of website and logging in record; And buffer unit is used for by the current record buffer memory that logs in of website to local, the current record that logs in is for logging in record as the history of attempting the website of carrying in the request when the request logged in is simulated in website next time.
Also namely, after the Successful login of website, preserve the Cookie of current page to local, like this, when client initiates above-mentioned request again, directly can copy the local Cookie preserved in request, log in the simulation realizing website.
By the embodiment of the present invention, the simulation not only can expanding website logs in approach, but also can log in for the follow-up simulation of website the Cookie providing buffer memory.
Preferably, in previous embodiment of the present invention, aforesaid judging unit can comprise: judge module, the first determination module and the second determination module.Whether judge module is normal for judging that the history of the website of carrying in request logs in record; When the history of website that first determination module is used for carrying in judging to ask logs in and records normal, determine that request has been asked successfully; And second the determination module history of website that is used for carrying in judging to ask log in recording exceptional, then determine that request asks failure.
Such as, when implementing, can judge whether effectively the cookie of the website of carrying in asking (comprising: whether cookie is empty, and whether before the deadline, the simulation of website logs in logic and whether has been modified cookie); If judge that the cookie of the website of carrying in asking effectively (comprising: cookie is not for empty, and before the deadline, the simulation of website logs in logic and is not modified cookie), then determine that request has been asked successfully; If judge the cookie of the website of carrying in asking invalid (comprising: cookie is for empty, and not before the deadline, that is, cookie is expired for cookie, and the simulation of website logs in logic and has been modified), then determine that request asks failure.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.