Methods, devices and equipment for preventing audio and video hotlinking

By parsing the header bytes and content of image files, combined with file size and transcoding, this method identifies and processes hotlinked files that disguise audio and video files as images. This solves the problem of hotlinking audio and video files disguised as images in existing technologies and achieves an effective anti-hotlinking solution.

CN115550663BActive Publication Date: 2025-10-28HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210922319.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-02
Publication Date
2025-10-28
Estimated Expiration
2042-08-02

AI Technical Summary

Technical Problem

In existing technologies, cybercriminals bypass anti-leeching technologies by disguising audio and video files as images and uploading them to CDN servers, allowing users to obtain permanently valid audio and video resources. Existing platform servers cannot effectively identify and handle such leeching behavior.

Method used

By obtaining the header byte information, image content, and image source information of the image file to be examined, parsing the header byte information and/or image content, and combining the file size, resolution, and transcoding processing, it is determined whether audio or video files are embedded in the image source information, and appropriate processing is carried out when it is identified as hotlinking.

Benefits of technology

It accurately identifies and processes audio and video hotlinked files, improving processing efficiency, avoiding accidental deletion, and enhancing user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115550663B_ABST
    Figure CN115550663B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus and device for preventing audio and video hotlinking, which relates to the field of Internet platform technology. The method comprises: first, in response to a callback request from a content distribution network CDN server, obtaining a picture file to be checked from the CDN server, and then determining the header byte information, picture content and picture source information of the picture file to be checked, parsing the header byte information and / or the picture content, and determining the situation of the audio and video file embedded in the picture source information based on the parsing results of the header byte information and / or the picture content. In summary, the embodiment of the present application can accurately identify the audio and video files with hotlinking by detecting and processing the relevant files of the new hotlinking scenario in which videos are forged into pictures, and ensures processing efficiency, optimizes the processing scheme for hotlinking files, and will not cause the problem of accidental deletion even if misidentified, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet platform technology, and in particular to a method, apparatus and device for preventing audio and video hotlinking. Background Technology

[0002] After the content delivery client uploads the video to the content delivery network (CDN) server, the browsing client retrieves the audio and video by requesting the corresponding URL (uniform resource locator) address from the platform server. Since audio and video consume a lot of bandwidth, the network side adopts anti-hotlinking technology for audio and video content.

[0003] The network side pre-configures the key and expiration time timestamp on the platform server. When a browsing client requests the playback address of audio and video resources, the platform server encrypts the URL address using the key and timestamp. The browsing client then uses the encrypted URL address to request the corresponding audio and video resources from the CDN server. The CDN verifies the validity of the URL address and returns the audio and video resources after successful verification.

[0004] Currently, images are often embedded as static resources in HTML (Hypertext Markup Language) pages, and generally do not undergo special anti-hotlinking measures. However, there are instances where malicious clients disguise audio and video files as images, splitting and compressing them into image files without modifying the image headers, and then uploading them to CDN servers. Since platform servers currently only verify the header bytes when confirming the presence of image files on the CDN, there is a possibility that users can obtain permanently valid audio and video resources by combining the URLs of these image files. Summary of the Invention

[0005] The exemplary embodiments of this application provide a method, apparatus, and device for preventing audio and video hotlinking, in order to overcome the hotlinking technology in the related art that disguises audio and video files as images.

[0006] According to a first aspect of an exemplary embodiment, a method for preventing audio and video hotlinking is provided, applied to a platform server, the method comprising:

[0007] In response to a callback request from the Content Delivery Network (CDN) server, the image file to be verified is obtained from the CDN server.

[0008] Determine the header byte information, image content, and image source information of the image file to be inspected;

[0009] The header byte information and / or the image content are parsed, and the audio and video files embedded in the image source information are determined based on the parsing results of the header byte information and / or the image content.

[0010] In one possible implementation, determining the presence of embedded audio / video files in the image source information based on the parsing result of the header bytes includes:

[0011] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

[0012] In one possible implementation, the parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution;

[0013] The step of determining the situation of embedded audio and video files in the image source information based on the parsing result of the image content includes determining that there are embedded audio and video files in the image source information in response to the fact that the size of the image file is greater than the size of the normal file and the difference between the two exceeds a preset threshold.

[0014] In one possible implementation, parsing the header byte information and / or the image content, and determining the audio / video files embedded in the image source information based on the parsing results of the header byte information and / or the image content, includes:

[0015] The image file to be verified is transcoded to extract the header bytes and the valid content of the image content excluding blank areas, thus obtaining the transcoded file.

[0016] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0017] In one possible implementation, when the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, determining that the image source information contains embedded audio or video files includes:

[0018] If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

[0019] In one possible implementation, parsing the header byte information and the image content, and determining the audio / video files embedded in the image source information based on the parsing results of the header byte information and the image content, includes:

[0020] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information;

[0021] Otherwise, the image content is analyzed to determine the resolution and the normal file size corresponding to the resolution;

[0022] In response to the fact that the size of the image file is greater than the size of the normal file and the difference between the two exceeds a preset threshold, it is determined that there is an embedded audio or video file in the image source information;

[0023] Otherwise, by transcoding the image file to be verified, the header bytes and valid content (excluding blank areas) of the image file are extracted to obtain the transcoded file.

[0024] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0025] In one possible implementation, it also includes:

[0026] If the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is greater than the size of the normal file and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified.

[0027] In one possible implementation, it also includes:

[0028] When it is determined that the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, the transcoded file is sent to the CDN server, and the CDN server is instructed to replace the image file to be verified with the transcoded file.

[0029] Secondly, this application also provides an audio / video anti-leeching device, applied to a platform server, the device comprising:

[0030] The image file acquisition module is configured to retrieve the image file to be verified from the CDN server in response to a callback request from the CDN server.

[0031] The image file information determination module is configured to determine the header byte information, image content, and image source information of the image file to be inspected.

[0032] The image file parsing module is configured to parse the header byte information and / or the image content, and determine the audio and video files embedded in the image source information based on the parsing results of the header byte information and / or the image content.

[0033] In one possible implementation, if the image source information is determined to contain embedded audio or video files based on the parsing result of the header bytes, the image file parsing module is configured to:

[0034] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

[0035] In one possible implementation, the parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution;

[0036] The image file parsing module is configured to determine the embedded audio / video files in the image source information based on the parsing results of the image content.

[0037] In response to the image file being larger than the normal file size and the difference between the two exceeding a preset threshold, it is determined that there is an embedded audio or video file in the image source information.

[0038] In one possible implementation, the image file parsing module is configured to: parse the header byte information and / or the image content, and determine the audio / video files embedded in the image source information based on the parsing results of the header byte information and / or the image content.

[0039] The image file to be verified is transcoded to extract the header bytes and the valid content of the image content excluding blank areas, thus obtaining the transcoded file.

[0040] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0041] In one possible implementation, when the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, it is determined that there is an embedded audio or video file in the image source information, and the image file parsing module is configured as follows:

[0042] If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

[0043] In one possible implementation, the process of parsing the header byte information and the image content is performed, and the status of the audio / video files embedded in the image source information is determined based on the parsing results of the header byte information and the image content. The image file parsing module is configured as follows:

[0044] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information;

[0045] Otherwise, the image content is analyzed to determine the resolution and the normal file size corresponding to the resolution;

[0046] In response to the fact that the size of the image file is greater than the size of the normal file and the difference between the two exceeds a preset threshold, it is determined that there is an embedded audio or video file in the image source information;

[0047] Otherwise, by transcoding the image file to be verified, the header bytes and valid content (excluding blank areas) of the image file are extracted to obtain the transcoded file.

[0048] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0049] In one possible implementation, the image file parsing module is further configured to:

[0050] If the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is greater than the size of the normal file and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified.

[0051] In one possible implementation, the image file parsing module is further configured to:

[0052] When it is determined that the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, the transcoded file is sent to the CDN server, and the CDN server is instructed to replace the image file to be verified with the transcoded file.

[0053] Thirdly, embodiments of this application provide a server-side device, including:

[0054] processor;

[0055] Memory used to store the processor's executable instructions;

[0056] The processor is configured to execute the instructions to implement the audio / video hotlinking prevention method provided in the first aspect.

[0057] Fourthly, embodiments of this application provide a storage medium that, when instructions in the storage medium are executed by the processor of a server device, enables the server device to perform the audio / video anti-leeching method provided in the first aspect.

[0058] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the audio / video anti-leeching method provided in the first aspect.

[0059] The technical solutions provided by the embodiments of this application bring at least the following beneficial effects:

[0060] In this application, in response to a callback request from the Content Delivery Network (CDN) server, the image file to be inspected is obtained from the CDN server. Then, the header information, image content, and image source information of the image file are determined. The header information and / or the image content are parsed, and based on the parsing results, the embedded audio and video files in the image source information are determined. In summary, this application embodiment, by detecting and processing files related to novel video-to-image hotlinking scenarios, can accurately identify hotlinked audio and video files, ensuring processing efficiency, optimizing the handling of hotlinked files, and preventing accidental deletion even in cases of misidentification, thus improving the user experience.

[0061] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit the present invention. Based on common knowledge in the art, the above preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this application. Attached Figure Description

[0062] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 An exemplary illustration shows a flowchart of a method for verifying whether a file is an image using header byte verification, as provided in the embodiments of this application.

[0064] Figure 2 An exemplary schematic diagram illustrates the process by which malicious actors crack the aforementioned initial character verification method in the related technologies provided in the embodiments of this application;

[0065] Figure 3 The illustration shows a schematic diagram of an application scenario provided by an embodiment of this application;

[0066] Figure 4 An exemplary illustration shows a user obtaining audio and video files through a terminal device, as provided in an embodiment of this application.

[0067] Figure 5 An exemplary flowchart of a method for preventing audio and video hotlinking according to an embodiment of this application is shown;

[0068] Figure 6 An exemplary flowchart of step 603 provided in an embodiment of this application is shown;

[0069] Figure 7 An exemplary schematic diagram illustrates the overall process of an audio / video anti-leeching method provided in an embodiment of this application;

[0070] Figure 8 An exemplary schematic diagram of an audio / video anti-leeching device provided in an embodiment of this application is shown;

[0071] Figure 9 An exemplary schematic diagram of the server-side device provided in an embodiment of this application is shown;

[0072] Figure 10 An exemplary schematic diagram of the program product of the server device provided in an embodiment of this application is shown. Detailed Implementation

[0073] The principles and spirit of the invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0074] Those skilled in the art will recognize that embodiments of the present invention can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0075] According to an embodiment of the present invention, a method for preventing audio and video hotlinking is proposed.

[0076] In this article, it is important to understand that any number of elements in the accompanying figures is for illustrative purposes and not for limitation, and any naming is for distinction only and has no limiting meaning.

[0077] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments. Invention Overview

[0079] The following explains some of the terms that appear in the text:

[0080] CDN: CDN stands for Content Delivery Network. A CDN is an intelligent virtual network built on top of existing networks. Relying on edge servers deployed in various locations, it uses a central platform's load balancing, content distribution, and scheduling modules to allow users to access content from the nearest server, reducing network congestion and improving user access response speed and hit rate. The key technologies of CDN mainly include content storage and distribution technologies.

[0081] Hotlinking: Hotlinking refers to a service provider using technical means to bypass other profitable end-user interfaces (such as advertisements) and directly provide other service providers' content to end users on their own website, thereby deceiving end users into browsing and clicking. The beneficiary provides little or no resources, while the genuine service provider receives no revenue.

[0082] The applicant discovered that currently, because images are embedded as static resources in HTML pages, they are generally not subject to special anti-hotlinking measures. There are instances where malicious clients disguise audio and video files as images, splitting and compressing them into image files without modifying the image headers, and then uploading them to CDN servers. Since the platform server currently only verifies the header bytes when confirming the presence of image files on the CDN, there is a possibility that users can obtain permanently valid audio and video resources by combining the URLs of these image files.

[0083] Therefore, there is currently a process based on a callback after file upload, which verifies whether the file is an image, such as... Figure 1 As shown, this process checks whether a file is an image by verifying the header bytes, including the following steps:

[0084] 1. The client uploads the audio and video files to the corresponding CDN server.

[0085] 2. The CDN server returns a callback to the platform server indicating that the file has been received.

[0086] 3. The platform server obtains the uploaded file and performs a validity check (i.e., checks whether the file type is an image).

[0087] When a file is found to be invalid (i.e., the file is not an image), the platform server will clean up the file on the server.

[0088] The above Figure 1 The header verification method ensures that audio and video file resources can only be obtained through a URL address with authentication information sent by the platform server, and URL addresses without authentication information can only send image file resources. However, this application recently discovered that some malicious actors are forging audio and video files as images, splitting the audio and video files without modifying the image header bytes, and compressing them into image files. In actual use, these malicious actors will integrate the image URL addresses of the corresponding audio and video resource segments, reassemble them into a complete audio and video file resource, and provide it externally, thereby bypassing the aforementioned audio and video anti-leeching technology. Figure 2 The process by which cybercriminals crack the aforementioned initials verification method includes the following steps:

[0089] 1. Cybercriminals disguise audio and video files as image files and upload them to the corresponding CDN server.

[0090] 2. The black market sends the URL address corresponding to the hotlinked file to its clients.

[0091] 3. Black market clients obtain uploaded hotlinked files via URL addresses.

[0092] Therefore, through the above-described cracking process, there is a possibility that users can obtain permanently valid audio and video file resources by integrating the URLs of image files.

[0093] In view of this, embodiments of the present invention provide a method for preventing audio and video hotlinking. The inventive concept of this application can be summarized as follows: First, in response to a callback request from a Content Delivery Network (CDN) server, an image file to be inspected is obtained from the CDN server. Then, the header byte information, image content, and image source information of the image file to be inspected are determined. The header byte information and / or the image content are parsed, and based on the parsing results of the header byte information and / or the image content, the situation of the audio and video files embedded in the image source information is determined. In summary, embodiments of this application, by detecting and processing relevant files in novel hotlinking scenarios where videos are forged into images, can accurately identify audio and video files with hotlinking, ensure processing efficiency, optimize the processing scheme for hotlinked files, and prevent accidental deletion even if misidentified, thereby improving the user experience.

[0094] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention will be described in detail below.

[0095] Application Scenarios Overview

[0096] First refer to Figure 3 This is a schematic diagram illustrating an application scenario of an embodiment of the application. User 10 logs into network server 12 through a client installed on user device 11. The client can be a web browser or an application client installed on a mobile user device, such as a mobile phone or tablet computer.

[0097] User equipment 11 and network server 12 communicate via a network, which can be a local area network (LAN), a wide area network (WAN), etc. User equipment 11 can be a portable device (e.g., mobile phone, tablet, laptop, etc.) or a personal computer (PC). Network server 12 can be any device capable of providing internet services.

[0098] In this embodiment, the network server 12 uses the audio and video anti-leeching method provided in this application to pre-configure the key and the expiration time timestamp to the platform server (not shown in the figure). When the application client requests the URL address of the audio and video file, the network server 12 encrypts the URL address using the key and timestamp. The client uses the encrypted URL address to request the corresponding audio and video file resource from the CDN server (not shown in the figure). The CDN verifies the legality of the URL address. After the verification is successful, it returns the audio and video file resource to the client and displays it to the user 10.

[0099] In this embodiment, the network server 12 uses the audio and video anti-hotlinking method provided in this embodiment to overcome the hotlinking technology of disguising audio and video files as images in related technologies. The following is a detailed description in conjunction with specific embodiments.

[0100] The following is combined with Figure 3 Application scenarios, refer to Figure 5 This application describes a method for preventing audio and video hotlinking according to exemplary embodiments. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way. Rather, the embodiments of this application can be applied to any scenario in which they are used.

[0101] Exemplary methods

[0102] refer to Figure 4 This is a schematic diagram illustrating how a user obtains audio and video files through a terminal device, as provided in an embodiment of this application, including the following steps:

[0103] 1. The network configures the URL address on both the platform server and the CDN server. The network side pre-configures the key and expiration time timestamp on the platform server. When a client requests the URL address of an audio or video file, the platform server encrypts the URL address using the key and timestamp.

[0104] 2. Client (as described above) Figure 1 The terminal device in the process requests the URL address corresponding to the audio and video file from the platform server. After obtaining the URL address corresponding to the audio and video file, it performs the following step 3.

[0105] 3. The client sends the URL address corresponding to the audio / video file to the CDN server. That is, the client uses the encrypted URL address to request the corresponding audio / video file resource from the CDN server.

[0106] Finally, the CDN verifies the validity of the URL address. Once the verification is successful, it returns the audio and video file resources to the client.

[0107] In view of this, this application provides a method for preventing audio and video hotlinking, which overcomes the hotlinking technology in related technologies that disguises audio and video files as images. The following is a detailed description with reference to specific embodiments:

[0108] like Figure 5 The diagram shown is a flowchart of an audio / video anti-leeching method provided in an embodiment of this application, applied to a platform server. The process includes the following steps:

[0109] In step 501, in response to a callback request from the Content Delivery Network (CDN) server, the image file to be tested is obtained from the CDN server.

[0110] The platform server generates a callback request to the CDN server based on the client's instructions. When the client requests to download an image file, it determines the request address of the image file to be verified based on the callback request, and retrieves the image file from the CDN server based on the request address as the image file to be verified.

[0111] In step 502, the header byte information, image content, and image source information of the image file to be inspected are determined.

[0112] Image files can be parsed to extract three parts: header information, image content, and image source information. The header information indicates the file type, the image content includes the pixel content, and the image source information includes file attributes such as creation date, size, and name.

[0113] In step 503, the header byte information and / or image content are parsed, and based on the parsing results of the header byte information and / or image content, the status of the audio and video files embedded in the image source information is determined. This embodiment of the application, by detecting and processing related files in novel video-to-image hotlinking scenarios, can accurately identify hotlinked audio and video files, ensuring processing efficiency, optimizing the handling scheme for hotlinked files, and preventing accidental deletion even in cases of misidentification, thus improving the user experience.

[0114] In one possible implementation, determining the presence of embedded audio / video files in the image source information based on the parsing results of the header bytes includes:

[0115] In response to determining from the header byte information that the image file to be verified is not an image file type, it is determined that there are embedded audio or video files in the image source information.

[0116] The file type can be determined by the header bytes. If the file type is not an image file, it indicates that the file has been tampered with. This application embodiment determines that there are embedded audio or video files in the image source information. When determining that the image file to be verified is an image file type, one possible approach is to verify the legitimacy of file A from the header bytes. However, due to the ability of related hotlinking technologies to compress video resources into images, the size of the image file will inevitably increase. Based on the above conclusions, this application embodiment optimizes and upgrades the verification of image files. Specifically, a judgment strategy is added, one of which is to parse the image content, including the following:

[0117] In one possible implementation, the parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution;

[0118] Based on the parsing results of the image content, determine the situation of embedded audio and video files in the image source information, including determining that there are embedded audio and video files in the image source information when the size of the image file is larger than the normal file size and the difference between the two exceeds a preset threshold.

[0119] For example, if the width and height of an image are within 0 to 100 pixels, the corresponding normal image file size is 400KB. However, if the image file size exceeds 500KB, the difference between the image file size and the normal file size is more than 100KB, and the difference accounts for more than 25% of the normal image file size, exceeding the preset threshold of 20%, then this embodiment of the application considers the image file to be a hotlinked image file, that is, it is determined that there are embedded audio and video files in the image source information.

[0120] Based on the first judgment strategy described above, this application embodiment can filter out most hotlinked files, but some hotlinked audio and video files disguised as high-resolution images will still be detected. The vulnerability exploited by these hotlinked audio and video files is the generation of a high-resolution image with an extremely simple pattern. Because image file encoding formats compress consecutive identical pixels, although the image file resolution is high, the actual image size is not large; for example, an 800*800 pixel pure white image might only be 200KB in size. In related technologies, cybercriminals can then compress the video file into an image, achieving the effect of disguising the same audio and video file as an image.

[0121] To address the issue of audio and video files being disguised as images, this application also provides a second judgment strategy: transcoding the image and determining whether the file is a hotlinked file based on a comparison of the file sizes before and after transcoding.

[0122] In one possible implementation, in step 503, the header byte information and / or image content are parsed, and based on the parsing results of the header byte information and / or image content, the audio and video files embedded in the image source information are determined. The flowchart is as follows: Figure 6 As shown, it includes the following:

[0123] In step 601, the image file to be verified is transcoded to extract the header bytes and valid content (excluding blank areas) from the image file to obtain the transcoded file.

[0124] In step 602, in response to the difference between the size of the transcoded file and the size of the image file to be verified exceeding a set difference level, it is determined that there are embedded audio and video files in the image source information.

[0125] In one possible implementation, in step 602, when the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio / video files in the image source information, including the following:

[0126] If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

[0127] For example, when converting a PNG image file to a JPG image file, this embodiment of the application only retains information related to image display (such as the image's dimensions and pixel count) during the transcoding process, while removing all other useless information. By comparing the file sizes before and after transcoding, if it is determined that the transcoded file is significantly smaller than the original file—for example, the transcoded file is only 1 / 5 or 1 / 10 of the original—then the file is marked as a suspected hotlinked file, indicating that embedded audio or video files exist in the image source information.

[0128] In one possible implementation, to better address the problem of audio / video files being disguised as images, this application combines three methods to combat hotlinking: header byte verification, image content parsing, and image transcoding. Step 503 can then be executed as follows: parsing the header byte information and image content, and determining the audio / video file embedded in the image source information based on the parsing results. The overall flowchart is as follows: Figure 7 As shown, it specifically includes the following:

[0129] In step 701, in response to determining from the header byte information that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

[0130] In step 702, otherwise, parse the image content to determine the resolution and the normal file size corresponding to the resolution.

[0131] In step 703, in response to the image file size being larger than the normal file size and the difference between the two exceeding a preset threshold, it is determined that there is an embedded audio or video file in the image source information.

[0132] In step 704, otherwise, the image file to be verified is transcoded to extract the header bytes and valid content (excluding blank areas) from the image file to be verified, thus obtaining the transcoded file.

[0133] In step 705, if the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, it is determined that there are embedded audio and video files in the image source information.

[0134] For example, after the platform server obtains the image file to be inspected from the CDN server, it determines the header information, image content, and image source information of the image file. First, in this embodiment, the image file to be inspected undergoes header verification. If the header information determines that the image file is not an image file type (e.g., it is a video file), then it is determined that there is an embedded audio / video file in the image source information. Otherwise, the second step is executed: parsing the image content to determine the resolution and the corresponding normal file size. If the image file size is larger than the normal file size and the difference exceeds a preset threshold (e.g., the image's width and height are within 0-100 pixels, corresponding to a normal image file size of 400KB, but the image file size exceeds 500KB, the difference between the image file size and the normal file size is more than 100KB), then... If the value exceeds 25% of the normal image file size, surpassing the preset threshold of 20%, then the image source information is determined to contain embedded audio / video files. Otherwise, the third step is executed: transcoding the image file to be verified, extracting the header bytes and valid content (excluding blank areas) from the image file to obtain the transcoded file. If the size difference between the transcoded file and the image file to be verified exceeds a set difference threshold (e.g., when converting a PNG image file to a JPG file, if the difference between the transcoded file and the original file is 4 / 5 or 9 / 10, exceeding the set difference threshold of 1 / 2), then the image source information is determined to contain embedded audio / video files. This three-step audio / video hotlinking prevention method can more accurately identify hotlinked audio / video files, ensuring processing efficiency and a good user experience.

[0135] In one possible implementation, if the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is larger than the normal file size and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified. In this way, the client will not be able to request the corresponding hotlinked file.

[0136] Because some files are identified as fraudulent hotlinked files through header byte verification, and some files are misidentified as hotlinked files due to verification methods that compare image resolution or size before and after transcoding—for example, a normal image file might be misidentified as a hotlinked file because its file size is too large due to excessive metadata—this application embodiment instructs the CDN server to back up the image files to be verified to the corresponding server before deleting the stored image files to be verified. This avoids the loss of related files and ensures a good user experience.

[0137] In one possible implementation, when the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, this embodiment of the application sends the transcoded file to the CDN server and instructs the CDN server to replace the image file to be verified with the transcoded file. That is, the image marked as a suspected hotlinked file is replaced with the transcoded file. Since the transcoded file does not contain image source information, the client obtains the normal image file, preventing the client from obtaining a hotlinked file.

[0138] In summary, this application embodiment, by detecting and processing relevant files in novel video-to-image hotlinking scenarios, can accurately identify audio and video files with hotlinking, ensure processing efficiency, optimize the processing scheme for hotlinked files, and prevent accidental deletion even in case of misidentification, thereby improving the user experience.

[0139] Exemplary device

[0140] Having described the exemplary embodiments of this application, the device for audio and video anti-leeching according to the exemplary embodiments of this application will now be described with reference to FIG. 8.

[0141] like Figure 8 As shown, based on the same inventive concept, this application also provides an audio / video anti-leeching device, applied to a platform server, the device 800 comprising:

[0142] The image file acquisition module 801 is configured to acquire the image file to be verified from the CDN server in response to a callback request from the CDN server.

[0143] The image file information determination module 802 is configured to determine the header byte information, image content, and image source information of the image file to be inspected.

[0144] The image file parsing module 803 is configured to parse the header byte information and / or the image content, and determine the audio and video files embedded in the image source information based on the parsing results of the header byte information and / or the image content.

[0145] In one possible implementation, if the image source information is determined to contain embedded audio or video files based on the parsing result of the header bytes, the image file parsing module is configured to:

[0146] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

[0147] In one possible implementation, the parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution;

[0148] The image file parsing module is configured to determine the embedded audio / video files in the image source information based on the parsing results of the image content.

[0149] In response to the image file being larger than the normal file size and the difference between the two exceeding a preset threshold, it is determined that the image source information contains an embedded audio or video file.

[0150] In one possible implementation, the image file parsing module is configured to: parse the header byte information and / or the image content, and determine the audio / video files embedded in the image source information based on the parsing results of the header byte information and / or the image content.

[0151] The image file to be verified is transcoded to extract the header bytes and the valid content of the image content excluding blank areas, thus obtaining the transcoded file.

[0152] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0153] In one possible implementation, when the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, it is determined that there is an embedded audio or video file in the image source information, and the image file parsing module is configured as follows:

[0154] If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

[0155] In one possible implementation, the process of parsing the header byte information and the image content is performed, and the status of the audio / video files embedded in the image source information is determined based on the parsing results of the header byte information and the image content. The image file parsing module is configured as follows:

[0156] In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information;

[0157] Otherwise, the image content is analyzed to determine the resolution and the normal file size corresponding to the resolution;

[0158] In response to the fact that the size of the image file is greater than the size of the normal file and the difference between the two exceeds a preset threshold, it is determined that there is an embedded audio or video file in the image source information;

[0159] Otherwise, by transcoding the image file to be verified, the header bytes and valid content (excluding blank areas) of the image file are extracted to obtain the transcoded file.

[0160] If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

[0161] In one possible implementation, the image file parsing module is further configured to:

[0162] If the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is greater than the size of the normal file and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified.

[0163] In one possible implementation, the image file parsing module is further configured to:

[0164] When it is determined that the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, the transcoded file is sent to the CDN server, and the CDN server is instructed to replace the image file to be verified with the transcoded file.

[0165] The following reference Figure 9 To describe the server device 130 according to this embodiment of the present application. Figure 9 The server device 130 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0166] like Figure 9 As shown, the server device 130 can be manifested as a general-purpose computing device, such as a terminal device. The components of the server device 130 may include, but are not limited to: at least one processing unit 131, at least one storage unit 132, and a bus 133 connecting different system components (including storage unit 132 and processing unit 131).

[0167] Bus 133 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or local bus using any of the various bus structures.

[0168] Storage unit 132 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 1321 and / or cache memory 1322, and may further include read-only memory (ROM) 1323.

[0169] Storage unit 132 may also include a program / utility 1325 having a set (at least one) of program modules 1324, such program modules 1324 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0170] Server device 130 can also communicate with one or more external devices 134 (e.g., keyboard, pointing device, etc.), one or more devices that enable users to interact with server device 130, and / or any device that enables server device 130 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 135. Furthermore, server device 130 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 136. As shown, network adapter 136 communicates with other modules of server device 130 via bus 133. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with server device 130, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0171] Exemplary program product

[0172] In some possible implementations, various aspects of this application can also be implemented as a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps of each module in the audio / video anti-leeching device according to various exemplary embodiments of this application described in the "Exemplary Methods" section above. For example, the terminal device can execute actions in response to a callback request from a Content Delivery Network (CDN) server to obtain an image file to be inspected from the CDN server; determine the header byte information, image content, and image source information of the image file to be inspected; parse the header byte information and / or the image content; and determine the audio / video file embedded in the image source information based on the parsing result of the header byte information and / or the image content.

[0173] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0174] like Figure 10 As shown, a program product 160 for inventory supply chain management according to an embodiment of the present invention is described. This product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0175] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take many forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0176] The program code contained on the readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wired, fiber optic, RF, etc., or any suitable combination thereof.

[0177] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0178] It should be noted that although several modules or sub-modules of the system have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided and embodied by multiple modules.

[0179] Furthermore, although the operation of the modules of the system of the present invention is described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain operations may be omitted, multiple operations may be combined into one operation, and / or one operation may be broken down into multiple operations.

[0180] While the spirit and principles of the invention have been described with reference to several specific embodiments, it should be understood that the invention is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for ease of description. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims

1. A method for preventing audio and video hotlinking, characterized in that, Applied to the platform server, the method includes: In response to a callback request from the Content Delivery Network (CDN) server, the image file to be verified is obtained from the CDN server. Determine the header byte information, image content, and image source information of the image file to be verified; The header byte information and the image content are parsed, and the audio and video files embedded in the image source information are determined based on the parsing results of the header byte information and the image content. The process of parsing the header byte information and the image content, and determining the audio / video files embedded in the image source information based on the parsing results, includes: The image file to be verified is transcoded to extract the header bytes and the valid content of the image content excluding blank areas, thus obtaining the transcoded file. If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

2. The method according to claim 1, characterized in that, Based on the parsing result of the header bytes, determining the presence of embedded audio / video files in the image source information further includes: In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

3. The method according to claim 1, characterized in that, The parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution; Based on the parsing results of the image content, determining the audio and video files embedded in the image source information further includes: In response to the image file being larger than the normal file size and the difference between the two exceeding a preset threshold, it is determined that there is an embedded audio or video file in the image source information.

4. The method according to claim 1, characterized in that, When the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, it is determined that the image source information contains embedded audio or video files, including: If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

5. The method according to claim 1, characterized in that, Before transcoding the image file to be verified, extracting the header bytes and valid content (excluding blank areas) from the image content, and obtaining the transcoded file, the process also includes: In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information; Otherwise, the image content is analyzed to determine the resolution and the normal file size corresponding to the resolution; The size of the image file is determined to be no greater than the size of the normal file, or the difference between the two does not exceed a preset threshold.

6. The method according to claim 5, characterized in that, Also includes: If the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is greater than the size of the normal file and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified.

7. The method according to claim 1, 4, or 5, characterized in that, Also includes: When it is determined that the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, the transcoded file is sent to the CDN server, and the CDN server is instructed to replace the image file to be verified with the transcoded file.

8. A device for preventing audio and video hotlinking, characterized in that, The device, applied to the platform server, includes: The image file acquisition module is configured to obtain the image file to be verified from the CDN server in response to a callback request from the CDN server. The image file information determination module is configured to determine the header byte information, image content, and image source information of the image file to be verified. The image file parsing module is configured to parse the header byte information and the image content, and determine the audio and video files embedded in the image source information based on the parsing results of the header byte information and the image content. The image file parsing module is configured to: parse the header byte information and the image content, and determine the audio / video files embedded in the image source information based on the parsing results. The image file to be verified is transcoded to extract the header bytes and the valid content of the image content excluding blank areas, thus obtaining the transcoded file. If the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, it is determined that there are embedded audio or video files in the image source information.

9. The apparatus according to claim 8, characterized in that, Based on the parsing result of the header bytes, if it is determined that there are embedded audio or video files in the image source information, the image file parsing module is further configured to: In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information.

10. The apparatus according to claim 8, characterized in that, The parsing result of the image content includes the size of the image file, the resolution of the image, and the normal file size corresponding to the resolution; Based on the parsing results of the image content, the module determines the audio and video files embedded in the image source information. The image file parsing module is further configured to: In response to the image file being larger than the normal file size and the difference between the two exceeding a preset threshold, it is determined that there is an embedded audio or video file in the image source information.

11. The apparatus according to claim 8, characterized in that, When the difference between the size of the transcoded file and the size of the image file to be verified exceeds a set difference level, it is determined that there are embedded audio / video files in the image source information, and the image file parsing module is configured as follows: If the ratio of the size of the transcoded file to the size of the image file to be verified is less than a set percentage value, it is determined that there are embedded audio and video files in the image source information.

12. The apparatus according to claim 8, characterized in that, Before performing transcoding on the image file to be verified, extracting the header bytes and valid content (excluding blank areas) from the image content, and obtaining the transcoded file, the image file parsing module is further configured as follows: In response to determining, based on the header byte information, that the image file to be verified is not an image file type, it is determined that there is an embedded audio or video file in the image source information; Otherwise, the image content is analyzed to determine the resolution and the normal file size corresponding to the resolution; The size of the image file is determined to be no greater than the size of the normal file, or the difference between the two does not exceed a preset threshold.

13. The apparatus according to claim 12, characterized in that, The image file parsing module is also configured to: If the header bytes determine that the image file to be verified is not an image file type, or if the size of the image file to be verified is greater than the size of the normal file and the difference exceeds a preset threshold, the CDN server is instructed to back up the image file to be verified to the corresponding server and then delete the stored image file to be verified.

14. The apparatus according to claim 8, 11 or 12, characterized in that, The image file parsing module is also configured to: When it is determined that the size of the transcoded file differs from the size of the image file to be verified by more than a set difference level, the transcoded file is sent to the CDN server, and the CDN server is instructed to replace the image file to be verified with the transcoded file.

15. A server-side device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the audio / video anti-leeching method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • IS4 software feature-based hidden information detection and extraction method

    CN106845242A

  • Tamper-proof video generation method and device, electronic equipment and readable medium

    CN113613015A