CN111343294A - Network environment switching method, device, equipment and computer readable storage medium - Google Patents

Network environment switching method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN111343294A
CN111343294A CN202010093533.4A CN202010093533A CN111343294A CN 111343294 A CN111343294 A CN 111343294A CN 202010093533 A CN202010093533 A CN 202010093533A CN 111343294 A CN111343294 A CN 111343294A
Authority
CN
China
Prior art keywords
interface
internet protocol
network environment
protocol address
calling 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
CN202010093533.4A
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.)
JD Digital Technology Holdings Co Ltd
Original Assignee
JD Digital Technology Holdings 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN202010093533.4A priority Critical patent/CN111343294A/en
Publication of CN111343294A publication Critical patent/CN111343294A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5053Lease time; Renewal aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a network environment switching method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: acquiring an interface calling request received by at least one preset calling interface and a uniform resource locator corresponding to the interface calling request; acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses under a plurality of network environments; replacing the internet protocol address in the uniform resource locator with a target internet protocol address to obtain a target interface calling request; and accessing the target internet protocol address according to the target interface calling request. Therefore, root or jail crossing operation is not needed to be carried out on the handheld terminal device, the safety of the handheld terminal device is effectively guaranteed, and the method can be used for modifying the hosts file in real time, so that the modification efficiency is high.

Description

Network environment switching method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for switching network environments.
Background
In the development process of computer network interfaces, testing, development and other operations are often required to be performed in different network environments, for example, common network environments may include a testing environment, a pre-development environment, an online environment and the like. Because the same website has different IP addresses in different network environments, the stored Hosts file needs to be switched when the network environment is switched. The Hosts is a system file without an extension name, can be opened by a notebook and other tools, and has the functions of establishing a correlation 'database' between a plurality of commonly used website domain names and IP addresses corresponding to the commonly used website domain names, when a user inputs a website needing to be logged in a browser, the system can firstly automatically search the corresponding IP address from the Hosts file, and once the website is found, the system can point to different IP addresses when the webpage is opened.
When a computer is used for interface development and other operations, only a preset third-party tool is needed to switch Hosts. However, in the process of implementing the present invention, the inventor finds that when a handheld terminal device, such as a mobile phone, is used to perform a research and development test operation on a network interface, due to the privacy authority problem of the handheld terminal device, such as a mobile phone, it is not possible to directly perform a Hosts switching operation by using a third-party tool. Specifically, when the handheld terminal device is an android system, root operation needs to be performed on the handheld terminal device to obtain a higher operation permission; when the handheld terminal device is an apple system, the handheld terminal device needs to be subjected to jail-breaking operation to obtain higher operation authority. The modification of the system file Hosts in the handheld terminal device can only be done after root or jail crossing.
However, when the Hosts are modified by the method, root or jail crossing brings more security problems to the handheld terminal device, for example, personal information of the user is leaked. In addition, root or jail crossing also needs to spend more time, so that the Hosts switching operation efficiency is lower, and the process is more complicated.
Disclosure of Invention
The embodiment of the invention provides a network environment switching method, a network environment switching device, network environment switching equipment and a computer readable storage medium, which are used for solving the technical problem that the existing network environment switching method can bring more safety problems to handheld terminal equipment.
A first aspect of an embodiment of the present invention provides a network environment switching method, including:
acquiring an interface calling request received by at least one preset calling interface and a uniform resource locator corresponding to the interface calling request;
acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses under a plurality of network environments;
replacing the internet protocol address in the uniform resource locator with the target internet protocol address to obtain a target interface calling request;
and accessing the target Internet protocol address according to the target interface calling request.
A second aspect of an embodiment of the present invention is to provide a network environment switching apparatus, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an interface calling request received by at least one preset calling interface and a uniform resource locator corresponding to the interface calling request;
the processing module is used for acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses under a plurality of network environments;
the replacing module is used for replacing the internet protocol address in the uniform resource locator with the target internet protocol address to obtain a target interface calling request;
and the access module is used for accessing the target Internet protocol address according to the target interface calling request.
A third aspect of an embodiment of the present invention is to provide a network environment switching apparatus, including: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the network environment switching method of the first aspect by the processor.
A fourth aspect of the embodiments of the present invention is to provide a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-readable storage medium is configured to implement the network environment switching method according to the first aspect.
The network environment switching method, the device, the equipment and the computer readable storage medium provided by the embodiment of the invention can directly realize the interface calling operation under the network environment switching by intercepting and acquiring the interface calling request received by at least one calling interface and switching the internet protocol address in the interface calling request according to the preset corresponding relation dictionary. The corresponding relation dictionary is obtained according to analysis of the obtained hosts file and comprises a corresponding relation between the domain name and the internet protocol address in at least one network environment. Therefore, root or jail crossing operation is not needed to be carried out on the handheld terminal device, the safety of the handheld terminal device is effectively guaranteed, and besides, the method can be used for modifying the hosts file in real time, so that the modification efficiency is high.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a schematic diagram of a network architecture on which an embodiment of the present invention is based;
fig. 2 is a flowchart illustrating a network environment switching method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a display interface provided in an embodiment of the invention;
fig. 4 is a flowchart illustrating a network environment switching method according to a second embodiment of the present invention;
FIG. 5 is a schematic diagram of a display interface provided in an embodiment of the invention;
fig. 6 is a schematic structural diagram of a network environment switching apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of a network environment switching device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other examples obtained based on the examples in the present invention are within the scope of the present invention.
Aiming at the above-mentioned basic problem that the root or jail crossing operation is required to be performed on the handheld terminal device to obtain higher operation authority in the existing network environment switching method, but the basic problem that the potential safety hazard is often brought to the handheld terminal device is often solved, the embodiment of the invention provides a network environment switching method, a network environment switching device, network environment switching equipment and a computer readable storage medium.
In order to avoid root or jail crossing operation on the handheld terminal device, it may be considered that a corresponding relation dictionary including a corresponding relation between a domain name and an internet protocol address in each network environment to be switched is established according to each network environment to be switched, so that after an interface call request is received subsequently, a corresponding internet protocol address may be directly queried in the corresponding relation dictionary, and switching of the network environment is realized.
It should be noted that the network environment switching method, device, apparatus, and computer-readable storage medium provided in the present application may be applied to any scenario that needs to switch a host file.
Fig. 1 is a schematic diagram of a system architecture based on an embodiment of the present invention, and as shown in fig. 1, the system architecture based on the embodiment of the present invention at least includes: a hand-held terminal device 1 and a network environment switching device 2. Wherein, the network environment switching device 2 is written by C/C + +, Java, Shell or Python languages and the like; the handheld terminal device 1 may be, for example, a mobile phone brain, a tablet computer, or the like. The hand-held terminal equipment 1 is in communication connection with the network environment switching device 2, so that information interaction can be realized.
Fig. 2 is a schematic flowchart of a network environment switching method according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
step 101, obtaining an interface calling request received by at least one preset calling interface, and a uniform resource locator corresponding to the interface calling request.
The execution main body of the embodiment is a network environment switching device, the network environment switching device can be specifically installed in the handheld terminal device, and also can be a device which is independently arranged with the handheld terminal device, and the network environment switching device is in communication connection with the handheld terminal device, so that the Hosts can be modified on the basis of ensuring the safety of the handheld terminal device. In the process of developing a computer network interface, operations such as testing, development and the like are often required to be performed in different network environments. For example, in the process of developing the APP, the APP needs to be developed in an intranet environment, tested in a test environment, and pre-developed, and then can be online in an online environment for the user to use. Under different network environments, the internet protocol addresses corresponding to the same website are different. Therefore, in a scenario that a network environment needs to be switched, first, at least one calling interface may be monitored to obtain all interface calling requests received by the at least one calling interface. The interface calling requests are analyzed and processed, and uniform resource locators corresponding to the interface calling requests can be obtained.
It should be noted that, when a computer is used to perform operations such as interface development, only a preset third-party tool needs to be used to switch Hosts. When a handheld terminal device, such as a mobile phone, is used for performing a research and development test operation on a network interface, a third-party tool cannot be directly used for performing a Hosts switching operation due to the privacy authority problem of the handheld terminal device, such as the mobile phone. Moreover, based on the security of the handheld terminal device, the system files Hosts in the handheld terminal device cannot be modified by root or jail. Therefore, in order to modify Hosts on the basis of ensuring the security of the handheld terminal device, an interface call request received by at least one preset call interface may be obtained first.
And 102, acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses in a plurality of network environments.
In this embodiment, for each interface call request, the target internet protocol address corresponding to the interface call request can be determined according to the uniform resource locator corresponding to the interface call request. Specifically, the target network environment to which the interface call request needs to access, and the internet protocol address may be determined according to the uniform resource locator. Therefore, the target internet protocol address corresponding to the interface calling request can be obtained in the preset corresponding relation dictionary according to the uniform resource locator. The corresponding relation dictionary is obtained according to analysis of the obtained hosts file and comprises a corresponding relation between the domain name and the internet protocol address in at least one network environment.
And 103, replacing the internet protocol address in the uniform resource locator with the target internet protocol address to obtain a target interface calling request.
And 104, accessing the target Internet protocol address according to the target interface calling request.
Further, after the target internet protocol address corresponding to the interface call request is obtained, the internet protocol address in the interface call request may be replaced with the target internet protocol address. And then, the target internet protocol address can be accessed directly according to the target interface calling request, and the switching of the network environment is realized.
In the network environment switching method provided by this embodiment, an interface call request received by at least one call interface is obtained by intercepting, and an internet protocol address in the interface call request is switched according to a preset corresponding relation dictionary, so that an interface call operation under network environment switching can be directly implemented. The corresponding relation dictionary is obtained according to analysis of the obtained hosts file and comprises a corresponding relation between the domain name and the internet protocol address in at least one network environment. Therefore, root or jail crossing operation is not needed to be carried out on the handheld terminal device, the safety of the handheld terminal device is effectively guaranteed, and besides, the method can be used for modifying the hosts file in real time, so that the modification efficiency is high.
Further, on the basis of any of the above embodiments, the step 101 specifically includes:
and acquiring an interface calling request received by at least one preset calling interface through a preset NSURLProtocol tool.
In this embodiment, the obtaining of all interface call requests received by at least one call interface may be specifically realized by intercepting the interface call requests. Specifically, the acquisition of intercepting all interface call requests can be realized through an NSURLProtocol protocol, a private method brownsingContextController and a private method register SchemeForCustomPolosol.
Correspondingly, after all interface call requests received by at least one call interface are acquired, each interface call request needs to be analyzed, and a uniform resource locator corresponding to the interface call request is determined, specifically, on the basis of any of the above embodiments, step 101 specifically includes:
acquiring an interface calling request received by at least one preset calling interface;
and acquiring the uniform resource locator corresponding to each interface calling Request through the Request object.
In this embodiment, after all interface call requests received by at least one preset call interface are acquired, the acquisition of the uniform resource locator corresponding to each interface call Request may be implemented through a Request object.
Further, on the basis of any of the above embodiments, the step 101 specifically includes:
determining a network environment to be accessed corresponding to the interface calling request according to the uniform resource locator;
and when detecting that the state corresponding to the network environment to be accessed is an open state, acquiring a target internet protocol address corresponding to the interface calling request in a corresponding relation dictionary corresponding to the network environment to be accessed.
In this embodiment, after the uniform resource locator corresponding to the interface call request is obtained, the network environment to be accessed corresponding to the interface call request may be determined according to the uniform resource locator. After determining the network environment to be accessed, first, a state corresponding to the network environment to be accessed may be determined, where the state includes an open state and a closed state. Fig. 3 is a schematic view of a display interface provided in an embodiment of the present invention, and as shown in fig. 3, a state switching icon corresponding to a network environment to be accessed is arranged on the display interface, and a user can switch the state of the network environment to be accessed by triggering the state switching icon. Correspondingly, when it is detected that the state corresponding to the network environment to be accessed is the open state, the target internet protocol address corresponding to the interface calling request can be acquired from the corresponding relation dictionary corresponding to the network environment to be accessed.
In the network environment switching method provided by this embodiment, the to-be-accessed network environment corresponding to the interface call request is determined through the uniform resource locator, and then the target internet protocol address corresponding to the interface call request is obtained from the corresponding relation dictionary corresponding to the to-be-accessed network environment, so that the target internet protocol address can be accurately obtained, and the accuracy of network environment switching is improved.
Fig. 4 is a schematic flow chart of a network environment switching method according to a second embodiment of the present invention, where on the basis of any of the foregoing embodiments, the method further includes:
step 201, obtaining information of a file to be processed corresponding to at least one network environment, wherein the information of the file to be processed includes an identifier of the file to be processed, a character string in the file to be processed, and a switch state corresponding to the file to be processed;
step 202, when the switch state corresponding to the file to be processed is on, analyzing the character string, and determining a domain name corresponding to the network environment and an internet protocol address corresponding to the domain name;
step 203, storing the internet protocol address corresponding to the domain name as a value by using the domain name as a keyword, and obtaining the corresponding relation dictionary.
In this embodiment, in order to obtain the target internet protocol address from the correspondence dictionary, the correspondence dictionary needs to be established first. Specifically, to-be-processed file information corresponding to at least one network environment may be obtained, where the to-be-processed file information includes an identifier of the to-be-processed file, a character string in the to-be-processed file, and a switch state corresponding to the to-be-processed file. It should be noted that the information of the file to be processed corresponding to the at least one network environment may be input by a user through a terminal device, and optionally, the information of the file to be processed corresponding to the at least one network environment may also be acquired from a database by a network environment switching device, where the database stores information of the file to be processed corresponding to a plurality of different network environments in advance; optionally, it may also be output by the upper level system. Based on the above manner of acquiring the information of the files to be processed, the network environment switching device may acquire the information of the files to be processed corresponding to the specific network environment according to the current requirement, or may acquire and store the information of the files to be processed corresponding to all the network environments at one time, which is not limited in the present invention. After the information of the file to be processed is obtained, the identifier of the file to be processed can be used as a keyword according to a preset character string rule, and the character string in the file to be processed is used as a value to be stored. And if the on-off state corresponding to the file to be processed is detected to be on, analyzing the character string corresponding to the file to be processed, and determining the domain name corresponding to the network environment and the Internet protocol address corresponding to the domain name. And storing the Internet protocol address corresponding to the domain name as a value by taking the domain name as a keyword to obtain a corresponding relation dictionary. And repeatedly executing the steps aiming at the information of the file to be processed corresponding to each network environment to obtain a corresponding relation dictionary corresponding to at least one network environment.
Further, on the basis of any of the above embodiments, step 201 specifically includes:
and acquiring to-be-processed file information corresponding to at least one network environment input by a user through scanning preset identification code information or manual input or copying.
In this embodiment, the input of the information of the file to be processed corresponding to at least one network environment may be specifically realized by scanning the preset identification code information or by manual input or copying. The preset identification code information is generated according to the file to be processed, the identification code may be a two-dimensional code, a bar code, or the like, and the generation processing of the identification code may be realized by any identification code generation method, which is not limited in the embodiment of the present invention.
According to the network environment switching method provided by the embodiment, the corresponding relation dictionary is generated according to the to-be-processed file information corresponding to at least one network environment input by the user, so that the corresponding target internet protocol address can be directly obtained from the corresponding relation dictionary subsequently, the operations of root or jail crossing and the like on the handheld terminal device are not needed, and the safety of the handheld mobile terminal is ensured.
Fig. 5 is a schematic view of a display interface provided in an embodiment of the present invention, where on the basis of any one of the above embodiments, as shown in fig. 5, a scan icon is arranged on the display interface, and the method further includes:
acquiring a trigger instruction of the user to the scanning icon;
and scanning preset identification code information according to the trigger instruction to obtain the information of the file to be processed, wherein the identification code information is generated according to the information of the file to be processed.
In this embodiment, as shown in fig. 5, a scanning icon may be arranged on the display interface, and a user may obtain information of a file to be processed by triggering the scanning icon, where the user may trigger the scanning icon by any one of a single click, a double click, a long press, and the like, which is not limited in this embodiment of the present invention. After a trigger instruction of a user for scanning the icon is acquired, scanning operation can be performed on preset identification code information according to the trigger instruction, and information of the file to be processed is acquired, wherein the identification code information is generated according to the information of the file to be processed.
According to the network environment switching method provided by the embodiment, the preset identification code information is scanned according to the trigger instruction of the user for the scanning icon, so that the information of the files to be processed is obtained, the information of the files to be processed can be rapidly obtained, and the change efficiency of the hosts files is improved.
Fig. 6 is a schematic structural diagram of a network environment switching apparatus according to a third embodiment of the present invention, as shown in fig. 6, the apparatus includes: the system comprises an acquisition module 31, a processing module 32, a replacement module 33 and an access module 34, wherein the acquisition module 31 is configured to acquire an interface call request received by at least one preset call interface and a uniform resource locator corresponding to the interface call request; a processing module 32, configured to obtain, according to the uniform resource locator, a target internet protocol address corresponding to the interface call request from a preset correspondence dictionary, where the correspondence dictionary includes correspondence between domain names and internet protocol addresses in multiple network environments; a replacing module 33, configured to replace the internet protocol address in the uniform resource locator with the target internet protocol address, to obtain a target interface call request; and the access module 34 is configured to access the target internet protocol address according to the target interface call request.
The network environment switching device provided in this embodiment intercepts and obtains an interface call request received by at least one call interface, and switches an internet protocol address in the interface call request according to a preset corresponding relation dictionary, thereby directly implementing an interface call operation under network environment switching. The corresponding relation dictionary is obtained according to analysis of the obtained hosts file and comprises a corresponding relation between the domain name and the internet protocol address in at least one network environment. Therefore, root or jail crossing operation is not needed to be carried out on the handheld terminal device, the safety of the handheld terminal device is effectively guaranteed, and besides, the method can be used for modifying the hosts file in real time, so that the modification efficiency is high.
Further, on the basis of any one of the above embodiments, the apparatus further includes:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring information of a file to be processed corresponding to at least one network environment, and the information of the file to be processed comprises an identifier of the file to be processed, a character string in the file to be processed and a switch state corresponding to the file to be processed;
the analysis module is used for analyzing the character string when the switch state corresponding to the file to be processed is on, and determining a domain name corresponding to the network environment and an internet protocol address corresponding to the domain name;
and the storage module is used for storing the Internet protocol address corresponding to the domain name as a value by taking the domain name as a keyword to obtain the corresponding relation dictionary.
It should be noted that the information of the file to be processed corresponding to the at least one network environment may be input by the user through the terminal device; optionally, the information of the file to be processed corresponding to a plurality of different network environments may also be obtained from a database by the network environment switching device; optionally, it may also be output by the upper level system. Based on the above manner of acquiring the information of the files to be processed, the network environment switching device may acquire the information of the files to be processed corresponding to the specific network environment according to the current requirement, or may acquire and store the information of the files to be processed corresponding to all the network environments at one time, which is not limited in the present invention.
Further, on the basis of any of the above embodiments, the obtaining module is specifically configured to:
and acquiring to-be-processed file information corresponding to at least one network environment input by a user through scanning preset identification code information or manual input or copying.
Further, on the basis of any of the above embodiments, a scanning icon is arranged on the display interface; the device further comprises:
the acquisition module is used for acquiring a trigger instruction of the user to the scanning icon;
and the scanning module is used for scanning preset identification code information according to the trigger instruction to obtain the information of the file to be processed, and the identification code information is generated according to the information of the file to be processed.
Further, on the basis of any of the above embodiments, the obtaining module is specifically configured to:
and acquiring an interface calling request received by at least one preset calling interface through a preset NSURL Protocol tool.
Further, on the basis of any of the above embodiments, the obtaining module is specifically configured to:
acquiring an interface calling request received by at least one preset calling interface;
and acquiring the uniform resource locator corresponding to each interface calling Request through the Request object.
Further, on the basis of any of the above embodiments, the processing module is specifically configured to:
determining a network environment to be accessed corresponding to the interface calling request according to the uniform resource locator;
and when detecting that the state corresponding to the network environment to be accessed is an open state, acquiring a target internet protocol address corresponding to the interface calling request in a corresponding relation dictionary corresponding to the network environment to be accessed.
Fig. 7 is a schematic structural diagram of a network environment switching device according to a fourth embodiment of the present invention, as shown in fig. 7, including: a memory 41, a processor 42;
a memory 41; a memory 41 for storing instructions executable by the processor 42;
wherein the processor 42 is configured to execute the network environment switching method according to any of the above embodiments by the processor 42.
The method comprises the following steps: a memory 41 and a processor 42.
And a memory 41 for storing a program. In particular, the program may include program code comprising computer operating instructions. The memory 41 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 42 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present invention.
Alternatively, in a specific implementation, if the memory 41 and the processor 42 are implemented independently, the memory 41 and the processor 42 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (enhanced Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
Alternatively, in a specific implementation, if the memory 41 and the processor 42 are integrated on a chip, the memory 41 and the processor 42 may perform the same communication through an internal interface.
Still another embodiment of the present invention further provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-readable storage medium is configured to implement the network environment switching method according to any one of the above embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A network environment switching method is characterized by comprising the following steps:
acquiring an interface calling request received by at least one preset calling interface and a uniform resource locator corresponding to the interface calling request;
acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses under a plurality of network environments;
replacing the internet protocol address in the uniform resource locator with the target internet protocol address to obtain a target interface calling request;
and accessing the target Internet protocol address according to the target interface calling request.
2. The method of claim 1, further comprising:
acquiring information of a file to be processed corresponding to at least one network environment, wherein the information of the file to be processed comprises an identifier of the file to be processed, a character string in the file to be processed and a switch state corresponding to the file to be processed;
when the switch state corresponding to the file to be processed is on, analyzing the character string, and determining a domain name corresponding to the network environment and an internet protocol address corresponding to the domain name;
and taking the domain name as a keyword, and taking an internet protocol address corresponding to the domain name as a value to be stored, so as to obtain the corresponding relation dictionary.
3. The method according to claim 2, wherein the obtaining information of the file to be processed corresponding to the at least one network environment comprises:
and acquiring to-be-processed file information corresponding to at least one network environment input by a user through scanning preset identification code information or manual input or copying.
4. The method according to claim 3, wherein a scanning icon is arranged on the display interface; the method further comprises the following steps:
acquiring a trigger instruction of the user to the scanning icon;
and scanning preset identification code information according to the trigger instruction to obtain the information of the file to be processed, wherein the identification code information is generated according to the information of the file to be processed.
5. The method according to any one of claims 1 to 4, wherein the obtaining of the interface call request received by the preset at least one call interface comprises:
and acquiring an interface calling request received by at least one preset calling interface through a preset NSURLProtocol tool.
6. The method according to any one of claims 1 to 4, wherein the obtaining of the interface call request received by the preset at least one call interface and the uniform resource locator corresponding to each interface call request includes:
acquiring an interface calling request received by at least one preset calling interface;
and acquiring the uniform resource locator corresponding to each interface calling Request through the Request object.
7. The method according to any one of claims 1 to 4, wherein the obtaining, according to the uniform resource locator, the target internet protocol address corresponding to the interface call request from a preset correspondence dictionary comprises:
determining a network environment to be accessed corresponding to the interface calling request according to the uniform resource locator;
and when detecting that the state corresponding to the network environment to be accessed is an open state, acquiring a target internet protocol address corresponding to the interface calling request in a corresponding relation dictionary corresponding to the network environment to be accessed.
8. A network environment switching apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an interface calling request received by at least one preset calling interface and a uniform resource locator corresponding to the interface calling request;
the processing module is used for acquiring a target internet protocol address corresponding to the interface calling request from a preset corresponding relation dictionary according to the uniform resource locator, wherein the corresponding relation dictionary comprises corresponding relations between domain names and internet protocol addresses under a plurality of network environments;
the replacing module is used for replacing the internet protocol address in the uniform resource locator with the target internet protocol address to obtain a target interface calling request;
and the access module is used for accessing the target Internet protocol address according to the target interface calling request.
9. A network environment switching device, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the network context switching method of any one of claims 1-7 by the processor.
10. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the network environment switching method of any one of claims 1-7.
CN202010093533.4A 2020-02-14 2020-02-14 Network environment switching method, device, equipment and computer readable storage medium Pending CN111343294A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010093533.4A CN111343294A (en) 2020-02-14 2020-02-14 Network environment switching method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010093533.4A CN111343294A (en) 2020-02-14 2020-02-14 Network environment switching method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN111343294A true CN111343294A (en) 2020-06-26

Family

ID=71186906

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010093533.4A Pending CN111343294A (en) 2020-02-14 2020-02-14 Network environment switching method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111343294A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860271A (en) * 2021-03-30 2021-05-28 中国工商银行股份有限公司 Method, device, equipment and storage medium for switching between new system and old system
CN114297058A (en) * 2021-12-23 2022-04-08 马上消费金融股份有限公司 Test method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833364A (en) * 2012-08-22 2012-12-19 深圳市共进电子股份有限公司 Domain name resolution agent method and gateway device
CN105391811A (en) * 2014-08-29 2016-03-09 腾讯科技(深圳)有限公司 DNS (domain name resolution) method, access method for application server, and terminal
CN107402880A (en) * 2016-05-20 2017-11-28 腾讯科技(北京)有限公司 A kind of method of testing and electronic equipment
CN108055168A (en) * 2017-12-29 2018-05-18 广州品唯软件有限公司 A kind of http protocol debuggings systems, devices and methods
CN110149423A (en) * 2019-07-04 2019-08-20 深圳市珍爱捷云信息技术有限公司 Domain name processing method, device, readable storage medium storing program for executing and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833364A (en) * 2012-08-22 2012-12-19 深圳市共进电子股份有限公司 Domain name resolution agent method and gateway device
CN105391811A (en) * 2014-08-29 2016-03-09 腾讯科技(深圳)有限公司 DNS (domain name resolution) method, access method for application server, and terminal
CN107402880A (en) * 2016-05-20 2017-11-28 腾讯科技(北京)有限公司 A kind of method of testing and electronic equipment
CN108055168A (en) * 2017-12-29 2018-05-18 广州品唯软件有限公司 A kind of http protocol debuggings systems, devices and methods
CN110149423A (en) * 2019-07-04 2019-08-20 深圳市珍爱捷云信息技术有限公司 Domain name processing method, device, readable storage medium storing program for executing and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860271A (en) * 2021-03-30 2021-05-28 中国工商银行股份有限公司 Method, device, equipment and storage medium for switching between new system and old system
CN112860271B (en) * 2021-03-30 2024-03-29 中国工商银行股份有限公司 New and old system switching method, device, equipment and storage medium
CN114297058A (en) * 2021-12-23 2022-04-08 马上消费金融股份有限公司 Test method and device

Similar Documents

Publication Publication Date Title
CN110324311B (en) Vulnerability detection method and device, computer equipment and storage medium
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
US9003235B2 (en) Indicating coverage of web application testing
CN107534675A (en) Malware alerts
CN111447215A (en) Data detection method, device and storage medium
US20150161390A1 (en) Fast and accurate identification of message-based api calls in application binaries
CN110990205A (en) Interface call testing method, device and computer readable storage medium
US10491629B2 (en) Detecting sensitive data sent from client device to third-party
CN107707561B (en) Penetration testing method and device
CN110704816B (en) Interface cracking recognition method, device, equipment and storage medium
CN111343294A (en) Network environment switching method, device, equipment and computer readable storage medium
CN111488581A (en) Weak password vulnerability detection method and device, electronic equipment and computer readable medium
CN111797026A (en) Test case generation method and device, computer equipment and storage medium
CN112953962A (en) Domain name access method and device
KR101741131B1 (en) Apparatus and method for analysing crash, and computer-readable medium storing program for method thereof
CN112269666A (en) Applet dead link detection method and device, computing device and medium
CN110691090B (en) Website detection method, device, equipment and storage medium
CN110457900B (en) Website monitoring method, device and equipment and readable storage medium
CN110737861A (en) webpage data processing method, device, equipment and storage medium
CN116451271A (en) Automatic privacy policy extraction method for application software
CN112351008B (en) Network attack analysis method and device, readable storage medium and computer equipment
CN112817816B (en) Embedded point processing method and device, computer equipment and storage medium
JP2016122262A (en) Specification device, specification method and specification program
CN109325348A (en) Application safe analysis method, calculates equipment and computer storage medium at device
CN111309311B (en) Vulnerability detection tool generation method, device, equipment and readable 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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Digital Technology Holding Co.,Ltd.

Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone, 100176

Applicant before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

Address after: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: Room 221, 2 / F, block C, 18 Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant before: Jingdong Digital Technology Holding Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200626