CN111679862A - Cloud host shutdown method and device, electronic equipment and medium - Google Patents

Cloud host shutdown method and device, electronic equipment and medium Download PDF

Info

Publication number
CN111679862A
CN111679862A CN202010444274.5A CN202010444274A CN111679862A CN 111679862 A CN111679862 A CN 111679862A CN 202010444274 A CN202010444274 A CN 202010444274A CN 111679862 A CN111679862 A CN 111679862A
Authority
CN
China
Prior art keywords
cloud host
shutdown
cloud
login
request
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.)
Pending
Application number
CN202010444274.5A
Other languages
Chinese (zh)
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202010444274.5A priority Critical patent/CN111679862A/en
Publication of CN111679862A publication Critical patent/CN111679862A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/442Shutdown
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser

Abstract

The invention relates to a cloud security technology, is applied to the field of intelligent security and protection, and provides a cloud host shutdown method, which comprises the following steps: when a shutdown request is received, a request number and a website are extracted from the shutdown request, a target browser corresponding to the shutdown request is started, the website is started on the target browser, a login page is obtained, a user name and an input password of the login page are obtained, an account corresponding to the user name is logged in the login page based on the user name and the input password, when the login success of the account is detected, a cloud host list corresponding to the request number is read, cloud host names are obtained, shutdown commands are sequentially sent to cloud hosts corresponding to the cloud host names, and the shutdown efficiency of the cloud hosts is improved by performing full-automatic shutdown on the cloud hosts in the cloud host list. The invention also relates to a block chain technology, and the cloud host list is stored in the block chain.

Description

Cloud host shutdown method and device, electronic equipment and medium
Technical Field
The invention relates to the technical field of cloud security, in particular to a cloud host shutdown method, a cloud host shutdown device, electronic equipment and a medium.
Background
In order to effectively manage computer resources of an enterprise, a cloud computer architecture based on a virtualization technology is added, the architecture can provide distributed computers with independent virtual machines for a plurality of users, devices such as computers and mobile phones are connected to the distributed computers as clients, all computer resources provided on the cloud computer architecture can be shared, however, when a cloud host on the cloud computer architecture is attacked by malicious codes or viruses, the devices on the same cloud computer architecture also have a risk of being attacked by the malicious codes or viruses. In order to prevent the cloud host from being maliciously attacked and affecting hardware devices, the cloud host which can be accessed by an external network is generally powered off when the cloud host is not used at night, on weekends and the like.
At present, the shutdown of the cloud hosts is realized by configuring corresponding shutdown instructions or timing tasks on each cloud host, however, because the method needs to manually log in each cloud host to set the corresponding shutdown instructions or timing tasks for each cloud host, the efficiency is low when a plurality of cloud hosts are shutdown.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a cloud host shutdown method, apparatus, electronic device, and medium, which can improve the shutdown efficiency of the cloud host.
A cloud host shutdown method comprises the following steps:
when a shutdown request is received, extracting a request number and a website from the shutdown request;
starting a target browser corresponding to the shutdown request, and starting the website on the target browser to obtain a login page;
acquiring a user name and an input password of the login page;
logging in an account corresponding to the user name on the login page based on the user name and the input password;
when the account login is detected to be successful, reading a cloud host list corresponding to the request number to obtain a cloud host name;
and sequentially sending a shutdown command to the cloud host corresponding to the cloud host name.
According to a preferred embodiment of the present invention, the starting the target browser corresponding to the shutdown request includes:
determining a target browser according to the shutdown request, and acquiring an installation path of the target browser;
acquiring a driving file of the target browser based on the installation path;
and operating the drive file by adopting an opening command in the Selenium Webdriver technology.
According to a preferred embodiment of the present invention, said starting the website on the target browser to obtain a login page includes:
searching a page corresponding to the website when the target browser is detected to input the website;
and when a page corresponding to the website is searched, confirming the searched page as the login page, and opening the login page by using a get () command in the Selenium Webdriver technology.
According to the preferred embodiment of the present invention, the acquiring the user name and the input password of the login page includes:
acquiring all running logs of the target browser within preset time;
extracting a target log of the login page from all the running logs;
and analyzing the target log by using a JSON technology to obtain the user name and the input password.
According to a preferred embodiment of the present invention, the cloud host shutdown method further includes:
acquiring a matching password matched with the user name;
verifying whether the input password is consistent with the matching password;
if the matching password is inconsistent with the input password, determining that the account login fails; or
If the matched password is consistent with the input password, all characters of the current page are obtained based on an optical character recognition technology, whether any character is consistent with a configuration button exists in all the characters is detected, and when any character is detected to be consistent with the configuration button, the account login is determined to be successful; or
And when all the characters are detected to be inconsistent with the configuration button, determining that the account login fails.
According to a preferred embodiment of the present invention, the sequentially sending the shutdown command to the cloud host corresponding to the cloud host name includes:
sequentially inputting the cloud host name into a space corresponding to a configuration button;
when the blank space is detected to contain any cloud host name, calling a click command to click the configuration button;
when the configuration button is detected to be clicked, a shutdown command is obtained, and the shutdown command is sent to the cloud host corresponding to any cloud host name.
According to a preferred embodiment of the present invention, the cloud host list is stored in a block chain, and the invoking a click command to click the configuration button includes:
generating an xpath expression of the configuration button, and generating a target object according to the xpath expression;
acquiring a click command, and adding the target object to the click command to obtain a target script;
clicking the configuration button by executing the target script.
A cloud host shutdown apparatus, the apparatus comprising:
the device comprises an extraction unit, a storage unit and a control unit, wherein the extraction unit is used for extracting a request number and a website from a shutdown request when the shutdown request is received;
the starting unit is used for starting a target browser corresponding to the shutdown request and starting the website on the target browser to obtain a login page;
the acquisition unit is used for acquiring a user name and an input password of the login page;
the login unit is used for logging in an account corresponding to the user name on the login page based on the user name and the input password;
the reading unit is used for reading the cloud host list corresponding to the request number to obtain the name of the cloud host when the account login success is detected;
and the sending unit is used for sending a shutdown command to the cloud host corresponding to the cloud host name in sequence.
According to a preferred embodiment of the present invention, the starting up, by the starting unit, the target browser corresponding to the shutdown request includes:
determining a target browser according to the shutdown request, and acquiring an installation path of the target browser;
acquiring a driving file of the target browser based on the installation path;
and operating the drive file by adopting an opening command in the Selenium Webdriver technology.
According to a preferred embodiment of the present invention, the starting unit starts the website on the target browser, and obtaining a login page includes:
searching a page corresponding to the website when the target browser is detected to input the website;
and when a page corresponding to the website is searched, confirming the searched page as the login page, and opening the login page by using a get () command in the Selenium Webdriver technology.
According to a preferred embodiment of the present invention, the acquiring unit acquires the user name and the input password of the login page includes:
acquiring all running logs of the target browser within preset time;
extracting a target log of the login page from all the running logs;
and analyzing the target log by using a JSON technology to obtain the user name and the input password.
According to the preferred embodiment of the present invention, the obtaining unit is further configured to obtain a matching password matching the user name;
the device further comprises:
the verification unit is used for verifying whether the input password is consistent with the matching password;
the determining unit is used for determining that the account login fails if the matching password is inconsistent with the input password; or
The determining unit is further configured to, if the matching password is consistent with the input password, obtain all characters of a current page based on an optical character recognition technology, detect whether any character exists in all the characters and is consistent with a configuration button, and determine that the account login is successful when any character is detected to be consistent with the configuration button; or
The determining unit is further configured to determine that the account login fails when all the characters are detected to be inconsistent with the configuration button.
According to a preferred embodiment of the present invention, the sending unit sequentially sending the shutdown command to the cloud host corresponding to the cloud host name includes:
sequentially inputting the cloud host name into a space corresponding to a configuration button;
when the blank space is detected to contain any cloud host name, calling a click command to click the configuration button;
when the configuration button is detected to be clicked, a shutdown command is obtained, and the shutdown command is sent to the cloud host corresponding to any cloud host name.
According to a preferred embodiment of the present invention, the cloud host list is stored in a block chain, and the sending unit invoking a click command to click the configuration button includes:
generating an xpath expression of the configuration button, and generating a target object according to the xpath expression;
acquiring a click command, and adding the target object to the click command to obtain a target script;
clicking the configuration button by executing the target script.
An electronic device, the electronic device comprising:
a memory storing at least one instruction; and
and the processor is used for acquiring the instructions stored in the memory to realize the cloud host shutdown method.
A computer-readable storage medium having at least one instruction stored therein, the at least one instruction being fetched by a processor in an electronic device to implement the cloud host power-off method.
According to the technical scheme, the cloud host in the cloud host list is automatically shut down, so that the shutdown efficiency of the cloud host is improved.
Drawings
Fig. 1 is a flowchart of a cloud host shutdown method according to a preferred embodiment of the present invention.
Fig. 2 is a functional block diagram of a cloud host shutdown apparatus according to a preferred embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a flowchart illustrating a cloud host shutdown method according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
This scheme belongs to wisdom security protection field, can promote the construction in wisdom city through this scheme. The cloud host shutdown method is applied to one or more electronic devices, where the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and hardware of the electronic devices includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The electronic device may also include a network device and/or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a cloud computing (cloud computing) based cloud consisting of a large number of hosts or network servers.
The Network where the electronic device is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, when a shutdown request is received, extracting a request number and a website from the shutdown request.
In at least one embodiment of the present invention, the shutdown request may be triggered by a user, or may be automatically triggered when a certain condition is met, which is not limited by the present invention.
Wherein the satisfying of certain conditions includes, but is not limited to: meeting the preset time, etc.
The preset time may include a certain time point, or include a time period, etc., such as: the preset time may be seven am each day.
Further, the information carried in the shutdown request includes, but is not limited to: the request number, the web address, etc.
In at least one embodiment of the present invention, the extracting, by the electronic device, the request number and the website address from the shutdown request includes:
the electronic equipment acquires a first label and a second label, further extracts first information corresponding to the first label from all information carried by the shutdown request as the request number, and extracts second information corresponding to the second label as the website.
The first tag and the second tag are predefined tags, such as address.
The request number can be accurately determined through the mapping relation between the first label and the request number, and the website can be accurately determined through the mapping relation between the second label and the website.
And S11, starting a target browser corresponding to the shutdown request, and starting the website on the target browser to obtain a login page.
In at least one embodiment of the present invention, the target browser refers to a preset browser suitable for the shutdown request.
Further, the target browser may be a chrome browser or a firefox browser.
In at least one embodiment of the present invention, the login page refers to a page entered by logging in the website.
In at least one embodiment of the present invention, the starting, by the electronic device, a target browser corresponding to the shutdown request includes:
the electronic equipment determines a target browser according to the shutdown request and acquires an installation path of the target browser, acquires a drive file of the target browser based on the installation path, and runs the drive file by adopting a starting command in a Selenium Webdriver technology.
The Selenium Webdriver technology has a strong visual automatic interaction function, and simulates the interaction between a person and a webpage through a program, so that the dynamic data loading is triggered, and the dynamically generated data is acquired.
Furthermore, the Selenium WebDriver technology can truly simulate the operation performed by the user on the webpage, such as simulating the operations of clicking "automatic login", "clicking link", "scrolling mouse", "dragging with mouse", "scrolling down after page loading is completed", "clicking page turning", "saving screenshot", and the like. And when the functions of automatic login, mouse dragging, downward scrolling after page loading is finished and the like are clicked.
Furthermore, the Selenium WebDriver technology can request more data from the server in real time by using the Ajax technology, and then dynamically generate content by using the JavaScript script and load and display the content.
By the implementation mode, the target browser can be accurately and quickly started, and the cloud host can quickly receive the shutdown command by starting the target browser with good network performance, so that the shutdown efficiency of the cloud host can be improved.
In at least one embodiment of the present invention, the electronic device starts the website on the target browser, and obtaining the login page includes:
when the target browser is detected to input the website, the electronic equipment searches a page corresponding to the website, when the page corresponding to the website is searched, the electronic equipment confirms the searched page as the login page, and utilizes a get () command in a Selenium Webdriver technology to open the login page.
For example: the electronic equipment can open a page corresponding to the XXX website through a program language driver.get ("http:// www.XXX"), can simulate clicking a return button through the program language elem.send _ keys (keys.return), and can close a browser drive through the program language driver.close ().
And S12, acquiring the user name and the input password of the login page.
In at least one embodiment of the present invention, the obtaining, by the electronic device, the user name and the input password of the login page includes:
and the electronic equipment acquires all running logs of the target browser within preset time. Furthermore, the electronic device extracts a target log of the login page from all the running logs, and the electronic device analyzes the target log by using a JSON (JSON Object Notation) technology to obtain the user name and the input password.
The preset time may be a time period or a time point, and the specific value of the preset time is not limited in the present invention.
Further, the JSON technology is a lightweight data exchange format. The JSON technology stores and represents data in a text format completely independent of the programming language, is easy to read and write, and is also easy to machine parse and generate.
By the embodiment, the user name and the password can be quickly and accurately obtained by analyzing the target log through the JSON technology.
And S13, logging in an account corresponding to the user name on the login page based on the user name and the input password.
In at least one embodiment of the present invention, the logging in, by the electronic device, an account corresponding to the user name on the login page based on the user name and the input password includes:
and the electronic equipment determines a coordinate value corresponding to the first characteristic on the login page as a first coordinate and determines a coordinate value corresponding to the second characteristic on the login page as a second coordinate, and further, the electronic equipment inputs the user name into the first coordinate and inputs the input password into the second coordinate to obtain a login script and runs the login script.
The first characteristic and the second characteristic refer to preset marks on the login page.
Through the embodiment, automatic login can be realized without manually inputting a user name and a password by a user, and the login efficiency is improved.
In at least one embodiment of the invention, the method further comprises:
the electronic device obtains a matching password matched with the user name, further verifies whether the input password is consistent with the matching password, if the matching password is inconsistent with the input password, the electronic device determines that account login fails, or if the matching password is consistent with the input password, the electronic device obtains all characters of a current page based on an OCR (Optical Character Recognition) technology and detects whether any Character exists in all the characters and is consistent with a configuration button, when any Character is detected to be consistent with the configuration button, the electronic device determines that account login succeeds, or when all the characters are detected to be inconsistent with the configuration button, the electronic device determines that account login fails.
Through verifying the account number, the loss caused by the fact that other people maliciously shut down the cloud host can be avoided, and the safety is improved.
And S14, when the account login is detected to be successful, reading the cloud host list corresponding to the request number to obtain the name of the cloud host.
It is emphasized that, to further ensure the privacy and security of the cloud host list, the cloud host list may also be stored in a node of a block chain.
In at least one embodiment of the present invention, a plurality of cloud host names are stored in the cloud host list.
In at least one embodiment of the invention, the shutdown command is sent to the cloud host corresponding to the read cloud host name, and the shutdown command or the timing task command does not need to be written on each cloud host, so that the time for writing the command on each cloud host is saved, and the shutdown efficiency of the cloud host is improved.
And S15, sequentially sending a shutdown command to the cloud host corresponding to the cloud host name.
In at least one embodiment of the present invention, the sending, by the electronic device, the shutdown command to the cloud host corresponding to the cloud host name in sequence includes:
the electronic equipment sequentially inputs the cloud host names into the spaces corresponding to the configuration buttons, when the fact that any cloud host name is contained in the spaces is detected, the electronic equipment calls a click command to click the configuration buttons, when the fact that the configuration buttons are clicked is detected, the electronic equipment obtains a shutdown command, and sends the shutdown command to the cloud host corresponding to any cloud host name.
The configuration button may be a button existing in an interface entered after the account login is successful.
And sending a shutdown command to the cloud hosts in the cloud host list through the account number so as to realize shutdown of the plurality of cloud hosts.
In at least one embodiment of the invention, said invoking a click command to click on said configuration button comprises:
and the electronic equipment generates an xpath expression of the configuration button and generates a target object according to the xpath expression, and further acquires a click command, adds the target object to the click command to obtain a target script and clicks the configuration button by executing the target script.
In at least one embodiment of the invention, the method further comprises:
when detecting that a cloud host in the cloud host list does not complete shutdown, the electronic device determines the cloud host not complete shutdown as a target cloud host, further, the electronic device acquires error reporting information on the target cloud host, and determining a target policy from a configuration library according to the error reporting information, the electronic device processing the target cloud host with the target policy, when detecting that the error message is not successfully processed, the electronic device generates a reminding message based on the request number and the target cloud host, and further, the electronic equipment encrypts the reminding information by adopting a symmetric encryption technology to obtain encrypted information, determines the request level of the shutdown request, and determining a reminding mode of the encrypted information according to the request level, and sending the reminding information by the electronic equipment in the reminding mode.
Wherein the request level includes, but is not limited to: level a, level B, etc.
Accordingly, the reminding manner includes, but is not limited to: telephone, mail, etc.
Whether the cloud host in the cloud host list is shut down or not is detected, the reminding information can be sent in time to remind relevant contacts when any cloud host does not finish the shut down, meanwhile, the reminding information is encrypted by adopting a symmetric encryption technology, the safety of the reminding information can be guaranteed, the encryption of the reminding information can be quickly finished, and in addition, the encryption information can be sent to the terminal equipment of the relevant contacts in a proper mode by determining the request level of the shut down request.
According to the technical scheme, before the shutdown instruction is sent to the plurality of cloud hosts, the cloud hosts needing to be shut down are configured in the cloud host list, the shutdown instruction or the timing task instruction does not need to be compiled on each cloud host, the time for compiling the instruction on each cloud host is saved, when the shutdown instruction is sent to the plurality of cloud hosts, the cloud hosts can quickly receive the shutdown instruction by starting the target browser with good network performance, and then the shutdown instruction is sent to the cloud hosts in the cloud host list through the account number, so that the cloud hosts in the cloud host list are automatically shut down, and the shutdown efficiency of the cloud hosts is improved.
Fig. 2 is a functional block diagram of a cloud host shutdown device according to a preferred embodiment of the present invention. The cloud host shutdown device 11 includes an extraction unit 110, a startup unit 111, an acquisition unit 112, a login unit 113, a reading unit 114, a sending unit 115, a verification unit 116, a determination unit 117, a processing unit 118, and a generation unit 119. The module/unit referred to in the present invention refers to a series of computer program segments that can be fetched by the processor 13 and that can perform a fixed function, and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
When a shutdown request is received, the extracting unit 110 extracts a request number and a website address from the shutdown request.
In at least one embodiment of the present invention, the shutdown request may be triggered by a user, or may be automatically triggered when a certain condition is met, which is not limited by the present invention.
Wherein the satisfying of certain conditions includes, but is not limited to: meeting the preset time, etc.
The preset time may include a certain time point, or include a time period, etc., such as: the preset time may be seven am each day.
Further, the information carried in the shutdown request includes, but is not limited to: the request number, the web address, etc.
In at least one embodiment of the present invention, the extracting unit 110 extracts the request number and the website address from the shutdown request includes:
the extracting unit 110 obtains a first tag and a second tag, and further, the extracting unit 110 extracts first information corresponding to the first tag from all information carried in the shutdown request as the request number, and extracts second information corresponding to the second tag as the website.
The first tag and the second tag are predefined tags, such as address.
The request number can be accurately determined through the mapping relation between the first label and the request number, and the website can be accurately determined through the mapping relation between the second label and the website.
The starting unit 111 starts a target browser corresponding to the shutdown request, and starts the website on the target browser to obtain a login page.
In at least one embodiment of the present invention, the target browser refers to a preset browser suitable for the shutdown request.
Further, the target browser may be a chrome browser or a firefox browser.
In at least one embodiment of the present invention, the login page refers to a page entered by logging in the website.
In at least one embodiment of the present invention, the starting up, by the starting unit 111, the target browser corresponding to the shutdown request includes:
the starting unit 111 determines a target browser according to the shutdown request, the starting unit 111 obtains an installation path of the target browser, the starting unit 111 obtains a drive file of the target browser based on the installation path, and the starting unit 111 runs the drive file by using an opening command in a Selenium WebDriver technology.
The Selenium Webdriver technology has a strong visual automatic interaction function, and simulates the interaction between a person and a webpage through a program, so that the dynamic data loading is triggered, and the dynamically generated data is acquired.
Furthermore, the Selenium WebDriver technology can truly simulate the operation performed by the user on the webpage, such as simulating the operations of clicking "automatic login", "clicking link", "scrolling mouse", "dragging with mouse", "scrolling down after page loading is completed", "clicking page turning", "saving screenshot", and the like. And when the functions of automatic login, mouse dragging, downward scrolling after page loading is finished and the like are clicked.
Furthermore, the Selenium WebDriver technology can request more data from the server in real time by using the Ajax technology, and then dynamically generate content by using the JavaScript script and load and display the content.
By the implementation mode, the target browser can be accurately and quickly started, and the cloud host can quickly receive the shutdown command by starting the target browser with good network performance, so that the shutdown efficiency of the cloud host can be improved.
In at least one embodiment of the present invention, the starting unit 111 starts the website on the target browser, and obtaining the login page includes:
when the target browser is detected to input the website, the starting unit 111 searches for a page corresponding to the website, and when the page corresponding to the website is searched, the starting unit 111 determines the searched page as the login page, and opens the login page by using a get () command in the Selenium WebDriver technology.
For example: the launch unit 111 may open a page corresponding to the XXX website through a program language driver.get ("http:// www.XXX"), may simulate clicking a return button through a program language elem.send _ keys (keys.return), may close a browser driver through a program language driver.close (), and so on.
The obtaining unit 112 obtains the user name and the input password of the login page.
In at least one embodiment of the present invention, the acquiring unit 112 acquires the user name and the input password of the login page includes:
the obtaining unit 112 obtains all the operation logs of the target browser within a preset time. Further, the obtaining unit 112 extracts a target log of the login page from all the running logs, and the obtaining unit 112 analyzes the target log by using a JSON (JavaScript Object Notation) technique to obtain the user name and the input password.
The preset time may be a time period or a time point, and the specific value of the preset time is not limited in the present invention.
Further, the JSON technology is a lightweight data exchange format. The JSON technology stores and represents data in a text format completely independent of the programming language, is easy to read and write, and is also easy to machine parse and generate.
By the embodiment, the user name and the password can be quickly and accurately obtained by analyzing the target log through the JSON technology.
The login unit 113 logs in an account corresponding to the user name on the login page based on the user name and the input password.
In at least one embodiment of the present invention, the logging-in unit 113, based on the user name and the input password, logging in an account corresponding to the user name on the login page includes:
the login unit 113 determines a coordinate value corresponding to a first feature on the login page as a first coordinate, and determines a coordinate value corresponding to a second feature on the login page as a second coordinate, further, the login unit 113 enters the first coordinate of the user name and the second coordinate of the input password to obtain a login script, and further, the login unit 113 runs the login script.
The first characteristic and the second characteristic refer to preset marks on the login page.
Through the embodiment, automatic login can be realized without manually inputting a user name and a password by a user, and the login efficiency is improved.
In at least one embodiment of the present invention, the obtaining unit 112 obtains a matching password matching the user name, further, the verifying unit 116 verifies whether the input password is consistent with the matching password, if the matching password is not consistent with the input password, the determining unit 117 determines that the account login is failed, or if the matching password is consistent with the input password, the determining unit 117 acquires all characters of the current page based on an OCR (Optical Character Recognition) technique, and detects whether any Character of the all characters is consistent with the configuration button, when any character is detected to coincide with the configuration button, the determination unit 117 determines that the account login is successful, or when all the characters are detected to be inconsistent with the configuration button, the determining unit 117 determines that the account login fails.
Through verifying the account number, the loss caused by the fact that other people maliciously shut down the cloud host can be avoided, and the safety is improved.
When detecting that the account login is successful, the reading unit 114 reads the cloud host list corresponding to the request number to obtain the cloud host name.
It is emphasized that, to further ensure the privacy and security of the cloud host list, the cloud host list may also be stored in a node of a block chain.
In at least one embodiment of the present invention, a plurality of cloud host names are stored in the cloud host list.
In at least one embodiment of the invention, the shutdown command is sent to the cloud host corresponding to the read cloud host name, and the shutdown command or the timing task command does not need to be written on each cloud host, so that the time for writing the command on each cloud host is saved, and the shutdown efficiency of the cloud host is improved.
The sending unit 115 sequentially sends a shutdown command to the cloud hosts corresponding to the cloud host names.
In at least one embodiment of the present invention, the sending unit 115 sequentially sending the shutdown command to the cloud host corresponding to the cloud host name includes:
the sending unit 115 sequentially inputs the cloud host names into spaces corresponding to configuration buttons, when the fact that the spaces contain any cloud host name is detected, the sending unit 115 calls a click command to click the configuration buttons, when the fact that the configuration buttons are clicked is detected, the sending unit 115 obtains a shutdown command, and further the sending unit 115 sends the shutdown command to cloud hosts corresponding to any cloud host name.
The configuration button may be a button existing in an interface entered after the account login is successful.
And sending a shutdown command to the cloud hosts in the cloud host list through the account number so as to realize shutdown of the plurality of cloud hosts.
In at least one embodiment of the present invention, the sending unit 115 invoking a click command to click the configuration button comprises:
the sending unit 115 generates an xpath expression of the configuration button, and generates a target object according to the xpath expression, further, the sending unit 115 obtains a click command, further, the sending unit 115 adds the target object to the click command to obtain a target script, and further, the sending unit 115 clicks the configuration button by executing the target script.
In at least one embodiment of the present invention, when it is detected that there is a cloud host in the cloud host list that has not completed shutdown, the determining unit 117 determines the cloud host that has not completed shutdown as a target cloud host, further, the obtaining unit 112 obtains error information on the target cloud host, and determines a target policy from a configuration library according to the error information, the processing unit 118 processes the target cloud host with the target policy, when it is detected that the error information has not been successfully processed, the generating unit 119 generates a reminding information based on the request number and the target cloud host, further, the determining unit 117 encrypts the reminding information by using a symmetric encryption technique to obtain encrypted information, and determines a request level of the shutdown request, and the determining unit 117 determines a reminding manner of the encrypted information according to the request level, the sending unit 115 sends the reminding information in the reminding manner.
Wherein the request level includes, but is not limited to: level a, level B, etc.
Accordingly, the reminding manner includes, but is not limited to: telephone, mail, etc.
Whether the cloud host in the cloud host list is shut down or not is detected, the reminding information can be sent in time to remind relevant contacts when any cloud host does not finish the shut down, meanwhile, the reminding information is encrypted by adopting a symmetric encryption technology, the safety of the reminding information can be guaranteed, the encryption of the reminding information can be quickly finished, and in addition, the encryption information can be sent to the terminal equipment of the relevant contacts in a proper mode by determining the request level of the shut down request.
According to the technical scheme, before the shutdown instruction is sent to the plurality of cloud hosts, the cloud hosts needing to be shut down are configured in the cloud host list, the shutdown instruction or the timing task instruction does not need to be compiled on each cloud host, the time for compiling the instruction on each cloud host is saved, when the shutdown instruction is sent to the plurality of cloud hosts, the cloud hosts can quickly receive the shutdown instruction by starting the target browser with good network performance, and then the shutdown instruction is sent to the cloud hosts in the cloud host list through the account number, so that the cloud hosts in the cloud host list are automatically shut down, and the shutdown efficiency of the cloud hosts is improved.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention, which implements a cloud host shutdown method.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and a computer program, such as a cloud host shutdown program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by using various interfaces and lines, and acquires an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 obtains an operating system of the electronic device 1 and various installed application programs. The processor 13 obtains the application program to implement the steps in the foregoing embodiments of the cloud host shutdown method, such as the steps shown in fig. 1.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 12 and retrieved by the processor 13 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the acquisition process of the computer program in the electronic device 1. For example, the computer program may be divided into an extraction unit 110, a start unit 111, an acquisition unit 112, a login unit 113, a reading unit 114, a transmission unit 115, an authentication unit 116, a determination unit 117, a processing unit 118, and a generation unit 119.
The memory 12 can be used for storing the computer programs and/or modules, and the processor 13 can implement various functions of the electronic device 1 by running or acquiring the computer programs and/or modules stored in the memory 12 and calling data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 12 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow in the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium and used for instructing related hardware to implement the steps of the above-described embodiments of the method when the computer program is acquired by a processor.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an available file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
Further, the computer-readable medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
Referring to fig. 1, the memory 12 in the electronic device 1 stores a plurality of instructions to implement a cloud host shutdown method, and the processor 13 may obtain the plurality of instructions to implement: when a shutdown request is received, extracting a request number and a website from the shutdown request; starting a target browser corresponding to the shutdown request, and starting the website on the target browser to obtain a login page; acquiring a user name and an input password of the login page; logging in an account corresponding to the user name on the login page based on the user name and the input password; when the account login is detected to be successful, reading a cloud host list corresponding to the request number to obtain a cloud host name; and sequentially sending a shutdown command to the cloud host corresponding to the cloud host name.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the instruction, which is not described herein again.
It is emphasized that, to further ensure the privacy and security of the cloud host list, the cloud host list may also be stored in a node of a block chain.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A cloud host shutdown method is characterized by comprising the following steps:
when a shutdown request is received, extracting a request number and a website from the shutdown request;
starting a target browser corresponding to the shutdown request, and starting the website on the target browser to obtain a login page;
acquiring a user name and an input password of the login page;
logging in an account corresponding to the user name on the login page based on the user name and the input password;
when the account login is detected to be successful, reading a cloud host list corresponding to the request number to obtain a cloud host name;
and sequentially sending a shutdown command to the cloud host corresponding to the cloud host name.
2. The cloud host power-off method of claim 1, wherein the launching of the target browser corresponding to the power-off request comprises:
determining a target browser according to the shutdown request, and acquiring an installation path of the target browser;
acquiring a driving file of the target browser based on the installation path;
and operating the drive file by adopting an opening command in the Selenium Webdriver technology.
3. The cloud host power-off method of claim 1, wherein said launching the web address on the target browser to obtain a login page comprises:
searching a page corresponding to the website when the target browser is detected to input the website;
and when a page corresponding to the website is searched, confirming the searched page as the login page, and opening the login page by using a get () command in the Selenium Webdriver technology.
4. The cloud host shutdown method of claim 1, wherein the obtaining the username and the input password for the login page comprises:
acquiring all running logs of the target browser within preset time;
extracting a target log of the login page from all the running logs;
and analyzing the target log by using a JSON technology to obtain the user name and the input password.
5. The cloud host power-off method of claim 1, wherein the cloud host power-off method further comprises:
acquiring a matching password matched with the user name;
verifying whether the input password is consistent with the matching password;
if the matching password is inconsistent with the input password, determining that the account login fails; or
If the matched password is consistent with the input password, all characters of the current page are obtained based on an optical character recognition technology, whether any character is consistent with a configuration button exists in all the characters is detected, and when any character is detected to be consistent with the configuration button, the account login is determined to be successful; or
And when all the characters are detected to be inconsistent with the configuration button, determining that the account login fails.
6. The cloud host power-off method according to claim 1, wherein the sequentially sending the power-off commands to the cloud hosts corresponding to the cloud host names includes:
sequentially inputting the cloud host name into a space corresponding to a configuration button;
when the blank space is detected to contain any cloud host name, calling a click command to click the configuration button;
when the configuration button is detected to be clicked, a shutdown command is obtained, and the shutdown command is sent to the cloud host corresponding to any cloud host name.
7. The cloud host power-off method of claim 6, wherein the cloud host list is stored in a blockchain, and the invoking a click command to click on the configuration button comprises:
generating an xpath expression of the configuration button, and generating a target object according to the xpath expression;
acquiring a click command, and adding the target object to the click command to obtain a target script;
clicking the configuration button by executing the target script.
8. A cloud host power-off device, comprising:
the device comprises an extraction unit, a storage unit and a control unit, wherein the extraction unit is used for extracting a request number and a website from a shutdown request when the shutdown request is received;
the starting unit is used for starting a target browser corresponding to the shutdown request and starting the website on the target browser to obtain a login page;
the acquisition unit is used for acquiring a user name and an input password of the login page;
the login unit is used for logging in an account corresponding to the user name on the login page based on the user name and the input password;
the reading unit is used for reading the cloud host list corresponding to the request number to obtain the name of the cloud host when the account login success is detected;
and the sending unit is used for sending a shutdown command to the cloud host corresponding to the cloud host name in sequence.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing at least one instruction; and
a processor that retrieves instructions stored in the memory to implement the cloud host shutdown method of any of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium stores at least one instruction, and the at least one instruction is acquired by a processor in an electronic device to implement the cloud host shutdown method according to any one of claims 1 to 7.
CN202010444274.5A 2020-05-22 2020-05-22 Cloud host shutdown method and device, electronic equipment and medium Pending CN111679862A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010444274.5A CN111679862A (en) 2020-05-22 2020-05-22 Cloud host shutdown method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010444274.5A CN111679862A (en) 2020-05-22 2020-05-22 Cloud host shutdown method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN111679862A true CN111679862A (en) 2020-09-18

Family

ID=72453289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010444274.5A Pending CN111679862A (en) 2020-05-22 2020-05-22 Cloud host shutdown method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN111679862A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4325361A1 (en) * 2022-08-17 2024-02-21 ThoughtSpot, Inc. Identifying cluster idleness for cluster shutdown

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140337953A1 (en) * 2013-05-08 2014-11-13 International Business Machines Corporation Cross-platform authentication from within a rich client
CN105306225A (en) * 2015-11-03 2016-02-03 国云科技股份有限公司 Openstack-based physical machine remote shutdown method
CN108848155A (en) * 2018-06-08 2018-11-20 郑州云海信息技术有限公司 A kind of method and apparatus for the function controlling physical machine
CN110826035A (en) * 2019-10-08 2020-02-21 云深互联(北京)科技有限公司 Method, device and system for rapidly logging in browser and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140337953A1 (en) * 2013-05-08 2014-11-13 International Business Machines Corporation Cross-platform authentication from within a rich client
CN105306225A (en) * 2015-11-03 2016-02-03 国云科技股份有限公司 Openstack-based physical machine remote shutdown method
CN108848155A (en) * 2018-06-08 2018-11-20 郑州云海信息技术有限公司 A kind of method and apparatus for the function controlling physical machine
CN110826035A (en) * 2019-10-08 2020-02-21 云深互联(北京)科技有限公司 Method, device and system for rapidly logging in browser and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
何增颖等: "基于Winsock网络通信的远程关机技术", 信息通信, no. 05, pages 62 - 64 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4325361A1 (en) * 2022-08-17 2024-02-21 ThoughtSpot, Inc. Identifying cluster idleness for cluster shutdown

Similar Documents

Publication Publication Date Title
US11687645B2 (en) Security control method and computer system
CN111427803B (en) Automated random test method, apparatus, computer device and medium
EP3343870A1 (en) System and method for detecting phishing web pages field of technology
JP2009134404A (en) Entry auxiliary apparatus, entry auxiliary system, entry auxiliary method, and entry auxiliary program
CN111125598A (en) Intelligent data query method, device, equipment and storage medium
CN111797351A (en) Page data management method and device, electronic equipment and medium
CN112053143B (en) Fund routing method, apparatus, electronic device and storage medium
WO2022073508A1 (en) Method and device for voice information entry, electronic device, and storage medium
US20220245208A1 (en) Method for switching skin of mini-program page, and electronic device
CN110837635A (en) Method, device, equipment and storage medium for equipment verification
CN114418398A (en) Scene task development method, device, equipment and storage medium
CN114281707A (en) Number making method, service application testing method and related equipment thereof
CN114356747A (en) Display content testing method, device, equipment, storage medium and program product
CN113946854A (en) File access control method and device and computer readable storage medium
CN111679862A (en) Cloud host shutdown method and device, electronic equipment and medium
CN111783119A (en) Form data security control method and device, electronic equipment and storage medium
CN112134968A (en) Domain name access method and device, electronic equipment and storage medium
CN111953647A (en) Security verification method and device, electronic equipment and storage medium
CN114003421B (en) Virtual machine timeout mechanism testing method, system, terminal and storage medium
CN114626352B (en) Report automatic generation method, device, computer equipment and storage medium
CN112817816B (en) Embedded point processing method and device, computer equipment and storage medium
CN112181482B (en) Version verification method and device, electronic equipment and storage medium
CN111786991B (en) Block chain-based platform authentication login method and related device
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN113704796A (en) Electronic signature method, device, equipment and storage medium

Legal Events

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