An anti-crawler method based on custom font encoding

Through custom font encoding and website backend transformation methods, the problem that existing anti-crawler methods are easily cracked is solved, achieving higher website data security and greater crawling costs.

CN118643202BActive Publication Date: 2025-02-25BEIJING KUCHE YIMEI NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410759234.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2025-02-25
Estimated Expiration
2044-06-13

AI Technical Summary

Technical Problem

The existing anti-crawler methods are easily cracked by crawlers and cannot effectively improve the security of the website.

Method used

The anti-crawler method based on custom font encoding is adopted. By obtaining the fonts designed by the designer, visual inspection, format conversion, testing and encryption are carried out, and finally the website is introduced and the website backend is transformed to improve the security of data.

Benefits of technology

Through the transformation of custom font encoding and the transformation of the website backend, the security of website data is improved and the difficulty and cost of crawling crawler data is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643202B_ABST
    Figure CN118643202B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of electronic data processing, and in particular to an anti-crawler method based on custom font encoding, comprising: step S1, obtaining a font designed by a designer; step S2, visually inspecting the custom font according to a visual inspection method; step S3, converting the custom font that meets the visual inspection standard into a .ttf format; step S4, judging the validity of the visual inspection result, and correcting the visual inspection result according to the judgment result; step S5, converting the custom font file with a valid visual inspection result into a .woff2 format; step S6, optimizing the correction process of the visual inspection result; step S7, encrypting the custom font file after the .woff2 format conversion; step S8, introducing the encrypted custom font file into a website; step S9, transforming the website back end according to the website back end transformation method. The present invention improves the data security of the website.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic data processing, and in particular to an anti-crawler method based on custom font encoding. Background Art

[0002] Many websites and applications have a large amount of valuable data, which is the core asset of the company. If anti-crawling measures are not taken, this data can easily be crawled by malicious crawlers, resulting in data leakage and abuse. It is difficult to completely eliminate crawlers through anti-crawling. Only by continuously improving the technical threshold and increasing the cost and difficulty of crawling can we better protect our own data. We can also reduce the value of crawled data by confusing some false data.

[0003] Chinese Patent Publication No.: CN111008348A discloses an anti-crawler method, terminal, server and computer-readable storage medium, the method comprising: storing a font file generated based on a preset keyword and a font encoding corresponding to the keyword to a server; sending a web page acquisition request to the server, the web page acquisition request is used to instruct the server to return web page content, and replace the keyword in the web page content with the font encoding when the web page content contains the font file; receiving the web page content returned by the server, and displaying the web page content according to a preset display strategy. However, this method does not modify the font encoding, which is easily cracked by crawlers and cannot improve website security. Summary of the invention

[0004] To this end, the present invention provides an anti-crawler method based on custom font encoding to overcome the problem in the prior art that it is easily cracked by crawlers and cannot improve the security of the website.

[0005] To achieve the above object, the present invention provides an anti-crawler method based on custom font encoding, comprising:

[0006] Step S1, obtaining a font designed by a designer and using it as a custom font;

[0007] Step S2, performing a visual inspection on the custom font according to a visual inspection method;

[0008] Step S3, converting the custom fonts that meet the visual inspection standards into .ttf format;

[0009] Step S4, testing the format-converted custom font file, judging the validity of the visual inspection result according to the test result, and correcting the visual inspection result according to the judgment result;

[0010] Step S5, converting the custom font file with valid visual inspection results into .woff2 format;

[0011] Step S6, optimizing the visual inspection result correction process by testing according to the average loading time;

[0012] Step S7, encrypting the custom font file converted into .woff2 format;

[0013] Step S8, importing the encrypted custom font file into the website;

[0014] Step S9, transforming the website backend according to the website backend transformation method.

[0015] Further, in step S2, the visual inspection method includes:

[0016] Step S20, obtaining the RGB value K and gray value F of the vector image of the custom font;

[0017] Step S21, checking the color of the vector image according to the RGB value K;

[0018] Step S22, checking the font of the vector image according to the gray value F;

[0019] Step S23, judging the inspection result.

[0020] Furthermore, in the step S20, a vector image, an RGB value K and a gray value F of the custom font are obtained by vector graphics processing software;

[0021] In the step S21, when checking the color of the vector image, the RGB value K is compared with the preset RGB value K0, and the qualified result of the color of the vector image is judged according to the comparison result, wherein:

[0022] When K=K0, the color of the vector image is judged to be qualified;

[0023] When K≠K0, the color of the vector image is judged to be unqualified;

[0024] In the step S22, when checking the font of the vector image, the gray value F is compared with the preset gray value F0, and the qualified result of the font of the vector image is judged according to the comparison result, wherein:

[0025] When F=F0, the font of the vector image is determined to be qualified;

[0026] When F≠F0, the font of the vector image is judged to be unqualified;

[0027] In step S23, when judging the inspection result, the visual inspection result is judged according to the color and font qualification result of the vector image, wherein:

[0028] When the color of the vector image is qualified and the font of the vector image is qualified, the visual inspection is judged to be qualified;

[0029] When the color of the vector image is qualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is obtained again;

[0030] When the color of the vector image is unqualified and the font of the vector image is qualified, the visual inspection is determined to be unqualified and the custom font is obtained again;

[0031] When the color of the vector image is unqualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is re-acquired.

[0032] Furthermore, in step S4, the custom font file is installed in the text editor, the sample text is rendered, and the rendering effect is obtained, which is used as the test result, and the validity of the visual inspection result is judged according to the test result, and the visual inspection result is corrected according to the judgment result, wherein:

[0033] When the test result is consistent with the preset rendering effect, the visual inspection result is determined to be valid and no correction is made to the visual inspection result;

[0034] When the test result is inconsistent with the preset rendering effect, the visual inspection result is determined to be invalid, the visual inspection result is corrected to be substandard, the preset RGB value K0 and the preset grayscale value F0 are adjusted, and the custom font is visually inspected again.

[0035] Furthermore, in step S6, the custom font is introduced into the website through the @font-face rule in CSS, its average loading time ΔT is detected, the average loading time ΔT is compared with the preset average loading time ΔT0, the performance of the custom font file is judged according to the comparison result, and the process of correcting the visual inspection result according to the judgment result is optimized, wherein:

[0036] When ΔT≤ΔT0, the performance of the custom font file is determined to be up to standard, and the process of not correcting the visual inspection result is optimized;

[0037] When ΔT>ΔT0, it is determined that the performance of the custom font file does not meet the standard, and the process of correcting the visual inspection result is optimized by compressing the custom font file.

[0038] Furthermore, in step S7, four custom font files are generated, the custom font files are named 0.woff2, 1.woff2, 2.woff2 and 3.woff2, and the original encoding of the characters in the custom font files is changed by applying a preset encoding conversion method.

[0039] Furthermore, in step S9, the website backend transformation method includes:

[0040] Step S90, judging the validity of the network request according to the absolute value of the difference between the timestamp (Unix timestamp) and the current server time;

[0041] Step S91, concatenate the valid timestamp (Unix timestamp) and infoId parameter of the network request, calculate the concatenated string to obtain an MD5 value, perform CRC32 checksum calculation on the MD5 value, and output the calculation result N;

[0042] Step S92, taking the modulus of the calculation result N and mapping it to the font file address;

[0043] Step S93, judging the consistency of the parameters of the font request and the data request, and adjusting the font file address mapping result of the mapping value according to the judgment result.

[0044] Furthermore, in step S90, the absolute value V of the difference between the timestamp (Unix timestamp) and the current server time is compared with a preset absolute value V0, and the validity of the request is judged according to the comparison result, wherein:

[0045] When V≤V0, the network request is determined to be valid;

[0046] When V>V0, the network request is determined to be invalid.

[0047] Further, in the step S91, the timestamp and infoId parameters are concatenated into a string, the string is hashed using the MD5 algorithm to obtain an MD5 value D, the MD5 value is subjected to a CRC32 checksum calculation, and a calculation result N is output; in the step S92, the calculation result N is modulo 4, and the modulo 4 calculation result is output, the modulo 4 calculation result is used as the mapping value N0, and the mapping value N0 is mapped to the font file address, wherein:

[0048] 0 corresponds to https: / / www.test.com / 0.woff2;

[0049] 1 corresponds to https: / / www.test.com / 1.woff2;

[0050] 2 corresponds to https: / / www.test.com / 2.woff2;

[0051] 3 corresponds to https: / / www.test.com / 3.woff2.

[0052] Furthermore, in step S93, the timestamp and infoId parameters of the font request interface are compared with the timestamp and infoId parameters of the data request interface, and the consistency of the parameters is determined according to the comparison result, and the mapping mode is adjusted according to the determination result, wherein:

[0053] When the timestamp and infoId parameters of the font request interface are the same as those of the data request interface, the parameters are determined to be consistent and the mapping method is not adjusted;

[0054] When the timestamp and infoId parameters of the font request interface are different from the timestamp and infoId parameters of the data request interface, it is determined that the parameters are inconsistent and the mapping method is adjusted.

[0055] Compared with the prior art, the beneficial effect of the present invention lies in that the method obtains the font designed by the designer through step S1 and uses it as a custom font to facilitate subsequent changes to the font encoding, thereby improving data security. The method performs a visual inspection on the custom font according to the visual inspection method through step S2, and converts the custom font that meets the visual inspection standard into a .ttf format through step S3 to ensure the integrity of the custom font, thereby improving data security. The method tests the custom font file after the format conversion through step S4, and judges the validity of the visual inspection result according to the test result, and modifies the visual inspection result according to the judgment result, thereby further improving data security. The method performs a visual inspection through step S5. The custom font files with valid visual inspection results are converted into .woff2 format to maintain high-quality display and achieve cross-platform performance, thereby enhancing the compatibility of custom fonts. The method optimizes the visual inspection result correction process according to the average loading time through step S6 to improve the correction efficiency, thereby further improving the security of the data. The step S7 further improves the security and uniqueness of the font by encrypting the custom font files after the .woff2 format conversion. The method introduces the encrypted custom font files into the website through step S8, and transforms the website backend according to the website backend transformation method through step S9 to implement strict security measures to distort the crawler data crawling, thereby improving the security of the website. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 This is a flow chart of the anti-crawler method based on custom font encoding in this embodiment;

[0057] Figure 2 is a flow chart of the visual inspection method of this example;

[0058] Figure 3 This is a flowchart of the back-end transformation method of the website in this example. DETAILED DESCRIPTION

[0059] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0060] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0061] See also Figure 1 As shown, it is a flow chart of the anti-crawler method based on custom font encoding in this example, and the method includes:

[0062] Step S1, obtaining a font designed by a designer and using it as a custom font;

[0063] Step S2, performing a visual inspection on the custom font according to a visual inspection method;

[0064] Step S3, converting the custom fonts that meet the visual inspection standards into .ttf format;

[0065] Step S4, testing the format-converted custom font file, judging the validity of the visual inspection result according to the test result, and correcting the visual inspection result according to the judgment result;

[0066] Step S5, converting the custom font file with valid visual inspection results into .woff2 format;

[0067] Step S6, optimizing the visual inspection result correction process by testing according to the average loading time;

[0068] Step S7, encrypting the custom font file converted into .woff2 format;

[0069] Step S8, importing the encrypted custom font file into the website;

[0070] Step S9, transforming the website backend according to the website backend transformation method.

[0071] Specifically, the method is applied to a website platform, and by changing the font encoding and modifying the website backend, the website information is prevented from being obtained by crawlers, thereby improving the uniqueness and security of the data.

[0072] Specifically, the method obtains the font designed by the designer through step S1, and uses it as a custom font, so that the font encoding can be changed later, thereby improving the security of the data. The method performs a visual inspection on the custom font according to the visual inspection method through step S2, and converts the custom font that meets the visual inspection standard into a .ttf format through step S3, so as to ensure the integrity of the custom font, thereby improving the security of the data. The method tests the custom font file after the format conversion through step S4, and judges the validity of the visual inspection result according to the test result, and modifies the visual inspection result according to the judgment result, thereby further improving the security of the data. The method performs a visual inspection on the custom font file through step S5. The effective custom font file is converted into .woff2 format to maintain high-quality display and achieve cross-platform performance, thereby enhancing the compatibility of custom fonts. The method optimizes the visual inspection result correction process according to the average loading time through step S6 to improve the correction efficiency, thereby further improving the security of the data. The step S7 further improves the security and uniqueness of the font by encrypting the custom font file after the .woff2 format conversion. The method introduces the encrypted custom font file into the website through step S8, and through step S9, transforms the website backend according to the website backend transformation method, so as to implement strict security measures to distort the crawler data crawling, thereby improving the security of the website.

[0073] Specifically, in step S1, the custom font refers to a unique font designed by a designer. This embodiment does not limit the method of obtaining the font designed by the designer. Relevant technical personnel in the field can freely set it, and it is only necessary to meet the demand for obtaining the font designed by the designer. For example, the acquisition method can be set to purchase from the designer.

[0074] See also Figure 2 As shown, it is a flow chart of the visual inspection method of this example, and the visual inspection method includes:

[0075] Step S20, obtaining the RGB value K and gray value F of the vector image of the custom font;

[0076] Step S21, checking the color of the vector image according to the RGB value K;

[0077] Step S22, checking the font of the vector image according to the gray value F;

[0078] Step S23, judging the inspection result.

[0079] Specifically, in step S20, the vector image, RGB value K and gray value F of the custom font are obtained through vector graphics processing software.

[0080] Specifically, the vector image refers to an image representation based on mathematical methods, in which mathematical formulas are used to define the image's geometric shape, size, position, color and other attributes. The RGB value K refers to the intensity value of the three colors of red, green and blue in the custom font vector image. The grayscale value F refers to the brightness value of each pixel in the vector image. This embodiment does not limit the type of vector graphics processing software, and relevant technical personnel in this field can set it freely as long as it meets the need to obtain the vector image of the custom font. For example, the type of vector graphics processing software can be set to Adobe Illustrator.

[0081] Specifically, in step S21, when checking the color of the vector image, the RGB value K is compared with the preset RGB value K0, and the qualified result of the color of the vector image is judged according to the comparison result, wherein:

[0082] When K=K0, the color of the vector image is judged to be qualified;

[0083] When K≠K0, the color of the vector image is judged to be unqualified.

[0084] Specifically, the preset RGB value K0 refers to a value preset in order to reflect a qualified result of the color of the vector image. This embodiment does not limit the value of the preset RGB value K0, and relevant technical personnel in the field can freely set it as long as it meets the requirement of reflecting a qualified result of the color of the vector image. For example, the preset RGB value K0 can be set to K0= (R=22, G=33, B=44).

[0085] Specifically, in step S22, when checking the font of the vector image, the gray value F is compared with the preset gray value F0, and the qualified result of the font of the vector image is judged according to the comparison result, wherein:

[0086] When F=F0, the font of the vector image is determined to be qualified;

[0087] When F≠F0, the font of the vector image is determined to be unqualified.

[0088] Specifically, the preset grayscale value F0 refers to a value preset to reflect the qualified result of the font of the vector image. This embodiment does not limit the value of the preset grayscale value F0. Relevant technical personnel in the field can set it freely as long as it meets the requirements of judging the qualified result of the font of the vector image. For example, the preset grayscale value F0 can be set to 0.

[0089] Specifically, in step S23, when judging the inspection result, the visual inspection result is judged according to the color and font qualification result of the vector image, wherein:

[0090] When the color of the vector image is qualified and the font of the vector image is qualified, the visual inspection is judged to be qualified;

[0091] When the color of the vector image is qualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is obtained again;

[0092] When the color of the vector image is unqualified and the font of the vector image is qualified, the visual inspection is determined to be unqualified and the custom font is obtained again;

[0093] When the color of the vector image is unqualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is re-acquired.

[0094] Specifically, in step S3, the custom font that meets the visual inspection standard is converted into a custom font file in .ttf format through font editing software.

[0095] Specifically, the font editing software refers to a special software tool used to create, edit and optimize font files. This embodiment does not limit the type of font editing software, and relevant personnel in this field can set it freely. It only needs to meet the requirements of converting custom fonts that meet the visual inspection standards into custom font files in .ttf format. For example, the font editing software can be set to FontForge. The custom font file in .ttf format refers to the format of the font file that contains the font outline, character encoding, and font attributes, and is used to present text in computer systems and applications.

[0096] Specifically, in step S4, the custom font file is installed in the text editor, the sample text is rendered, and the rendering effect is obtained, which is used as the test result. The validity of the visual inspection result is judged according to the test result, and the visual inspection result is corrected according to the judgment result, wherein:

[0097] When the test result is consistent with the preset rendering effect, the visual inspection result is determined to be valid and no correction is made to the visual inspection result;

[0098] When the test result is inconsistent with the preset rendering effect, the visual inspection result is determined to be invalid, the visual inspection result is corrected to be substandard, the preset RGB value K0 and the preset grayscale value F0 are adjusted, and the custom font is visually inspected again.

[0099] Specifically, when adjusting the preset RGB value K0 and the preset grayscale value F0, the preset RGB value adjustment coefficient U is set, U=Sin(KO-K), Sin is the sine function in the trigonometric function, and the preset RGB value is urgently adjusted according to the preset RGB value adjustment coefficient U, and the adjusted preset RGB value is set to Ku0, Ku0=K0+U, and the preset grayscale value adjustment coefficient Z is set, wherein Z=0.5+0.7×e-0.3×(F-F0), e is the base of the natural logarithm, and the preset grayscale value is adjusted according to the preset grayscale value adjustment coefficient Z, and the adjusted preset grayscale value is set to Fz0, Fz0=Z×F0.

[0100] Specifically, the text editor refers to a computer program used to input, edit, view and save plain text files. This embodiment does not limit the type of text editor, and relevant technical personnel in the field can set it freely, as long as the need for rendering sample text is met. For example, the text editor type can be set to Visual Studio Code. The sample text refers to a representative text content used to test a custom font file. The rendering refers to the process of representing the font glyphs of a custom font file with pixels. The rendering effect refers to the visual expression result of the custom font obtained by rendering the sample text, such as character integrity, color, intensity and shadow. The preset rendering effect refers to a preset comparison effect to reflect the validity of the visual inspection results. This embodiment does not limit the content of the preset rendering effect, and relevant technical personnel in the field can set it freely, as long as the need for judging the validity of the visual inspection results is met. For example, the preset rendering effect can be set to red font, bold font and clear text.

[0101] Specifically, in step S5, the custom font file with a valid visual inspection result is input into the online conversion tool Transfonter, and the .ttf format of the custom font file with a valid visual inspection result is converted into the .woff2 format by the online conversion tool Transfonter.

[0102] Specifically, in step S6, the custom font is introduced into the website through the @font-face rule in CSS, its average loading time ΔT is detected, the average loading time ΔT is compared with the preset average loading time ΔT0, the performance of the custom font file is judged according to the comparison result, and the process of correcting the visual inspection result according to the judgment result is optimized, wherein:

[0103] When ΔT≤ΔT0, the performance of the custom font file is determined to be up to standard, and the process of not correcting the visual inspection result is optimized;

[0104] When ΔT>ΔT0, it is determined that the performance of the custom font file does not meet the standard, and the process of correcting the visual inspection result is optimized by compressing the custom font file.

[0105] Specifically, the CSS refers to a computer language used to add styles to structured documents, the @font-face rule refers to a rule in CSS that allows users to load font files on a server, the average loading time ΔT refers to the average time interval required to download the font file from the server to the browser and make it available for rendering page content, the preset average loading time ΔT0 refers to the average loading time preset to reflect the result of judging the performance of the custom font file, and the compression of the custom font file refers to a method of reducing the size of the font file through specific technologies and tools. This embodiment does not limit the method of compressing the custom font file, and relevant technicians in the field can freely set it as long as the need to optimize the process of correcting the visual inspection results is met. For example, the method of compressing the custom font file can be set to use the font compression tool Woff2 compressor to compress the custom font file.

[0106] Specifically, in step S7, four custom font files are generated, the custom font files are named 0.woff2, 1.woff2, 2.woff2 and 3.woff2, and the original encoding of the characters in the custom font files is changed by applying a preset encoding conversion method.

[0107] Specifically, the preset encoding conversion method refers to the mapping rule of the original character encoding of the four custom font files to the custom encoding. The present embodiment does not limit the content of the preset encoding conversion method, and relevant personnel in this field can set it freely, as long as the demand for changing the original character encoding is met. For example, the original encoding of character 0 \u0030 can be set to be converted into \u0040, \u0050, \u0060, \u0070, the original encoding of character 1 \u0031 can be converted into \u0041, \u0051, \u0061, \u0071, and the original encoding of character 9 \u0039 can be converted into \u0049, \u0059, \u0069, \u0079. The original character encoding refers to the initial encoding of the characters in the custom font file.

[0108] Specifically, in step S8, the encrypted custom font file is introduced into the website through the @font-face rule in CSS.

[0109] See also Figure 3 As shown, it is a flow chart of the website backend transformation method of this example, and the website backend transformation method includes:

[0110] Step S90, judging the validity of the network request according to the absolute value of the difference between the timestamp (Unix timestamp) and the current server time;

[0111] Step S91, concatenate the valid timestamp (Unix timestamp) and infoId parameter of the network request, calculate the concatenated string to obtain an MD5 value, perform CRC32 checksum calculation on the MD5 value, and output the calculation result N;

[0112] Step S92, taking the modulus of the calculation result N and mapping it to the font file address;

[0113] Step S93, judging the consistency of the parameters of the font request and the data request, and adjusting the font file address mapping result of the mapping value according to the judgment result.

[0114] Specifically, in step S90, the absolute value V of the difference between the timestamp (Unix timestamp) and the current server time is compared with the preset absolute value V0, and the validity of the request is judged according to the comparison result, wherein:

[0115] When V≤V0, the network request is determined to be valid;

[0116] When V>V0, the network request is determined to be invalid.

[0117] Specifically, the timestamp (Unix timestamp) refers to the number of seconds that have passed from 00:00:00 on January 1, 1970 to the time when the timestamp (Unix timestamp) is read, the current server time refers to the current system time of the server location, and the preset absolute value V0 refers to the absolute value of the difference between the preset timestamp (Unix timestamp) and the current server time in order to reflect the validity of the request, and V0=120 is set.

[0118] Specifically, in step S91, the timestamp and infoId parameters are concatenated into a string, the string is hashed using the MD5 algorithm to obtain an MD5 value D, a CRC32 checksum is performed on the MD5 value, and a calculation result N is output.

[0119] Specifically, the infoId parameter refers to an identifier used to uniquely identify certain information, records, objects and entities. The identifier of the infoId parameter is set to testid123. The MD5 algorithm refers to a cryptographic hash function that can generate a 128-bit (16-byte) hash value. The hash operation refers to a function that maps a binary value of any length to a shorter fixed-length binary value. The CRC32 checksum refers to a 32-bit check value calculated using a cyclic redundancy check (CRC) algorithm. The cyclic redundancy check (CRC) algorithm refers to a technology used to detect whether an error occurs after data transmission or storage.

[0120] Specifically, in step S92, the calculation result N is modulo 4, and the modulo 4 calculation result is output, and the modulo 4 calculation result is used as the mapping value N0, and the mapping value N0 is mapped to the font file address, wherein:

[0121] 0 corresponds to https: / / www.test.com / 0.woff2;

[0122] 1 corresponds to https: / / www.test.com / 1.woff2;

[0123] 2 corresponds to https: / / www.test.com / 2.woff2;

[0124] 3 corresponds to https: / / www.test.com / 3.woff2.

[0125] Specifically, the modulo 4 refers to the remainder after dividing the result N of the CRC32 checksum calculation by 4, and the font file address refers to a uniform resource locator used to identify a resource location on the Internet.

[0126] Specifically, in step S93, the timestamp and infoId parameters of the font request interface are compared with the timestamp and infoId parameters of the data request interface, the consistency of the parameters is judged according to the comparison result, and the mapping mode is adjusted according to the judgment result, wherein:

[0127] When the timestamp and infoId parameters of the font request interface are the same as those of the data request interface, the parameters are determined to be consistent and the mapping method is not adjusted;

[0128] When the timestamp and infoId parameters of the font request interface are different from the timestamp and infoId parameters of the data request interface, it is determined that the parameters are inconsistent and the mapping method is adjusted.

[0129] Specifically, the font request interface refers to an application programming interface for requesting and loading font resources in an application, the data request interface refers to an application programming interface for requesting and obtaining data in an application, and the data crawling distortion refers to a situation where the data obtained in the process of obtaining data is inconsistent with the original data. This embodiment does not limit the content of adjusting the mapping method. Relevant personnel in this field can freely set it, as long as the requirement of causing data crawling distortion is met, such as being set to:

[0130] 3 corresponds to https: / / www.test.com / 0.woff2;

[0131] 2 corresponds to https: / / www.test.com / 1.woff2;

[0132] 1 corresponds to https: / / www.test.com / 2.woff2;

[0133] 0 corresponds to https: / / www.test.com / 3.woff2.

[0134] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. An anti-crawler method based on custom font encoding, characterized in that: include: Step S1, obtaining a font designed by a designer and using it as a custom font; Step S2, performing a visual inspection on the custom font according to a visual inspection method; In step S2, the visual inspection method includes: Step S20, obtaining the RGB value K and gray value F of the vector image of the custom font; Step S21, checking the color of the vector image according to the RGB value K; Step S22, checking the font of the vector image according to the gray value F; Step S23, judging the inspection result; Step S3, converting the custom fonts that meet the visual inspection standards into .ttf format; Step S4, testing the format-converted custom font file, judging the validity of the visual inspection result according to the test result, and correcting the visual inspection result according to the judgment result; In step S4, the custom font file is installed in the text editor, the sample text is rendered, and the rendering effect is obtained, which is used as the test result. The validity of the visual inspection result is judged according to the test result, and the visual inspection result is corrected according to the judgment result, wherein: When the test result is consistent with the preset rendering effect, the visual inspection result is determined to be valid and no correction is made to the visual inspection result; When the test result is inconsistent with the preset rendering effect, the visual inspection result is determined to be invalid, the visual inspection result is corrected to be substandard, and the preset RGB value K0 and the preset gray value F0 are adjusted, and the custom font is visually inspected again; Step S5, converting the custom font file with valid visual inspection results into .woff2 format; Step S6, optimizing the visual inspection result correction process according to the detection result of the average loading time; In step S6, the custom font is introduced into the website through the @font-face rule in CSS, its average loading time ΔT is detected, the average loading time ΔT is compared with the preset average loading time ΔT0, the performance of the custom font file is judged according to the comparison result, and the process of correcting the visual inspection result according to the judgment result is optimized, wherein: When ΔT≤ΔT0, the performance of the custom font file is determined to be up to standard, and the process of not correcting the visual inspection result is optimized; When ΔT>ΔT0, it is determined that the performance of the custom font file does not meet the standard, and the process of correcting the visual inspection result is optimized by compressing the custom font file; Step S7, encrypting the custom font file converted into .woff2 format; Step S8, importing the encrypted custom font file into the website; Step S9, transforming the website backend according to the website backend transformation method; In step S9, the website backend transformation method includes: Step S90, judging the validity of the network request according to the absolute value of the difference between the timestamp and the current server time; Step S91, concatenate the valid timestamp and infoId parameter of the network request, calculate the concatenated string to obtain the MD5 value, perform CRC32 checksum calculation on the MD5 value, and output the calculation result N; Step S92, taking the modulus of the calculation result N and mapping it to the font file address; Step S93, judging the consistency of the parameters of the font request and the data request, and adjusting the font file address mapping result of the mapping value according to the judgment result.

2. The anti-crawler method based on custom font encoding according to claim 1, characterized in that: In the step S20, a vector image, an RGB value K and a gray value F of the custom font are obtained by using vector graphics processing software; In the step S21, when checking the color of the vector image, the RGB value K is compared with the preset RGB value K0, and the qualified result of the color of the vector image is judged according to the comparison result, wherein: When K=K0, the color of the vector image is judged to be qualified; When K≠K0, the color of the vector image is judged to be unqualified; In the step S22, when checking the font of the vector image, the gray value F is compared with the preset gray value F0, and the qualified result of the font of the vector image is judged according to the comparison result, wherein: When F=F0, the font of the vector image is determined to be qualified; When F≠F0, the font of the vector image is judged to be unqualified; In step S23, when judging the inspection result, the visual inspection result is judged according to the color and font qualification results of the vector image, wherein: When the color of the vector image is qualified and the font of the vector image is qualified, the visual inspection is judged to be qualified; When the color of the vector image is qualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is obtained again; When the color of the vector image is unqualified and the font of the vector image is qualified, the visual inspection is determined to be unqualified and the custom font is obtained again; When the color of the vector image is unqualified and the font of the vector image is unqualified, it is determined that the visual inspection fails to meet the standards, and the custom font is re-acquired.

3. The anti-crawler method based on custom font encoding according to claim 1, characterized in that: In step S7, four custom font files are generated, the custom font files are named 0.woff2, 1.woff2, 2.woff2 and 3.woff2, and the original encoding of the characters in the custom font files is changed by applying a preset encoding conversion method.

4. The anti-crawler method based on custom font encoding according to claim 1, characterized in that: In step S90, the absolute value V of the difference between the timestamp and the current server time is compared with the preset absolute value V0, and the validity of the request is judged according to the comparison result, wherein: When V≤V0, the network request is determined to be valid; When V>V0, the network request is determined to be invalid.

5. The anti-crawler method based on custom font encoding according to claim 1, characterized in that: In the step S91, the timestamp and the infoId parameter are concatenated into a string, the string is hashed using the MD5 algorithm to obtain an MD5 value D, the MD5 value is checked and calculated by CRC32, and the calculation result N is output; in the step S92, the calculation result N is modulo 4, and the modulo 4 calculation result is output, the modulo 4 calculation result is used as the mapping value N0, and the mapping value N0 is mapped to the font file address, wherein: 0 corresponds to https: / / www.test.com / 0.woff2; 1 corresponds to https: / / www.test.com / 1.woff2; 2 corresponds to https: / / www.test.com / 2.woff2; 3 corresponds to https: / / www.test.com / 3.woff2.

6. The anti-crawler method based on custom font encoding according to claim 1, characterized in that: In the step S93, the timestamp and infoId parameters of the font request interface are compared with the timestamp and infoId parameters of the data request interface, and the consistency of the parameters is judged according to the comparison result, and the mapping method is adjusted according to the judgment result, wherein: When the timestamp and infoId parameters of the font request interface are the same as those of the data request interface, the parameters are determined to be consistent and the mapping method is not adjusted; When the timestamp and infoId parameters of the font request interface are different from the timestamp and infoId parameters of the data request interface, it is determined that the parameters are inconsistent and the mapping method is adjusted.

Citation Information

Patent Citations

  • Anti-crawler method, terminal, server and computer readable storage medium

    CN111008348A

  • A method for encrypting anti-crawler

    CN109862031A

  • Webpage text encryption and decryption method based on random fonts

    CN111859853A