Webpage tampering detection method and device based on block chain technology and storage medium

By recording the digital fingerprint and key information of web pages on the blockchain, using its decentralized and immutable characteristics, the single point of failure and data tampering risks of traditional web page tamper detection methods are solved, and efficient web page integrity verification and Security monitoring enhances the credibility and security of the network environment.

CN119312413APending Publication Date: 2025-01-14BEIJING AN XIN TIAN XING TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411446247.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Traditional web page tamper detection methods have single point of failure, data tampering risks and dependence on user credibility, and cannot effectively ensure network security.

Method used

Using a web page tamper detection method based on blockchain technology, the digital fingerprint and key information of web pages are recorded on the blockchain, and the decentralized, immutable and distributed characteristics can be used to achieve efficient verification and security monitoring of web page integrity. , including initializing distributed storage nodes, data collection, hashing operations, transaction construction and block construction, ensuring the immutability and credibility of data.

Benefits of technology

Effectively prevent data tampering and forgery, enhance the immutability and credibility of web page data, reduce system operation and maintenance costs, and improve the effectiveness and reliability of web page integrity verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312413A_ABST
    Figure CN119312413A_ABST
Patent Text Reader

Abstract

The invention relates to a webpage tampering detection method based on a block chain technology, and the method comprises the steps: S1, initializing distributed storage nodes, synchronizing block chain data between different storage nodes, and verifying the data integrity and legality of a newly added node; s2, carrying out data acquisition on a webpage to be detected, and representing the content of the webpage to be detected as a computable data structure; s3, performing hash operation on the data structure to generate a unique digital fingerprint; s4, constructing a transaction by using the digital fingerprint, and performing propagation and verification; s5, constructing a new block, and performing broadcasting and verification; and S6, regularly verifying the record on the block chain according to requirements to determine whether the webpage is tampered or not. The invention further provides a webpage tampering detection device based on the block chain technology and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network security technology, and in particular to a web page tampering detection method, device and storage medium based on blockchain technology. Background Art

[0002] In today's digital age, the Internet has become the main channel for people to obtain information, communicate and conduct business. However, with the popularization and widespread application of the Internet, security issues such as web page tampering have become increasingly prominent. Web page tampering refers to the unauthorized modification or manipulation of web page content, which may threaten network security, bring adverse effects to users, and even damage the legitimate rights and interests of users.

[0003] In order to deal with security threats such as web page tampering, various technologies and methods for web page integrity verification and tampering detection have been proposed. Traditional web page tampering detection methods mainly rely on server-side digital signatures and hash verification technologies. However, these methods have problems such as single point failure, data tampering risks, and reliance on user credibility.

[0004] With the rise and development of blockchain technology, people have begun to explore the application of blockchain in the field of web page integrity verification and tampering detection. As a distributed, tamper-proof, decentralized data storage and sharing technology, blockchain has natural tamper-proof and decentralized characteristics, which can effectively solve the security risks and credibility issues of traditional web page tampering detection methods. The web page tampering detection method based on blockchain technology achieves efficient verification and reliable monitoring of web page integrity by recording the digital fingerprint and other key information of the web page on the blockchain, providing users with a more secure and reliable network environment.

[0005] Therefore, the present invention aims to propose a web page tampering detection method based on blockchain technology, which can realize efficient verification and security monitoring of web page integrity by utilizing the decentralized, tamper-proof and distributed characteristics of blockchain, provide users with a more secure and reliable network environment, and promote the development and progress of Internet information security.

[0006] The information disclosed in this background technology section is only intended to deepen the understanding of the overall background technology of the present invention, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art already known to those skilled in the art. Summary of the invention

[0007] The purpose of the present invention is to provide a web page tampering detection method, device and storage medium based on blockchain technology to solve the problems existing in the prior art.

[0008] In order to achieve the above object, the present invention provides a webpage tampering detection method based on blockchain technology, the method comprising:

[0009] S1: Initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes;

[0010] S2: Collect data on the web page to be detected and represent its content as a computable data structure;

[0011] S3: Hash the data structure to generate a unique digital fingerprint;

[0012] S4: Use digital fingerprints to construct transactions and propagate and verify them;

[0013] S5: Build a new block and broadcast and verify it;

[0014] S6: Regularly verify the records on the blockchain as needed to determine whether the web page has been tampered with.

[0015] Furthermore, initializing the distributed storage nodes in S1 includes:

[0016] S11 Initialize node N i Generate a public key and a private key pair (K pub ,K priv );

[0017] S12 Node N i Receive the latest blockchain data B1, B2, …, B through communication with existing network nodes n ;

[0018] S13 Node N i Verify the received blockchain data and calculate the hash value H(B j )=SHA256(B j ) and compare it with the hash value provided by the existing network nodes. H(Bj) is the hash value of the jth block;

[0019] S14 If the hash values ​​are equal, the verification is successful, and node N i It is regarded as a legitimate node and added to the distributed storage network.

[0020] Furthermore, the synchronized blockchain data in S1 uses the following formula:

[0021]

[0022] Identify all satisfaction The blocks of the condition are equal, that is That is, the node data is synchronized;

[0023] in, Represents node N i The j-th block on Represents node N k The j-th block on Representation block The hash value of Representation block The hash value of .

[0024] Furthermore, the data collection described in S2 includes:

[0025] S21 uses the web page parser BeautifulSoup to parse the web page source code, identify and extract the elements in it, including text, images, and script elements;

[0026] S22 cleans the extracted text, removes tags, special characters and punctuation marks, and retains the plain text content;

[0027] S23 uses the image processing library OpenCV to identify and extract image elements from web pages, converts the extracted images into Base64 encoding, and records their names, sizes, and format information;

[0028] S24 extracts script data by parsing the script tag in the webpage source code and executing JavaScript code;

[0029] S25 saves the normalized text information, image transcoding information, and script data in the form of byte streams, and uses compression technology to reduce the number of bytes stored.

[0030] Furthermore, the hash operation on the data structure described in S3 is performed using the SHA256 hash function.

[0031] Furthermore, the construction transaction described in S4 includes:

[0032] S41: Create a new transaction. The necessary information includes the digital fingerprint of the web page, the sender address, and the receiver address. The digital fingerprint has been calculated in step S3. Other key information includes the URL and timestamp. Other key information is provided by the relevant metadata of the initialized blockchain.

[0033] S42: Use SHA256 to perform hash operation on the transaction content to generate a transaction summary H(P);

[0034] S43: Digital Signature Authentication: Digitally sign the constructed blocks to ensure the credibility of their source.

[0035] Furthermore, the digital signature is usually composed of a private key Kpriv The digital signature is generated by signing the transaction summary. The digital signature formula is as follows:

[0036] T=Sign priv (H(P))

[0037] Among them, T represents the generated transaction, Sign priv (·) indicates a digital signature operation using a private key;

[0038] Furthermore, the transaction and broadcast described in S4 means that the signed transaction is broadcast to all nodes in the blockchain network via the P2P network, the transaction includes the signature, and each node in the network uses the public key K pub The signature is verified to confirm the authenticity and integrity of the transaction.

[0039] Further, the use of the public key K described in S4 pub To verify the signature, the public key K is used for transaction verification. pub To verify the digital signature, ensure that the transaction has not been tampered with and is initiated by the legitimate private key holder. The formula is as follows:

[0040] Verify(K pub ,T,H(P))

[0041] Among them, K pub is the public key, T is the digital signature, H(P) is the transaction summary, and Verify is the elliptic curve digital signature algorithm ECDSA;

[0042] After successful verification, the transaction will be placed in the transaction pool, waiting to be packaged into the block.

[0043] Furthermore, constructing a new block in S5 includes:

[0044] S51: Get the hash value of the latest block from the current blockchain state;

[0045] S52: Select a group of transactions from those placed in the transaction pool;

[0046] S53: Creating a Merkle tree, including the following steps:

[0047] M1: Calculate transaction hash value: For each transaction, use SHA256 to calculate its hash value;

[0048] M2: Create a Merkle tree: organize the hash values ​​of all transactions according to the binary tree structure to generate a Merkle root;

[0049] S54: Create a block header: The block header mainly includes the hash value of the latest block in the blockchain, the Merkle root of the current block and the timestamp. The creation process formula is as follows:

[0050] BlockHeader=SHA256(MerkleRoot+Timestamp)

[0051] Among them, BlockHeader is the generated block header, MerkleRoot is the generated Merkle root, and Timestamp is the timestamp;

[0052] S55: Organize the verified transactions, Merkle root, and block header information together to form a complete block in JSON format.

[0053] Furthermore, constructing a new block and broadcasting it in S5 means: broadcasting the new block to other nodes in the blockchain through the P2P network, using asynchronous broadcasting until all participating nodes receive the new block.

[0054] Furthermore, the verification described in S5 is that after the new block is built, it is broadcasted and needs to be verified and accepted by other nodes in the cluster, including:

[0055] C1: Check the contents of the block header, including the hash value, timestamp, and Merkle root of the latest block in the blockchain;

[0056] C2: Verify the legitimacy of transactions in the block, including the validity of transaction signatures and the correctness of transaction formats;

[0057] C3: Verify whether the conditions required by the consensus protocol are met. The consensus protocol specifically refers to the PoA consensus mechanism. The authoritative node is implemented through identity authentication. The authoritative node has the right to create a new block, which is more suitable for scenarios with high performance and low resource consumption requirements;

[0058] Once a block is verified and added to the blockchain, it will be permanently recorded and accepted by all nodes. The consistency of the blockchain network ensures that the block cannot be tampered with, ensuring the security and credibility of the record.

[0059] The authoritative nodes are a group of pre-authorized nodes.

[0060] Furthermore, the verification described in S6 refers to the verification of whether the existing webpage has been tampered with, that is, whether there is a difference between the data fingerprint of the current webpage and the fingerprint recorded in the blockchain, including:

[0061] S61 obtains the latest record on the blockchain and verifies its integrity and validity;

[0062] S62 checks whether the order of the recorded timestamps is correct;

[0063] S63 checks whether the digital fingerprint in the record matches the digital fingerprint of the current web page to determine whether there is any tampering.

[0064] Furthermore, the checking whether the digital fingerprint in the record matches the digital fingerprint of the current web page is performed by comparing the difference between the web pages P and P′, using the following formula:

[0065]

[0066] Among them, D(p,p ′ ) represents the difference between web pages P and P′, 0 means no tampering, and 1 means tampering.

[0067] The present invention also provides a webpage tampering detection device based on blockchain technology, the detection device comprising:

[0068] Create a blockchain distributed storage node module to initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes;

[0069] A web page data collection module is used to collect data from the web page to be detected and represent its content as a computable data structure;

[0070] A digital fingerprint generation module is used to perform a hash operation on the data structure to generate a unique digital fingerprint;

[0071] Build transaction and broadcast and verify module, which is used to build transaction using digital fingerprint and broadcast and verify;

[0072] Build new blocks and broadcast and verify the module, which is used to build new blocks and broadcast and verify them;

[0073] The module for regularly judging whether a webpage has been tampered with is used to regularly verify the records on the blockchain as needed to determine whether the webpage has been tampered with.

[0074] The present invention also provides a computer-readable storage medium, which stores computer program instructions. When the computer program instructions are executed by a computer, the computer executes the steps of any of the above-mentioned methods for detecting web page tampering based on blockchain technology.

[0075] By adopting the above technical solution, the present invention has the following beneficial effects:

[0076] Traditional web page tampering detection methods rely on a single server-side verification or digital signature technology, which is vulnerable to single point failure and data tampering risks. The present invention uses the decentralized and tamper-proof characteristics of blockchain technology to record the digital fingerprint and key information of the web page in a distributed blockchain network, effectively preventing data tampering and forgery. Even if a record on the blockchain is tampered with, it cannot pass the verification of a single node, thereby enhancing the tamper-proofness and credibility of web page data and improving the effectiveness and reliability of web page integrity verification.

[0077] Traditional web page tampering detection methods usually require the establishment of a dedicated server-side verification system or rely on a third-party digital signature service, which requires a lot of operation and maintenance costs. The web page tampering detection method based on blockchain technology of the present invention utilizes the decentralized and autonomous characteristics of blockchain, and does not require the establishment of an additional centralized verification system, nor does it need to rely on a third-party digital signature service. The digital fingerprint recording and verification of the web page is completely automatically completed by the blockchain network, which greatly reduces the operating and maintenance costs of the system and improves the sustainability and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0079] Figure 1 This is a flow chart of the webpage tampering detection method based on blockchain technology of the present invention;

[0080] Figure 2 This is a flow chart of initializing distributed storage nodes of the present invention;

[0081] Figure 3 A flow chart of data collection of the present invention;

[0082] Figure 4 A flow chart for constructing transactions for the present invention;

[0083] Figure 5 A flowchart for constructing a new block for the present invention;

[0084] Figure 6 A flow chart of the present invention for verifying whether an existing web page has been tampered with;

[0085] Figure 7 Schematic diagram of a web page tampering detection device based on blockchain technology of the present invention. DETAILED DESCRIPTION

[0086] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0087] Combination Figure 1 As shown, a webpage tampering detection method based on blockchain technology includes:

[0088] S1: Initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes;

[0089] S2: Collect data on the web page to be detected and represent its content as a computable data structure;

[0090] S3: Hash the data structure to generate a unique digital fingerprint;

[0091] S4: Use digital fingerprints to construct transactions and propagate and verify them;

[0092] S5: Build a new block and broadcast and verify it;

[0093] S6: Regularly verify the records on the blockchain as needed to determine whether the web page has been tampered with.

[0094] Specifically, see Figure 2 As shown, the initialization distributed storage nodes in S1 include:

[0095] S11 Initialize node N i Generate a public key and a private key pair (K pub ,K priv );

[0096] S12 Node N i Receive the latest blockchain data B1, B2, …, B through communication with existing network nodes n ;

[0097] S13 Node N i Verify the received blockchain data and calculate the hash value H(B j )=SHA256(B j ) and compare it with the hash value provided by the existing network nodes. H(Bj) is the hash value of the jth block;

[0098] S14 If the hash values ​​are equal, the verification is successful, and node N iIt is regarded as a legitimate node and added to the distributed storage network.

[0099] Specifically, the synchronized blockchain data in S1 uses the following formula:

[0100]

[0101] Identify all satisfaction The blocks of the condition are equal, that is That is, the node data is synchronized;

[0102] in, Represents node N i The j-th block on Represents node N k The j-th block on Representation block The hash value of Representation block The hash value of .

[0103] Specifically, see Figure 3 As shown, the data collection described in S2 includes:

[0104] S21 uses the web page parser BeautifulSoup to parse the web page source code, identify and extract the elements in it, including text, images, and script elements;

[0105] S22 cleans the extracted text, removes tags, special characters and punctuation marks, and retains the plain text content;

[0106] S23 uses the image processing library OpenCV to identify and extract image elements from web pages, converts the extracted images into Base64 encoding, and records their names, sizes, and format information;

[0107] S24 extracts script data by parsing the script tag in the webpage source code and executing JavaScript code;

[0108] S25 saves the normalized text information, image transcoding information, and script data in the form of byte streams, and uses compression technology to reduce the number of bytes stored.

[0109] Specifically, the hash operation of the data structure described in S3 is performed using the SHA256 hash function.

[0110] Specifically, see Figure 4 As shown, the construction transaction described in S4 includes:

[0111] S41: Create a new transaction. The necessary information includes the digital fingerprint of the web page, the sender address, and the receiver address. The digital fingerprint has been calculated in step S3. Other key information includes the URL and timestamp. Other key information is provided by the relevant metadata of the initialized blockchain.

[0112] S42: Use SHA256 to perform hash operation on the transaction content to generate a transaction summary H(P);

[0113] S43: Digital Signature Authentication: Digitally sign the constructed blocks to ensure the credibility of their source.

[0114] Metadata refers to data that manages data. The metadata of blockchain includes the number of clusters, IP addresses of cluster nodes, network type, port information, etc.

[0115] Specifically, the digital signature is usually generated by a private key K priv The digital signature is generated by signing the transaction summary. The digital signature formula is as follows:

[0116] T=Sign priv (H(P))

[0117] Among them, T represents the generated transaction, Sign priv (·) indicates a digital signature operation using a private key;

[0118] Specifically, the transaction and broadcast described in S4 means that the signed transaction is broadcast to all nodes in the blockchain network via the P2P network. The transaction includes a signature, and each node in the network uses the public key K pub The signature is verified to confirm the authenticity and integrity of the transaction.

[0119] Specifically, the public key K described in S4 is used pub To verify the signature, the public key K is used for transaction verification. pub To verify the digital signature, ensure that the transaction has not been tampered with and is initiated by the legitimate private key holder. The formula is as follows:

[0120] Verify(K pub ,T,H(P))

[0121] Among them, K pub is the public key, T is the digital signature, H(P) is the transaction summary, and Verify is the elliptic curve digital signature algorithm ECDSA;

[0122] After successful verification, the transaction will be placed in the transaction pool, waiting to be packaged into the block.

[0123] Specifically, see Figure 5 As shown, constructing a new block as described in S5 includes:

[0124] S51: Get the hash value of the latest block from the current blockchain state;

[0125] S52: Select a group of transactions from those placed in the transaction pool;

[0126] S53: Creating a Merkle tree, including the following steps:

[0127] M1: Calculate transaction hash value: For each transaction, use SHA256 to calculate its hash value;

[0128] M2: Create a Merkle tree: organize the hash values ​​of all transactions according to the binary tree structure to generate a Merkle root;

[0129] S54: Create a block header: The block header mainly includes the hash value of the latest block in the blockchain, the Merkle root of the current block and the timestamp. The creation process formula is as follows:

[0130] BlockHeader=SHA256(MerkleRoot+Timestamp)

[0131] Among them, BlockHeader is the generated block header, MerkleRoot is the generated Merkle root, and Timestamp is the timestamp;

[0132] S55: Organize the verified transactions, Merkle root, and block header information together to form a complete block in JSON format.

[0133] Specifically, constructing a new block and broadcasting it in S5 means: broadcasting the new block to other nodes in the blockchain through the P2P network, using asynchronous broadcasting until all participating nodes receive the new block.

[0134] Specifically, the verification described in S5 is that after the new block is built, it is broadcasted and needs to be verified and accepted by other nodes in the cluster, including:

[0135] C1: Check the contents of the block header, including the hash value, timestamp, and Merkle root of the latest block in the blockchain;

[0136] C2: Verify the legitimacy of transactions in the block, including the validity of transaction signatures and the correctness of transaction formats;

[0137] C3: Verify whether the conditions required by the consensus protocol are met. The consensus protocol specifically refers to the PoA consensus mechanism. The authoritative node is implemented through identity authentication. The authoritative node has the right to create a new block, which is more suitable for scenarios with high performance and low resource consumption requirements;

[0138] Once a block is verified and added to the blockchain, it will be permanently recorded and accepted by all nodes. The consistency of the blockchain network ensures that the block cannot be tampered with, ensuring the security and credibility of the record.

[0139] The authoritative nodes are a group of pre-authorized nodes.

[0140] Specifically, see Figure 6 As shown, the verification described in S6 refers to the verification of whether the existing web page has been tampered with, that is, whether there is a difference between the data fingerprint of the current web page and the fingerprint recorded in the blockchain, including:

[0141] S61 obtains the latest record on the blockchain and verifies its integrity and validity;

[0142] S62 checks whether the order of the recorded timestamps is correct;

[0143] S63 checks whether the digital fingerprint in the record matches the digital fingerprint of the current web page to determine whether there is any tampering.

[0144] Specifically, the checking record to see whether the digital fingerprint matches the digital fingerprint of the current web page is performed by comparing the difference between web pages P and P′, using the following formula:

[0145]

[0146] Among them, D(p,p ′ ) represents the difference between web pages P and P′, 0 means no tampering, and 1 means tampering.

[0147] In another embodiment, see Figure 7 As shown, a webpage tampering detection device based on blockchain technology, the detection device includes:

[0148] Create a blockchain distributed storage node module to initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes;

[0149] A web page data collection module is used to collect data from the web page to be detected and represent its content as a computable data structure;

[0150] A digital fingerprint generation module is used to perform a hash operation on the data structure to generate a unique digital fingerprint;

[0151] Build transaction and broadcast and verify module, which is used to build transaction using digital fingerprint and broadcast and verify;

[0152] Build new blocks and broadcast and verify the module, which is used to build new blocks and broadcast and verify them;

[0153] The module for regularly judging whether a webpage has been tampered with is used to regularly verify the records on the blockchain as needed to determine whether the webpage has been tampered with.

[0154] In another embodiment, a computer-readable storage medium stores computer program instructions. When the computer program instructions are executed by a computer, the computer performs any of the steps of the web page tampering detection method based on blockchain technology described above.

[0155] It should be noted that the storage medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any storage medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0156] The accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. Each box in the figure can represent a module, program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that each box in the block diagram or flow chart, and the combination of boxes in the block diagram or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0157] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A webpage tampering detection method based on blockchain technology, characterized in that: The method comprises: S1: Initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes; S2: Collect data on the web page to be detected and represent its content as a computable data structure; S3: Hash the data structure to generate a unique digital fingerprint; S4: Use digital fingerprints to construct transactions and propagate and verify them; S5: Build a new block and broadcast and verify it; S6: Regularly verify the records on the blockchain as needed to determine whether the web page has been tampered with.

2. According to a method for detecting webpage tampering based on blockchain technology according to claim 1, it is characterized in that: Initialized distributed storage nodes in S1 include: S11 Initialize node N i Generate a public key and a private key pair (K pub ,K priv ); S12 Node N i Receive the latest blockchain data B1, B2, …, B through communication with existing network nodes n ; S13 Node N i Verify the received blockchain data and calculate the hash value H(B j )=SHA256(B j ) and compare it with the hash value provided by the existing network nodes. H(Bj) is the hash value of the jth block; S14 If the hash values ​​are equal, the verification is successful, and node N i It is regarded as a legitimate node and added to the distributed storage network.

3. According to a method for detecting webpage tampering based on blockchain technology as claimed in claim 1, it is characterized in that: The synchronized blockchain data in S1 uses the following formula: Identify all satisfaction The blocks of the condition are equal, that is That is, the node data is synchronized; in, Represents node N i The j-th block on Represents node N k The j-th block on Representation block The hash value of Representation block The hash value of .

4. According to a method for detecting webpage tampering based on blockchain technology as claimed in claim 1, it is characterized in that: The data collection described in S2 includes: S21 uses the web page parser BeautifulSoup to parse the web page source code, identify and extract the elements in it, including text, images, and script elements; S22 cleans the extracted text, removes tags, special characters and punctuation marks, and retains the plain text content; S23 uses the image processing library OpenCV to identify and extract image elements from web pages, converts the extracted images into Base64 encoding, and records their names, sizes, and format information; S24 extracts script data by parsing the script tag in the webpage source code and executing JavaScript code; S25 saves the normalized text information, image transcoding information, and script data in the form of byte streams, and uses compression technology to reduce the number of bytes stored.

5. According to a method for detecting webpage tampering based on blockchain technology as claimed in claim 1, it is characterized in that: The hash operation on the data structure described in S3 is calculated using the SHA256 hash function.

6. A webpage tampering detection method based on blockchain technology according to claim 1, characterized in that: The construction transaction described in S4 includes: S41: Create a new transaction. The necessary information includes the digital fingerprint of the web page, the sender address, and the receiver address. The digital fingerprint has been calculated in step S3. Other key information includes the URL and timestamp. Other key information is provided by the relevant metadata of the initialized blockchain. S42: Use SHA256 to perform hash operation on the transaction content to generate a transaction summary H(P); S43: Digital Signature Authentication: Digitally sign the constructed blocks to ensure the credibility of their source.

7. A webpage tampering detection method based on blockchain technology according to claim 6, characterized in that: The digital signature is usually signed by a private key K priv The digital signature is generated by signing the transaction summary. The digital signature formula is as follows: T=Sign priv (H(P)) Among them, T represents the generated transaction, Sign priv (·) indicates a digital signature operation using a private key.

8. A webpage tampering detection method based on blockchain technology according to claim 7, characterized in that: The transaction and broadcast described in S4 means that the signed transaction is broadcast to all nodes in the blockchain network through the P2P network. The transaction includes the signature. Each node in the network uses the public key K pub The signature is verified to confirm the authenticity and integrity of the transaction.

9. A webpage tampering detection method based on blockchain technology according to claim 8, characterized in that: The use of the public key K described in S4 pub To verify the signature, the public key K is used for transaction verification. pub To verify the digital signature, ensure that the transaction has not been tampered with and is initiated by the legitimate private key holder. The formula is as follows: Verify(K pub ,T,H(P)) Among them, K pub is the public key, T is the digital signature, H(P) is the transaction summary, and Verify is the elliptic curve digital signature algorithm ECDSA; After successful verification, the transaction will be placed in the transaction pool, waiting to be packaged into the block.

10. A webpage tampering detection method based on blockchain technology according to claim 1, characterized in that: Constructing a new block as described in S5 includes: S51: Get the hash value of the latest block from the current blockchain state; S52: Select a group of transactions from those placed in the transaction pool; S53: Creating a Merkle tree, including the following steps: M1: Calculate transaction hash value: For each transaction, use SHA256 to calculate its hash value; M2: Create a Merkle tree: organize the hash values ​​of all transactions according to the binary tree structure to generate a Merkle root; S54: Create a block header: The block header mainly includes the hash value of the latest block in the blockchain, the Merkle root of the current block and the timestamp. The creation process formula is as follows: BlockHeader=SHA256(MerkleRoot+Timestamp) Among them, BlockHeader is the generated block header, MerkleRoot is the generated Merkle root, and Timestamp is the timestamp; S55: Organize the verified transactions, Merkle root, and block header information together to form a complete block in JSON format.

11. A webpage tampering detection method based on blockchain technology according to claim 1, characterized in that: The construction and broadcasting of a new block described in S5 refers to: broadcasting the new block to other nodes in the blockchain through the P2P network, using asynchronous broadcasting until all participating nodes receive the new block.

12. A webpage tampering detection method based on blockchain technology according to claim 10, characterized in that: The verification described in S5 is that after the new block is built, it is broadcasted and needs to be verified and accepted by other nodes in the cluster, including: C1: Check the contents of the block header, including the hash value, timestamp, and Merkle root of the latest block in the blockchain; C2: Verify the legitimacy of transactions in the block, including the validity of transaction signatures and the correctness of transaction formats; C3: Verify whether the conditions required by the consensus protocol are met. The consensus protocol specifically refers to the PoA consensus mechanism. The authoritative node is implemented through identity authentication. The authoritative node has the right to create a new block, which is more suitable for scenarios with high performance and low resource consumption requirements; Once a block is verified and added to the blockchain, it will be permanently recorded and accepted by all nodes. The consistency of the blockchain network ensures that the block cannot be tampered with, ensuring the security and credibility of the record. The authoritative nodes are a group of pre-authorized nodes.

13. A webpage tampering detection method based on blockchain technology according to claim 10, characterized in that: The verification described in S6 refers to the verification of whether the existing webpage has been tampered with, that is, whether there is a difference between the data fingerprint of the current webpage and the fingerprint recorded in the blockchain, including: S61 obtains the latest record on the blockchain and verifies its integrity and validity; S62 checks whether the order of the recorded timestamps is correct; S63 checks whether the digital fingerprint in the record matches the digital fingerprint of the current web page to determine whether there is any tampering.

14. A webpage tampering detection method based on blockchain technology according to claim 13, characterized in that: The checking record to see whether the digital fingerprint matches the digital fingerprint of the current web page is performed by comparing the difference between web pages P and P', using the following formula: Among them, D(p,p ′ ) represents the difference between web pages P and P′, 0 means no tampering, and 1 means tampering.

15. A webpage tampering detection device based on blockchain technology, characterized in that: The detection device comprises: Create a blockchain distributed storage node module to initialize distributed storage nodes, synchronize blockchain data between different storage nodes, and verify the data integrity and legitimacy of newly added nodes; A web page data collection module is used to collect data from the web page to be detected and represent its content as a computable data structure; A digital fingerprint generation module is used to perform a hash operation on the data structure to generate a unique digital fingerprint; Build transaction and broadcast and verify module, which is used to build transaction using digital fingerprint and broadcast and verify; Build new blocks and broadcast and verify the module, which is used to build new blocks and broadcast and verify them; The module for regularly judging whether a webpage has been tampered with is used to regularly verify the records on the blockchain as needed to determine whether the webpage has been tampered with.

16. A computer-readable storage medium storing computer program instructions. When the computer program instructions are executed by a computer, the computer executes the steps of the web page tampering detection method based on blockchain technology as described in any one of claims 1 to 14.

Citation Information

Cited By

  • Digital tracing method and system for gold transaction

    CN120182005A

  • Traffic monitoring data tamper-proofing method based on block chain hash verification

    CN122419803A