WO2015131434A1 - 基于线程切片胎记的多线程软件抄袭检测方法 - Google Patents

基于线程切片胎记的多线程软件抄袭检测方法 Download PDF

Info

Publication number
WO2015131434A1
WO2015131434A1 PCT/CN2014/076079 CN2014076079W WO2015131434A1 WO 2015131434 A1 WO2015131434 A1 WO 2015131434A1 CN 2014076079 W CN2014076079 W CN 2014076079W WO 2015131434 A1 WO2015131434 A1 WO 2015131434A1
Authority
WO
WIPO (PCT)
Prior art keywords
thread
system call
birthmark
similarity
slice
Prior art date
Application number
PCT/CN2014/076079
Other languages
English (en)
French (fr)
Inventor
郑庆华
刘烃
刘均
范铭
田振洲
Original Assignee
西安交通大学
郑庆华
刘烃
刘均
范铭
田振洲
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 西安交通大学, 郑庆华, 刘烃, 刘均, 范铭, 田振洲 filed Critical 西安交通大学
Priority to US14/759,642 priority Critical patent/US9652601B2/en
Publication of WO2015131434A1 publication Critical patent/WO2015131434A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • G06F21/125Restricting unauthorised execution of programs by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/16Program or content traceability, e.g. by watermarking

Definitions

  • the invention relates to the field of program feature discovery and software plagiarism detection, in particular to a plagiarism detection method for a multi-threaded program.
  • BACKGROUND Due to various physical bottlenecks (such as high temperature, power consumption, leakage, etc.), CPU clock speed is facing increasing challenges.
  • CPU manufacturers have shifted their focus to hyper-threading and multi-core technology to improve CPU performance.
  • hyper-threading and multi-core technology become the standard configuration of today's CPUs, serial programs have been difficult to leverage the computing power of existing CPUs.
  • multi-threaded programs become an important way to maximize CPU performance and improve system efficiency. .
  • the existing software birthmark is mainly for a single-threaded program, using the key information obtained by the program once as the birthmark of the software, and does not consider the thread interleaving of the multi-threaded program during execution.
  • Multi-threaded programs have different thread interleaving during execution under the same input conditions, resulting in program behavior during program execution, such as system call sequence, which produces certain differences. This situation makes traditional birthmark-based plagiarism detection methods. There is a lot of randomness in analyzing multithreaded programs.
  • the current plagiarism detection method still has a series of limitations: 1) Most of the methods are for source code, and when plagiarism detection is performed, the source code of the detection object is often not obtained, and only the binary code of the detection object can be obtained; Existing software birthmarks are more dependent on specific operating systems or programming languages and have a smaller scope of application; 3) Most existing software birthmarks are difficult to cope with diverse and deep code obfuscation techniques.
  • SUMMARY OF THE INVENTION The object of the present invention is to provide a multi-threaded software plagiarism detection method based on thread slice birthmarks to overcome the limitations of the current birthmark-based plagiarism detection means.
  • the method of the invention can directly target binary code, does not need source code to exist, has more realistic meaning; has good detection capability for multi-threaded programs, can reduce random effects due to thread scheduling, and is not limited to single-threaded programs;
  • the detection means does not depend on a specific programming language, and has a wider application range; it has good resistance to semantically retained code obfuscation techniques and improves the detection capability for deep plagiarism.
  • a multi-threaded software plagiarism detection method based on thread slice birthmark includes the following steps:
  • a further improvement of the present invention is as follows:
  • the dynamic system call identification principle in the step 1) is: if the current execution function name matches a system call function name in the operating system system call list, the execution function is recognized as a system call function.
  • a further improvement of the present invention is: the monitoring implementation method in the step 1) is: for the binary to-be-analyzed program, using the dynamic instrumentation technology, embedding the corresponding analysis code before and after the execution of the function of the program to be analyzed, Implement runtime monitoring.
  • the system call sequence generation method in the step 1) is: capturing the function to be executed by function-level runtime monitoring, analyzing the type of the function, and matching the system call of the current operating system. List, according to the matching result to determine whether the function is a system call Function; at the same time, combined with the thread ID of the system call, record the thread ID of each executed system call; and capture the call parameters related to the system call and the return value and other related information; finally, according to the analysis result, the system call is performed. Record and add it to the dynamic system call sequence; the record format of each system call is: Thread ID #call address #system call number #function name#parameter# return value.
  • a further improvement of the present invention is that the step 1) preprocesses the recorded system call sequence, removes invalid system calls, and obtains a valid system call sequence: for each system call item in the extracted system call sequence, Parse the format and determine its return value. If the return value is non-zero, the system call execution fails, and the system call is deleted.
  • Tm Ce p, I, ( ⁇ , e2 ,..., e , denote the program/? extract/input, a preprocessed valid system call sequence containing the system call number of a system call And the thread ID it is in.
  • a further improvement of the present invention is:
  • the step 1) specifically includes the following steps:
  • Step S201 determining whether the program to be analyzed still has a function to be executed, if yes, skipping to step S202, otherwise directly proceeding to step S208;
  • Step S202 For the function to be analyzed, parsing the function type, determining whether it is a system call function, if yes, proceeding to step S203, otherwise proceeding to step S207;
  • Step S203 Parsing a system call function, and obtaining related information of a thread ID, a call address, a system call number, a function name, a parameter, and a return value;
  • Step S204 determining whether the return value of the function is -1, if yes, proceeding to step S201, otherwise proceeding to step S205;
  • Step S205 Obtain the thread ID information of the thread ID
  • Step S206 Add the obtained system calling function to the system call sequence;
  • Step S207 executing the system call function, and proceeding to step S201 to perform analysis of the next round;
  • Step S208 outputting a system call sequence;
  • a further improvement of the present invention is: the thread slice generation method in the step 2) is: based on a valid runtime system call sequence, for each system call in the sequence, stripping its thread ID, retaining its system call number, according to the thread ID The identity is divided into a series of thread slices.
  • Slice ( p, I, t) represents the thread slice corresponding to the thread t, and m represents a total of m threads during the execution of the program.
  • step 2) specifically includes the following steps:
  • Step S301 determining whether there is still a system call to be processed in the input dynamic system call sequence, if yes, proceeding to step S302, otherwise proceeding to step S304;
  • Step S302 Extracting a system call in order from the dynamic system call sequence, stripping the thread ID and the system call number;
  • Step S303 adding the system call to the thread slice corresponding to the thread ID; and then proceeding to step S301 for the next round of analysis;
  • Step S304 Output the generated thread slice set to further generate a software birthmark.
  • a further improvement of the present invention is as follows:
  • step 3 specifically includes the following steps:
  • Step S401 determining whether the length of the unprocessed thread slice subsequence is greater than the value of the tunable parameter k, if yes, proceeding to step S402, otherwise proceeding to step S408;
  • Step S402 Generate a system call number subsequence of length by using the gram algorithm;
  • Step S403 sequentially connect each element in the generated system call number subsequence of length k, generate a character string, and calculate a hash value thereof. And use it as the key value to find the corresponding element in the set B (the initial set B is empty); if it exists, go to step S406, if it does not exist, go to the step
  • Step S404 Create a new element with the hash value of the sub-sequence as a key, and set the key value to 1;
  • Step S405 Add the newly generated key-value pair element to the set B, and proceed to step S407;
  • Step S406 Find the element in the set B according to the hash key value, and update the key value of the element;
  • Step S407 Delete the first element of the thread slice, and proceed to step S401 to perform the next round of processing;
  • Step S408 Output by The set B of key-value pairs, that is, the dynamic system call thread slice birthmark.
  • a further improvement of the present invention is:
  • the present invention further improvement wherein: said step 5) is calculated / ⁇ 1 and birthmarks / 2 ⁇ similarities: the PB-based software birthmark greatest similarity matching scheme 2, both calculated similarity
  • a further improvement of the present invention is: in the step 6), the plagiarism decision module takes as input the value of the similarity between the first program and the second program birthmark obtained by multiple input, and calculates the mean similarity thereof as The similarity of the program; and based on the input adjustable threshold s to make a plagiarism judgment, output the test results.
  • the present invention has the following advantages:
  • the detection object of the invention does not need source code, and can directly analyze the binary code, which is more practical: In most cases, the suspicious plagiarism program is released in binary code, and the source code cannot be obtained without conclusive evidence. Traditional source-based plagiarism detection methods have failed.
  • the invention monitors software based on dynamic instrumentation, and the analysis object is directly binary code, and there is no such limitation.
  • the lowest level analysis object of the present invention is a system call function, which does not depend on a specific programming language.
  • the scope of application is broader.
  • the present invention can be applied to a multi-threaded program.
  • thread slicing in the software birthmark generation process, the random influence caused by thread scheduling during program execution can be well reduced, and the detection accuracy is effectively improved.
  • the present invention generates software birthmarks based on the dynamic system call sequence of monitoring and extraction, which belongs to the category of dynamic birthmarks, and is inherently resistant to shallow confusion methods such as encryption, compression, and encapsulation, because such confusing procedures ultimately have to be considered. Execution must be decrypted, decompressed, or decapsulated at runtime.
  • FIG. 1 is a general flow chart of a multi-threaded software plagiarism detection method based on thread sliced birthmark according to the present invention
  • FIG. 2 is a flow chart of a dynamic system call sequence extraction process based on runtime monitoring
  • Figure 3 is a flow chart of preprocessing and thread slicing
  • Figure 4 is a flow chart of dynamic thread slice birthmark generation.
  • Figure 5 is a flow chart of the software birthmark similarity calculation process. Detailed ways
  • FIG. 1 is a processing flow of a software plagiarism detection method based on a dynamic system call sequence birthmark.
  • the invention provides a software plagiarism detection method based on a dynamic system call sequence birthmark, comprising the following steps: Step S101: using a dynamic instrumentation tool such as Pin, Valgrind, etc., implanting analysis before and after execution of each function of the program to be analyzed Code, to achieve monitoring of the function level information of the binary program.
  • Step S101 using a dynamic instrumentation tool such as Pin, Valgrind, etc., implanting analysis before and after execution of each function of the program to be analyzed Code, to achieve monitoring of the function level information of the binary program.
  • the analysis code is inserted to implement monitoring of the function level information of the binary program, and specifically includes the following steps:
  • Step S201 determining whether the program to be analyzed still has a function to be executed, if yes, skipping to step S202, otherwise, directly proceeding to step S208;
  • Step S202 For the function to be analyzed, parsing the function type, determining whether it is a system call function, if yes, proceeding to step S203, otherwise proceeding to step S207;
  • Step S203 parsing the system call function, and obtaining related information of the thread ID, the calling address, the system call number, the function name, the parameter, and the return value;
  • Step S204 determining whether the return value of the function is -1, if yes, proceeding to step S201 to analyze the next function to be executed, otherwise proceeding to step S205;
  • Step S205 Obtain the thread ID information of the thread ID
  • Step S206 Add the obtained system calling function to the system call sequence
  • Step S207 executing the system call function, and proceeding to step S201 for the next round of analysis;
  • Step S208 outputting a system call sequence;
  • Step S102 Thread slicing a valid system call sequence based on the thread ID to generate a series of thread slices identified by the thread ID.
  • the specific process is shown in Figure 3:
  • Step S301 determining whether there is still a system call to be processed in the input dynamic system call sequence, if yes, proceeding to step S302, otherwise proceeding to step S304;
  • Step S302 Extracting a system call in order from the dynamic system call sequence, stripping the thread ID And the system call number;
  • Step S303 adding the system call to the thread slice corresponding to the thread ID; and then proceeding to step S301 for the next round of analysis;
  • Step S304 Output the generated thread slice set to further generate a software birthmark.
  • Step S103 Based on the pre-processed thread slice set and the tunable parameter / 1 (generally 4 or 5), the k-gmm algorithm is used to generate a series of sub-sequences of length k, and the frequency of occurrence of each different sub-sequence is counted. Then, the set of key values formed by the subsequence and its frequency of occurrence is used as a dynamic thread slice birthmark. Specifically, the thread slicing birthmark ⁇ ⁇ generation process is shown in Figure 4:
  • Step S401 determining whether the length of the unprocessed thread slice subsequence is greater than the value of the tunable parameter k, if yes, proceeding to step S402, otherwise proceeding to step S408;
  • Step S402 Generate a system call number subsequence of length by using the gram algorithm;
  • Step S403 sequentially connect each element in the generated system call number subsequence of length k, generate a character string, and calculate a hash value thereof.
  • a key value search set B initial set B is empty
  • Step S404 Create a new element with the hash value of the sub-sequence as a key, and set the key value to 1;
  • Step S405 Add the newly generated key-value pair element to the set B, and proceed to step S407;
  • Step S406 Find the element in the set B according to the hash key value, and update the key value of the element;
  • Step S407 deleting the first element of the thread slice, and proceeding to step S401 to perform the next round of processing;
  • Step S408 outputting the set B composed of the key value pairs, that is, the dynamic system calls the thread slice birthmark.
  • the section birthmark Birth (2, t 2 ) ⁇ ((sc -2, sc-3), l) ⁇ .
  • Step S104 Generate a software birthmark ⁇ 2 based on all the thread slice birthmarks of the two multi-threaded programs to be detected.
  • Step S105 Calculate the maximum similarity between ⁇ and ⁇ 2 based on the maximum bilateral map matching. The specific process is shown in FIG. 5 .
  • Step S501 Calculate the similarity to each thread slice birthmark within the ⁇ 2 based on each thread slice birthmark inside the software birthmark.
  • the specific description is: For the first program software birthmark
  • ⁇ ⁇ ⁇ t x , Birth (t x )) , ( ⁇ 2 , Birth (t 2 )) , ( m , Birth (t m )) ⁇ and the second program software birthmark
  • PB 2 ⁇ (?;, Birth (ij )) , ( ⁇ 2 , Birth (i 2 )),..., ( ⁇ profession , Birth (i constitutive )) j, slice birthmarks for m threads in the corpse
  • the similarity between the n and n thread slice birthmarks in ⁇ 2 is calculated, and a m*w order similarity matrix SimMatrb ⁇ PB PB ⁇ is generated, where
  • the similarity calculation process of Birth (t, ) in the software birthmark of the first program and / in the software birthmark ⁇ 2 of the second program is: First, calculate the ⁇ Vze distance of the two, the value is cosine, and then Use Jaccard,
  • Step S502 Generate a maximum similar matching scheme MaxMatch (PB l , PB 1 ) with ⁇ 2 based on the weighted bilateral map matching algorithm.
  • Step S503 Based on the birthmark collection ⁇ ! The similarity is calculated by the maximum similar matching scheme with ⁇ , which is described as follows: Based on the maximum similarity matching scheme of software birthmark ⁇ and ⁇ 2 , the similarity between the two is calculated.
  • Step S106 The birthmarks generated under different inputs may be different. When multiple inputs are provided, a series of similar values ( ⁇ ,..., ) are calculated, and the mean value is taken as the basis for finally measuring the similarity between the two programs. The influence of small random factors; and based on the input adjustable threshold s (value 0.2-0.3) to make a decision on plagiarism or not, output the test results.
  • PB M , PB A2 ,..., PB A JllPB m , PB B2 ,...,PB Bn , Bay ⁇ , ) ⁇ are determined according to the similarity of the two programs and the given adjustable threshold s Plagiarism or not, ie: sim(P A , P B

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Debugging And Monitoring (AREA)
  • Investigating Or Analysing Biological Materials (AREA)
  • Complex Calculations (AREA)

Abstract

本发明提出了一种基于线程切片胎记的多线程软件抄袭检测方法,包括:1) 基于动态插桩技术对待分析的目标程序实施运行时监控,实时地识别系统调用,并记录与之相关的线程ID、系统调用号、返回值等相关信息,然后对其进行预处理得到有效系统调用序列Trace;2)基于线程ID对Trace进行线程切片,生成一系列由线程ID标识的线程切片Slice;3)在此基础之上为待检测的两个软件的所有线程切片分别生成其线程切片胎记Birth;4)基于两个待检测多线程程序的所有线程切片胎记,分别生成其软件胎记PB1和PB2;5)基于最大双边图匹配,计算软件胎记PB1与PB2的最大相似性;6)通过胎记相似性的均值及给定的阈值,做出抄袭与否的决策。该方法直接作用于二进制代码,无需源码存在。

Description

说 明 书
基于线程切片胎记的多线程软件抄袭检测方法 技术领域:
本发明涉及程序特征发现及软件抄袭检测领域, 特别涉及一种针对多线程 程序的抄袭检测方法。 背景技术: 由于各种物理瓶颈 (如高温、 功耗、 漏电等), CPU时钟速度的提升面临越 来越大的挑战, 近几年 CPU厂商已将重点转向超线程与多核技术以提高 CPU 性能。 随着超线程与多核技术成为当今 CPU的标准配置, 串行程序已经难以 发挥现有 CPU 的计算能力, 作为并行计算最常用的实现方式, 多线程程序成为 发挥 CPU 性能、 提高系统效率的重要途径。
然而多线程程序的知识产权保护问题随着软件的快速发展而日益严重,例如 三星和苹果公司的手机应用抄袭法律纠纷问题, 这样的软件侵权事件经常发生, 它们在很大程度上对大公司的利益构成了威胁,使多线程程序抄袭成为软件工业 健康发展的严重阻碍。
为此人们提出了一系列手段防止及检测软件抄袭,其中基于软件胎记的抄袭 检测技术是目前常用的方法。软件胎记是能够反映程序固有属性的可以唯一标识 程序的特征, 相关的研究都是通过将抄袭检测转换为两个程序的相似性分析问 题, 并基于胎记的相似性计算来衡量程序的相似性,其关键技术主要涉及到高质 量的软件胎记的提取及其相似性计算过程。
然而现有的软件胎记主要针对的是单线程的程序,采用程序执行一次的所获 取的关键信息作为软件的胎记,并没有考虑多线程程序在执行过程中线程交织的 情况。 多线程程序在相同输入条件下, 执行过程中存在不同的线程交织, 导致程 序执行过程中的程序行为, 如系统调用序列等, 产生一定的差异性, 这种情况使 得传统基于胎记的抄袭检测方法在分析多线程程序时存在很大的随机性。 此外, 目前的抄袭检测方法还存在一系列的局限性: 1 ) 大部分方法是针对源代码的, 而进行抄袭检测时往往无法获得检测对象的源代码,只能获取检测对象的二进制 代码; 2) 现有的软件胎记对特定的操作系统或者编程语言依赖性较强, 适用范 围较小; 3 ) 大部分已有的软件胎记难以应付多种多样和深度的代码混淆技术。 发明内容: 本发明的目的在于提出一种基于线程切片胎记的多线程软件抄袭检测方法, 以克服上述当前基于胎记的抄袭检测手段的局限性。本发明方法能够直接针对二 进制代码, 无需源代码存在, 具有更现实的意义; 针对多线程程序具有很好的检 测能力, 能够减小由于线程调度产生的随机性影响, 不局限于单线程程序; 检测 手段不依赖于特定的编程语言, 具有更广阔的应用范围; 对于语义保留的代码混 淆技术具有很好的抵抗力, 提高对深度抄袭的检测能力。
本发明的目的通过以下技术方案实现:
基于线程切片胎记的多线程软件抄袭检测方法, 包括如下步骤:
1 )基于动态插桩技术, 对待分析目标程序实施运行时监控, 实时地识别待 分析目标程序中系统调用函数, 并记录与之相关的线程 ID、 调用地址、 系统调 用号、 函数名、 参数、 返回值的相关信息, 然后对其进行预处理, 去除无效的系 统调用, 得到有效的系统调用序列 Trace ;
2)基于线程 ID对有效的系统调用序列 Trace进行线程切片, 生成一系列由 线程 ID标识的线程切片 Slice; 3 ) 基于线程切片, 通过提取线程切片中的固定子序列并记录其出现次数, 分别为待分析的第一程序 ^ 及第二程序 ^2的所有线程切片生成其动态线程切片 胎记 其中第一程序指的是程序所有者开发的原始程序, 第二程序指被认 为抄袭了原始程序的可疑程序;
4) 基于多线程程序所有的线程切片胎记分别为 S 和 Ρ2生成相应的软件胎 记 和 ΡΒ2
5 ) 基于最大双边图匹配, 计算软件胎记 ^与 ^2的最大相似性, 首先针 对软件胎记 PA内部的每一个线程切片胎记, 计算其与胎记 ρβ2 ή部每一个线程 切片胎记的相似性; 然后基于带权双边图匹配算法生成 与 Ρβ2的最大相似性 匹配方案
Figure imgf000005_0001
Ρβ;);最后基于最大相似性匹配方案,计算 与 Ρβ2的 胎记相似性 Sz'm^ , ^) ;
6) 依据多次输入下生成的胎记相似性的均值, 及给定的阈值判断是否抄 袭。
本发明进一步的改进在于: 所述步骤 1)中动态系统调用识别原则为: 若当 前执行函数名与操作系统系统调用列表中一个系统调用函数名匹配,则将该执行 函数识别为系统调用函数。
本发明进一步的改进在于: 所述步骤 1 )中监控实施方法为: 针对二进制的 待分析程序, 使用动态插桩技术, 在待分析程序的函数执行之前以及执行之后植 入相应的分析代码, 以实现运行时监控。
本发明进一步的改进在于: 所述步骤 1 ) 中系统调用序列生成方法为: 通 过函数级的运行时监控, 捕获每一个待执行的函数, 分析该函数的类型, 通过 匹配当前操作系统的系统调用列表, 根据匹配结果判断该函数是否为系统调用 函数; 同时结合系统调用所在线程 ID,对每一个执行的系统调用的所在线程 ID 进行记录; 并且捕获与该系统调用相关的调用参数以及返回值等相关信息; 最 后根据分析结果, 对系统调用进行记录并将其加入动态系统调用序列; 每条系 统调用的记录格式为: 线程 ID#调用地址#系统调用号 #函数名 #参数 #返回值。
本发明进一步的改进在于:所述步骤 1 )中对记录的系统调用序列进行预处 理, 去除无效的系统调用, 得到有效的系统调用序列: 对抽取的系统调用序列中 的每条系统调用项, 解析其格式, 判断其返回值, 若返回值为非零则表示系统调 用执行失败, 则删除该条系统调用。
令 TmCe p, I、 = (^,e2,...,e , 表示程序/?在输入 /下抽取, 经预处理得到 的一条有效的系统调用序列,其中 包含一条系统调用的系统调用号以及它所 在的线程 ID。
本发明进一步的改进在于: 所述步骤 1 ) 具体包括以下步骤:
步骤 S201: 判断待分析程序是否还存在待执行的函数, 如果有则跳至步骤 S202, 否则直接转入步骤 S208;
步骤 S202: 对于待分析的函数, 解析函数类型, 判断其是否为系统调用函 数, 如果是则转入步骤 S203, 否则转入步骤 S207;
步骤 S203: 对系统调用函数进行解析, 获取其线程 ID、 调用地址、 系统调 用号、 函数名、 参数、 返回值的相关信息;
步骤 S204: 判断函数的返回值是否为 -1, 若是, 则转入步骤 S201, 否则转 入步骤 S205;
步骤 S205: 获取其所在的线程 ID信息;
步骤 S206: 将获取的系统调用函数添加至系统调用序列; 步骤 S207: 执行该系统调用函数, 并转入步骤 S201进行下一轮的分析; 步骤 S208: 输出系统调用序列;
本发明进一步的改进在于: 所述步骤 2)中线程切片生成方法为: 基于有效 的运行时系统调用序列, 针对序列中每一个系统调用, 剥离其线程 ID, 保留其 系统调用号, 根据线程 ID标识划分成一系列的线程切片。
令 Slice (/?,/, ) = e Trace (p,l) and getThreadlD {ej ) = f } '
j' e {1, 2, "} , 1≤ ≤ m, e N, Slice ( p, I,t)表示线程 t对应的线程切片, m代表程 序执行过程中共有 m个线程。
本发明进一步的改进在于: 所述步骤 2) 具体包括以下步骤:
步骤 S301: 判断输入的动态系统调用序列中是否还存在待处理的系统调用, 如果存在则转入步骤 S302, 否则转入步骤 S304;
步骤 S302: 从动态系统调用序列中按次序取出一条系统调用, 剥离线程 ID 和系统调用号;
步骤 S303:将该系统调用加入其线程 ID对应的线程切片;再转入步骤 S301 进行下一轮分析;
步骤 S304: 输出生成的线程切片集合, 以进一步生成软件胎记。
本发明进一步的改进在于: 其特征在于, 所述步骤 3)中线程切片胎记生成 方法为: 对线程切片^ /,m)应用 ^ram算法, 得到一个长度为 子序列的集合 Set(p,l,t,k) = {gj \gj ={epep--, ej+k_, )} , j &{\,2,- ,n-k + \} 然后统计独有的 k-gram个数及其频率,最终生成一个键值对集合。令 Birth (k,t)为程序 p在输入 /下的线程 ID标识为 的动态系统调用线程切片胎记,简记为 ^ /^ ) , 表示为 Birthp ! (k,t) = j^g. ≠g;J,其中
Figure imgf000007_0001
/r^(g 表示 在集合 ^ ^,/, )中出现的次数, k=4或 5。
本发明进一步的改进在于: 所述步骤 3) 具体包括以下步骤:
步骤 S401: 判断未处理的线程切片子序列长度是否大于可调参数 k的值, 如果是则转入步骤 S402, 否则转入步骤 S408;
步骤 S402: 利用 gram算法, 生成一个长度为 的系统调用号子序列; 步骤 S403: 顺序依次连接生成的长度为 k的系统调用号子序列中的每个元 素, 生成一个字符串, 计算其 hash值并将之作为键值查找集合 B (初始集合 B 为空) 中是否已存在相应元素; 如果存在则转入步骤 S406, 不存在则转入步骤
S404;
步骤 S404: 创建一新的以该子序列的 hash值为键的元素, 并设置键值为 1; 步骤 S405: 将新生成的键值对元素加入集合 B中, 转入步骤 S407;
步骤 S406:依据 hash键值在集合 B中查找到该元素,并更新该元素的键值; 步骤 S407: 删除线程切片的首元素, 转入步骤 S401开展下一轮的处理; 步骤 S408: 输出由键值对构成的集合 B, 即动态系统调用线程切片胎记。 本发明进一步的改进在于: 所述步骤 4) 中软件胎记生成方法为: 令 SB = {Birthp' (k,t)\\≤t≤m,tGN} , 它表示一个程序的所有线程切片胎记的集合, 然后构建一个 SS转换将线程切片胎记集合 SB转换成其软件胎记 , 其中 SS:SB→ PB表示将线程胎记集合中的每一个线程与其相应的线程胎记组成一 个二元组, 作为软件胎记的元素, 得到 PB = {(t,Birthp' (k,t))\sb G SB}。
本发明进一步的改进在于:所述步骤 5)中线程切片胎记相似性计算方法为: 令两个线程切片胎记分别为 A = { , Vl〉, 〉,···, , }和
B = {〈 , 首先分别使用 cosine距离、 Jaccard、 Dice、
Figure imgf000008_0001
Containment四种方法计算二者的相似性, 具体描述如下: a) cosine距! ¾衡量 A
b) Jaccard计算 A及 B
Figure imgf000009_0001
c) Dice计算 A及 B的相似性, m(A,fi)=Z¾ce (; Α,β
Α| + |β| d
Figure imgf000009_0002
Figure imgf000009_0004
.„ -, cosine (A, B) + Jaccard (Α,Β) + Dicei Α,Β) + Containment ( A, B) 性, W'm(A,fi)= ^-^-, 简·记一 为 simc A,B、。 本发明进一步的改进在于: 所述步骤 5)中为 内部的所有线程切片胎记 计算其与 Ρβ2内部每一个线程切片胎记的相似性: 对于第一程序软件胎记尸 A = {(t„ Birth (ij )) , (ί2 , Birth (t2)),...,(tm, Birth (tm))}, 为其中的 m个线程切片胎记分别计算其与第二程序软件胎记 PB2 ={(?;, Birth (ij )) , (ί2 , Birth (ί2 )) , ... , (ί„ , Birth (ί„ )) j中的 η个线程切片胎记的相 似性, 生成 m*"阶的相似性矩阵 Sz'mM^n';^ ^, ^) , 其中 SimMatrix ( PB1 ,PB2)[i][ y] = simc I Birth ( ), Birth 本发明进一步的改进在于:所述步骤 5)中基于带权双边图匹配算法生成 与 Ρβ2的最大相似性匹配方案
Figure imgf000009_0003
: 基于相似性矩阵 SimMatrix(A, B), 利用带权双边图匹配算法为软件胎记 和 PB2中的所有线程 切片胎记计算得到最大相似匹配方案, 记为 MaxMatch (ΡΒ ,ΡΒ2),
MaxMatch ( PBl , PB2 ) = (aj,Vj),(a2,v2),...,(a,,v,)J ,1 = min{m,n) ,u{ e keyset (^PB^ , i
v,. e keyset (PB2) , ut≠ Uj if i≠ j , v,.≠ if i≠ j' ,并且 ^ w'mc (M,., )在所有的匹配 中具有最小值。
本发明进一步的改进在于: 所述步骤 5) 中计算 /^1与/^2的胎记相似性: 基于软件胎记 与 PB2的最大相似性匹配方案, 计算二者相似性
Figure imgf000010_0001
count keySet [Birth keySet Birthitj 本发明进一步的改进在于: 所述步骤 6) 中抄袭决策模块将多次输入下得 到的第一程序及第二程序胎记相似性的值作为输入,计算其均值相似性作为程序 的相似性; 并依据输入的可调节阈值 s做出抄袭与否的判断, 输出检测结果。
本发明进一步的改进在于: 所述步骤 6) 中阈值 s的取值范围为 0.2-0.3; sim PA,PB =
Figure imgf000010_0002
其中 w'm(PA, 为第一程序及第二程序胎记相似性的均值。
相对于现有技术, 本发明具有以下优点:
(1) 本发明检测对象无需源码存在, 可直接对二进制代码进行分析, 更具 实用价值: 大部分情况下, 可疑抄袭程序是以二进制代码形式发布的, 在无确凿 证据之前, 无法获取其源码, 传统的基于源码的抄袭检测手段就失效了。本发明 基于动态插桩对软件进行监控,分析对象直接为二进制代码,不存在这种局限性。
(2)本发明最底层的分析对象是系统调用函数, 不依赖于特定的编程语言 适用范围更广阔。
(3 ) 本发明可以作用于多线程程序, 通过在软件胎记生成过程中进行线程 切片, 能够很好地减小程序执行过程中线程调度产生的随机性影响,有效地提高 了检测精度。
(4) 本发明基于监控抽取的动态系统调用序列生成软件胎记, 属于动态胎 记的范畴, 对加密、 压缩、 封装等浅层混淆手段具有天生的抵抗力, 因为这类混 淆后的程序最终要想执行, 必须在运行时先进行解密、 解压缩或解封装。 附图说明
图 1为本发明基于线程切片胎记的多线程软件抄袭检测方法整体流程图; 图 2为基于运行时监控的动态系统调用序列抽取过程流程图;
图 3为预处理以及线程切片程流程图;
图 4为动态线程切片胎记生成流程图。
图 5为软件胎记相似性计算过程流程图。 具体实施方式
以下结合附图详细说明本发明基于线程切片胎记的多线程软件抄袭检测方 法的实施方式。
图 1为基于动态系统调用序列胎记的软件抄袭检测方法的处理流程。
本发明一种基于动态系统调用序列胎记的软件抄袭检测方法,包括以下步骤: 步骤 S101 : 使用动态插桩工具如 Pin、 Valgrind等, 在待分析程序的每条函数 执行之前和执行之后植入分析代码, 实现对二进制程序函数级信息的监控。 结合图 2, 具体而言, 在每条函数执行之前和执行之后插入分析代码, 实现 对二进制程序函数级信息的监控, 具体包括以下步骤:
步骤 S201 : 判断待分析程序是否还存在待执行的函数, 如果有则跳至步骤 S202, 否则直接转入步骤 S208 ;
步骤 S202: 对于待分析的函数, 解析函数类型, 判断其是否为系统调用函 数, 如果是则转入步骤 S203, 否则转入步骤 S207 ;
步骤 S203 : 对系统调用函数进行解析, 获取其线程 ID、 调用地址、 系统调 用号、 函数名、 参数、 返回值的相关信息;
步骤 S204 : 判断函数的返回值是否为 - 1, 若是, 则转入步骤 S201分析下一 个待执行的函数, 否则转入步骤 S205 ;
步骤 S205 : 获取其所在的线程 ID信息;
步骤 S206 : 将获取的系统调用函数添加至系统调用序列;
步骤 S207 : 执行该系统调用函数, 并转入步骤 S201进行下一轮的分析; 步骤 S208 : 输出系统调用序列;
例 如 程 序 S 在 输 入 / 下 获 取 的 系 统 调 用 序 列 为
Trace =〈(^ ^ -l), {tx , - 2) , {tx , - 3) , {tx , sc- 2) , {t2 , sc - 2) , {t2 sc - 3) sc - 4)〉
, 其中 表示一条系统调用的系统调用号。
步骤 S 102: 基于线程 ID对有效的系统调用序列进行线程切片, 生成一系列 由线程 ID标识的线程切片。 具体流程如图 3所示:
步骤 S301 : 判断输入的动态系统调用序列中是否还存在待处理的系统调用, 如果存在则转入步骤 S302, 否则转入步骤 S304;
步骤 S302: 从动态系统调用序列中按次序取出一条系统调用, 剥离线程 ID 和系统调用号;
步骤 S303:将该系统调用加入其线程 ID对应的线程切片;再转入步骤 S301 进行下一轮分析;
步骤 S304: 输出生成的线程切片集合, 以进一步生成软件胎记。
针对上一步得到的系统调用序列 rra (A,/), 由于 rra (A,/)只有两条线 程, 因此将 rrac^A,/)划分为由线程 ID标识的线程切片后可以得到两个线程切 片, 分别为 Slice (ij ) = ((ij ,sc-l),(t ,sc-2),(t ,sc-3), (t , sc- 2) , [tx , sc - 4)〉禾口 Slice ( 2 ) =〈(2 , _ 2) , ( 2 , _ 3》。
步骤 S103: 基于预处理得到的线程切片集合和可调参数/ 1 (一般取 4或 5), 应用 k-gmm算法生成一系列长度为 k的子序列, 同时统计各个不同的子序列出 现的频率, 则将子序列及其出现频率构成的键值对集合作为动态线程切片胎记。 具体而言, 线程切片胎记 βΖ 生成流程如图 4所示:
步骤 S401: 判断未处理的线程切片子序列长度是否大于可调参数 k的值, 如果是则转入步骤 S402, 否则转入步骤 S408;
步骤 S402: 利用 gram算法, 生成一个长度为 的系统调用号子序列; 步骤 S403: 顺序依次连接生成的长度为 k的系统调用号子序列中的每个元 素, 生成一个字符串, 计算其 hash值并将之作为键值查找集合 B (初始集合 B 为空) 中是否已存在相应元素; 如果存在则转入步骤 S406, 不存在则转入步骤 S404;
步骤 S404: 创建一新的以该子序列的 hash值为键的元素, 并设置键值为 1; 步骤 S405: 将新生成的键值对元素加入集合 B中, 转入步骤 S407;
步骤 S406:依据 hash键值在集合 B中查找到该元素,并更新该元素的键值; 步骤 S407: 删除线程切片的首元素, 转入步骤 S401开展下一轮的处理; 步骤 S408: 输出由键值对构成的集合 B, 即动态系统调用线程切片胎记。
将上述两个线程切片分别生成其线程切片胎记, 取 k值为 2, 对于线程切片 Slice (ij ) =〈(! ,sc-l), (ij ,sc-2), [tx ,sc-3), [tx , sc- 2) , [tx , sc - 4)〉,通过 k-gram算法 得到 /,^) = {(^-1,« -2),(^-2,« -3),(^-3,^-2),(^-2,« -4)}, 然 后将具有相同键的项进行合并并修改其相应的值, 生成其线程切片胎记
Figure imgf000014_0001
程切片胎记 Birth (2, t2 ) = {((sc -2,sc-3), l)}。
将上述软件作为第一程序, 然后对程序 ^2执行步骤 S101 得到系统调用序列
Trace (/¾,/) =〈(^ ,sc-i , [t2 , _ 2) , ΐ ,sc-2^, ( 2 , sc- 3) , ( ' , _ 3) , (' ,sc-2^, ( ' , sc - 4))
, 执 行 S102 和 S103 得 到 它 的 线 程 切 片 胎 记 Birth^' (2, ) = _ 1, _ 2) , 1〉 ,、{sc _ 2, 5 _ 3) , 1〉 , {sc _ 3, _ 2) , 1〉 , (l^sc - 2, * - 4) , 1〉} 和 Birth (2, t2 ) = {((* -2,sc-3), l)}。
步骤 S104: 基于两个待检测多线程程序的所有线程切片胎记分别生成其软件 胎记 Ρβ^ΒΡβ2
具体描述为: 令 SB二、 Birthp'
Figure imgf000014_0002
t≤ m,t Ν、, 它表示一个程序的所有 线程切片胎记的集合, 然后构建一个 SS SB→ PB转换将线程切片胎记集合 SB 转换成其软件胎记 Ρβ, 具体是将线程胎记集合中的每一个线程与其相应的线程 胎记组成一个二元组,作为软件胎记的元素,得到 PB = {(t,Birthp' (k,t))\sb e SB}。
通过上述描述对于程序 S的两个线程切片胎记可以得到其相应的软件胎记 PBx =[{tx,BirthP'i (2,ΐλ)),{ΐ2,ΒίηΗΡ'ί (2,t2))}, 同样对于程序 P2也可以得到其软件胎 记尸 β2 = (2, 2))}。
Figure imgf000015_0001
步骤 S105: 基于最大双边图匹配, 计算 ^与 ^2的最大相似性, 具体流 程如图 5所示。
步骤 S501: 基于软件胎记 内部的每一个线程切片胎记计算其与 Ρβ2内部 每一个线程切片胎记的相似性。 具体描述为: 对于第一程序软件胎记
ΡΒλ = {tx , Birth (tx )) , (ί2 , Birth (t2)) , ( m , Birth (tm ))}和第二程序软件胎记
PB2 ={(?;, Birth (ij )) , (ί2 , Birth (i2 )),..., (ί„ , Birth (i„ )) j,为尸 中的 m个线程切片胎 记分别计算其与 Ρβ2中的 η个线程切片胎记的相似性, 生成一个 m*w阶的相似 性矩阵 SimMatrb^PB PB^, 其中
Figure imgf000015_0002
simc [Birth {tt ) , Birth 针对线程切片胎记^ ,^ ,^〉,…,^^〉)与另一个线程切片胎记 B = {(^,V 人 , Vl、,…人]m,v m \的相似性计算,首先分别使用 cosine距离、 acraW
Dice, Containment四种方法计算二者的相似性:
b c d ;
Figure imgf000015_0003
Figure imgf000015_0004
.„ -, r cosine (A, B) + Jaccard (Α,Β) + Dice( Α,Β) + Containment ( A, B) 性, W'm(A,fi)= ^-^-, 简·记一
' 4 为 simc (Α,Β)。 例如第一程序的软件胎记 中的 Birth (t, )与第二程序的软件胎记 Ρβ2中 的 / )的相似性计算过程为: 首先计算二者的《^Vze距离, 其值为 cosine , 再依次用 Jaccard、
Figure imgf000016_0001
Dice, C¾"toZVzm«z 计算它们的相似性, 得到相似性分别为丄、 丄和丄。 取这四
8 10 16 个值的平均值作为该两个线程切片胎记的最终相似性, 因此 simr { Birth' (2,t), Birth' (2, ;))
1, = (丄 +丄 +丄 +丄」) ÷4 = 0.103。 重复上述步骤为
ΡΒ中的两个线程切片胎记分别计算其与 Ρβ2中的两个线程切片胎记的相似性, 得到 Ρβ!与 ΡΒ2的相似性矩阵
Figure imgf000016_0002
步骤 S502: 基于带权双边图匹配算法生成 与 Ρβ2的最大相似匹配方案 MaxMatch(PBl,PB1)。 具体描述为: 基于相似性矩阵 ι¾«ΜΩ π' (Ρβ1,Ρβ2;), 利用带权双边图匹配 算法为软件胎记 和 Ρβ2中的所有线程切片胎记计算得到最大相似匹配方案, 记为 MaxMatch{PBx , PB2 ) , MaxMatch ( ΡΒλ , ΡΒ2 ) = , ^ ) , (Μ2 , ν2 ) , ... , (Μ
, I = min{m,n) , ut e keyset (PB^j , vt e keyset (^PB2) , ut≠ Uj if i≠ j , vt≠ Vj if i≠ J' ,并 且^ imt(M,,^)在所有的匹配方案中具有最小值。 在上述例子中存在两个匹配方案, 方案一 {PB, ,PB2) = {{ {t2,t2 )} 和方案二^^/^ ^, ^;^^^^,^^ , 但是经过计算两个方案的相似值可 以得到方案一相似值大于方案二, 因此方案一作为 PB与 Ρβ2的最大相似匹配方 步骤 S503: 基于胎记集合 ^!与 ^^的最大相似匹配方案计算其相似性, 具体描述为: 基于软件胎记 ^与 ^2的最大相似性匹配方案, 计算二者相 似性
Figure imgf000017_0001
count keySetl Birth keySet Birthltj 根据上述公式计算得到 Sim^,!^) = 1。 步骤 S106: 不同输入下生成的胎记可能会不一样, 提供多次输入, 会计算 得到一系列的相似值 (^ ,…, ), 取其均值作为最终衡量两个程序相似性的 依据, 以减小随机因素的影响; 并依据输入的可调节阈值 s (取值 0.2-0.3)做出 抄袭与否的决策, 输出检测结果。
具体描述为:对于两个软件 PA和 ^,为它们提供一系列的输入
Figure imgf000017_0002
(第 一程序和第二程序每次的输入相同), 生成的一系列软件胎记分别为
∑sim(PBAi,PBBi)
PBM,PBA2,...,PBAJllPBm,PBB2,...,PBBn, 贝 ^ , ) = ^ 后依据这两个程序的相似性和给定的可调阈值 s来确定抄袭与否, 即: sim(PA,PB
Figure imgf000017_0003

Claims

权利 要 求 书
1、基于线程切片胎记的多线程软件抄袭检测方法, 其特征在于, 包括如下步 骤:
1 ) 基于动态插桩技术, 对待分析目标程序实施运行时监控, 实时地识别待 分析目标程序中系统调用函数, 并记录与之相关的线程 ID、 调用地址、 系统调用 号、 函数名、 参数、 返回值的相关信息, 然后对其进行预处理, 去除无效的系统 调用, 得到有效的系统调用序列 Tmce;
2) 基于线程 ID对有效的系统调用序列 Trace进行线程切片, 生成一系列由 线程 ID标识的线程切片 Slice;
3 ) 基于线程切片, 通过提取线程切片中的固定子序列并记录其出现次数, 分别为待分析的第一程序 ^ 及第二程序 ^2的所有线程切片生成其动态线程切片 胎记 其中第一程序指的是程序所有者开发的原始程序,第二程序指被认为 抄袭了原始程序的可疑程序;
4 )基于多线程程序所有的线程切片胎记分别为 S 和 Ρ2生成相应的软件胎记 ΡΒλ和 ΡΒ2; 5 )基于最大双边图匹配, 计算软件胎记 ^与 ^2的最大相似性, 首先针对 软件胎记 内部的每一个线程切片胎记, 计算其与胎记 Ρβ2内部每一个线程切 片胎记的相似性; 然后基于带权双边图匹配算法生成 与 Ρβ2的最大相似性匹 配方案 MaxMatch {ΡΒλ , PB2) ; 最后基于最大相似性匹配方案, 计算 与 PS2的 胎记相似性 Sz'm^ , ^ ) ; 6 ) 依据多次输入下生成的胎记相似性的均值,及给定的阈值判断是否抄袭。
2、 根据权利要求 1所述的方法, 其特征在于, 所述步骤 1)中动态系统调用 识别原则为: 若当前执行函数名与操作系统系统调用列表中一个系统调用函数名 匹配, 则将该执行函数识别为系统调用函数; 所述步骤 1 ) 中监控实施方法为: 针对二进制的待分析程序, 使用动态插桩技术, 在待分析程序的函数执行之前以 及执行之后植入相应的分析代码, 以实现运行时监控; 所述步骤 1 ) 中系统调用 序列生成方法为: 通过函数级的运行时监控, 捕获每一个待执行的函数, 分析该 函数的类型, 通过匹配当前操作系统的系统调用列表, 根据匹配结果判断该函数 是否为系统调用函数; 同时结合系统调用所在线程 ID, 对每一个执行的系统调用 的所在线程 ID进行记录; 并且捕获与该系统调用相关的调用参数以及返回值等 相关信息; 最后根据分析结果, 对系统调用进行记录并将其加入动态系统调用序 列; 每条系统调用的记录格式为: 线程 ID#调用地址#系统调用号 #函数名 #参数 # 返回值。
3、 根据权利要求 1所述的方法, 其特征在于, 所述步骤 1 ) 中对记录的系 统调用序列进行预处理, 去除无效的系统调用, 得到有效的系统调用序列: 对抽 取的系统调用序列中的每条系统调用项, 解析其格式, 判断其返回值, 若返回值 为非零则表示系统调用执行失败, 则删除该条系统调用;
令 TmCe p, I、 = ^ , e2, ..., e„ ,表示程序/?在输入 /下抽取, 经预处理得到的 一条有效的系统调用序列, 其中 包含一条系统调用的系统调用号以及它所在 的线程 ID。
4、 根据权利要求 1所述的方法, 其特征在于, 所述步骤 2) 中线程切片生 成方法为: 基于有效的运行时系统调用序列, 针对序列中每一个系统调用, 剥离 其线程 ID, 保留其系统调用号, 根据线程 ID标识划分成一系列的线程切片; 令 Slice (/?, /, ) = | e Trace (p, l) and getThreadlD {ej ) = ij ^
j' e {1, 2, "} , 1≤ ≤ m, e N ,· Slice ( p, I, t)表示线程 t对应的线程切片, m代表程 序执行过程中共有 m个线程。
5、 根据权利要求 1所述的方法, 其特征在于, 所述步骤 3 ) 中线程切片胎 记生成方法为: 对线程切片 ^,/,m)应用 k-gmm算法, 得到一个长度为 k子序列 的集合 Set、p, l,t,k) = {gj \gj ={epep--, ej+k_, )} , j' e {1, 2,… , " - + 1} ; 然后统计 独有的 gram个数及其频率, 最终生成一个键值对集合; 令 Birth ( ,t)为程序 p 在输入 /下的线程 ID标识为 t的动态系统调用线程切片胎记,简记为
Figure imgf000020_0001
,表 示为 fiz ( ) = {〈gX g;)〉lg; G Set(p,I,t,k) andVj^j^g. ≠ gJ' , 其中 /r^ ( )表示 在集合 ^ ^,/, ,Α)中出现的次数, k=4或 5。
6、 根据权利要求 1所示的方法, 其特征在于, 所述步骤 4) 中软件胎记生 成方法为: 令 SB = ' k ,t、\L≤ t≤ m,t G Ν、 , 它表示一个程序的所有线程切片 胎记的集合,然后构建一个 SS :SS→Ρβ转换将线程切片胎记集合 转换成其软 件胎记 ΡΒ, 具体是将线程胎记集合中的每一个线程 ID与其相应的线程胎记组成 一个二元组, 作为软件胎记的元素, 得到 PB = {(t,Birthp' (k,t))\sb G SB}。
7、 根据权利要求 1所示的方法, 其特征在于, 所述步骤 5) 中线程切片胎 记相似性计算方法为: 令两个线程切片胎记 A = {〈^Vl〉, ,v2〉, 和
B = {〈 v2〉,…,〈d〉}, 首先分另 'J使用 cosine距离、 Jaccard、 Dice、 Containment四种方法计算二者的相似性, 具体描述如下: a) cosine距离衡量 A及 B的相似性,^« 4, )=«^>^(^,8) = 1 ^^6;
A B b) Jaccard计算 A c) Dice计算 A及 B
Figure imgf000020_0002
d) Containment计算 A及 B的相似性 ,57' (A,fi)= Containment (A, B) = ',"1 x Θ:
A 最后取平均值作为两个线程切片胎记的最终相似
Figure imgf000021_0001
cosine (^Α,Β^ + Jaccard (A, β) + Dce(A, β) + Containment^ Α, β) κ 性, w'm(A,fi) , ISJ QTJ
4 simc (Α,β)。
8、 根据权利要求 7所示的方法, 其特征在于, 所述步骤 5) 中为 内部的 所有线程切片胎记计算其与 Ρβ2内部每一个线程切片胎记的相似性:
对于第一程序软件胎记 = {(t, , Birth (tx )) , (t2 , Birth (t2 )),..., (tm , Birth(tm ))}和第 二程序软件胎记 Ρβ2 = {(?; , Birth (t )) , (t2 , Birth (ί2 )) , ..., (ί„ , Birth (tn )) j, 为 ΡΒλ的 m 个线程切片胎记分别计算其与 Ρβ2中的 η个线程切片胎记的相似性, 生成 m* 阶 的相似性矩阵 SimMatr iPB PB^, 其中 Sz'mMa n';^ ^, ^^^ j] = simc [Birth (ί,. ) , Birth (t) ));所述步骤 5 )中基于带权双边图匹配算法生成 与 PB2 的最大相似性匹配方案 MiwMizfc^PfipPfi : 基于相似性矩阵 Sz'mMiz n';c(A,fi), 利用带权双边图匹配算法为软件胎记 和 Ρβ2中的所有线程切片胎记计算得到 最大相似匹配方案, 记为
Figure imgf000021_0002
MaxMatch ( ΡΒλ , ΡΒ2 ) = (α11),(α22),...,(α ν,)| ,1 = min m,n ,u{ e keyset PB , v,. e keyset (PB2) , ut≠ Uj if i≠ j , v,.≠ Vj if i≠ ,并且 ^ w'mc 在所有的匹配方 案中具有最小值;所述步骤 5)中计算 ^与 ^2的胎记相似性:基于软件胎记 与 Ρβ, 的 最 大 相 似 性 匹 配 方 案 , 计 算 二 者 相 似 性
Figure imgf000021_0003
count key Set [Birth keySet Birth tj
9、 根据权利要求 1所示的方法, 其特征在于, 所述步骤 6) 中抄袭决策模 块将多次输入下得到的第一程序及第二程序胎记相似性的值作为输入, 计算其均 值相似性作为程序的相似性; 并依据输入的可调节阈值 s做出抄袭与否的判断, 输出检测结果.
10、根据权利要求 9所示的方法, 其特征在于, 步骤 6)中阈值 s的取值范围 为 0.2-0.3; sim(PA,PB) =
Figure imgf000022_0001
其中 w'm (P4 , PR )为第一程序及第二程序胎记相似性的均值
PCT/CN2014/076079 2014-03-04 2014-04-24 基于线程切片胎记的多线程软件抄袭检测方法 WO2015131434A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US14/759,642 US9652601B2 (en) 2014-03-04 2014-04-24 Method for plagiarism detection of multithreaded program based on thread slice birthmark

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410076931.XA CN103870721B (zh) 2014-03-04 2014-03-04 基于线程切片胎记的多线程软件抄袭检测方法
CN201410076931.X 2014-03-04

Publications (1)

Publication Number Publication Date
WO2015131434A1 true WO2015131434A1 (zh) 2015-09-11

Family

ID=50909246

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/076079 WO2015131434A1 (zh) 2014-03-04 2014-04-24 基于线程切片胎记的多线程软件抄袭检测方法

Country Status (3)

Country Link
US (1) US9652601B2 (zh)
CN (1) CN103870721B (zh)
WO (1) WO2015131434A1 (zh)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104091283B (zh) * 2014-07-07 2015-07-08 西安交通大学 基于栈操作胎记的报税人身份动态认证方法
CN104077404B (zh) * 2014-07-07 2015-10-21 西安交通大学 基于变长系统调用序列胎记的报税人身份在线识别方法
CN107506622B (zh) * 2017-08-25 2020-05-26 武汉大学 一种基于内存对象访问序列的软件动态胎记及抄袭检测方法
CN107622201B (zh) * 2017-09-18 2018-07-24 湖南大学 一种抗加固的Android平台克隆应用程序快速检测方法
CN108399321B (zh) * 2017-11-03 2021-05-18 西安邮电大学 基于动态指令依赖图胎记的软件局部抄袭检测方法
CN109782989B (zh) 2017-11-14 2021-08-03 腾讯科技(深圳)有限公司 安全验证方法及相关装置
CN107967152B (zh) * 2017-12-12 2020-06-19 西安交通大学 基于最小分支路径函数胎记的软件局部抄袭证据生成方法
CN108446540B (zh) * 2018-03-19 2022-02-25 中山大学 基于源代码多标签图神经网络的程序代码抄袭类型检测方法与系统
CN108830049B (zh) * 2018-05-09 2021-07-20 四川大学 一种基于动态控制流图权重序列胎记的软件相似性检测方法
CN110083534B (zh) * 2019-04-19 2023-03-31 西安邮电大学 一种基于约减最短路径胎记的软件抄袭检测方法
TWI719537B (zh) * 2019-07-16 2021-02-21 國立清華大學 文字比對方法、系統及其電腦程式產品
CN110532739B (zh) * 2019-08-30 2021-04-30 西安邮电大学 一种基于频繁模式挖掘的多线程程序抄袭检测方法
CN112559978B (zh) * 2020-12-18 2022-09-02 北京邮电大学 基于动态胎记的多线程程序抄袭检测方法及相关设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200935257A (en) * 2008-02-14 2009-08-16 Univ Nat Taiwan Science Tech Method for detecting similarity or plagiarism in computer programs
CN101697121A (zh) * 2009-10-26 2010-04-21 哈尔滨工业大学 一种基于程序源代码语义分析的代码相似度检测方法
CN103093128A (zh) * 2013-01-06 2013-05-08 福建三元达通讯股份有限公司 一种嵌入式终端软件防复制抄袭的方法
CN103577323A (zh) * 2013-09-27 2014-02-12 西安交通大学 基于动态关键指令序列胎记的软件抄袭检测方法

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020087949A1 (en) * 2000-03-03 2002-07-04 Valery Golender System and method for software diagnostics using a combination of visual and dynamic tracing
US8223845B1 (en) * 2005-03-16 2012-07-17 Apple Inc. Multithread processing of video frames
US7730452B1 (en) * 2005-11-01 2010-06-01 Hewlett-Packard Development Company, L.P. Testing a component of a distributed system
US7877642B2 (en) * 2008-10-22 2011-01-25 International Business Machines Corporation Automatic software fault diagnosis by exploiting application signatures
CN101976217B (zh) * 2010-10-29 2014-06-04 中兴通讯股份有限公司 网络处理器异常检测方法及系统
CA2777434C (en) * 2012-05-18 2019-09-10 Ibm Canada Limited - Ibm Canada Limitee Verifying application security vulnerabilities
US20140053285A1 (en) * 2012-08-16 2014-02-20 Infosys Limited Methods for detecting plagiarism in software code and devices thereof
US20140337975A1 (en) * 2013-05-08 2014-11-13 Tencent Technology (Shenzhen) Company Limited Method for analyzing spyware and computer system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200935257A (en) * 2008-02-14 2009-08-16 Univ Nat Taiwan Science Tech Method for detecting similarity or plagiarism in computer programs
CN101697121A (zh) * 2009-10-26 2010-04-21 哈尔滨工业大学 一种基于程序源代码语义分析的代码相似度检测方法
CN103093128A (zh) * 2013-01-06 2013-05-08 福建三元达通讯股份有限公司 一种嵌入式终端软件防复制抄袭的方法
CN103577323A (zh) * 2013-09-27 2014-02-12 西安交通大学 基于动态关键指令序列胎记的软件抄袭检测方法

Also Published As

Publication number Publication date
US20160246950A1 (en) 2016-08-25
CN103870721A (zh) 2014-06-18
CN103870721B (zh) 2016-12-07
US9652601B2 (en) 2017-05-16

Similar Documents

Publication Publication Date Title
WO2015131434A1 (zh) 基于线程切片胎记的多线程软件抄袭检测方法
CN106682505B (zh) 一种病毒检测方法、终端、服务器及系统
WO2015101097A1 (zh) 特征提取的方法及装置
CN109388965B (zh) 一种混合数据的脱敏方法及系统
CN109241484B (zh) 一种基于加密技术的网页数据的发送方法及设备
US11163877B2 (en) Method, server, and computer storage medium for identifying virus-containing files
US10678914B2 (en) Virus program detection method, terminal, and computer readable storage medium
CN108563952B (zh) 文件的病毒检测方法、装置及存储介质
WO2017012241A1 (zh) 文件的检测方法、装置、设备及非易失性计算机存储介质
JP2019079492A (ja) コンボリューションのポピュラリティに基づいて異常なイベントを検出するシステムおよび方法
CN113381963A (zh) 一种域名检测方法、装置和存储介质
CN111723846A (zh) 基于随机性特征的加密和压缩流量识别方法及装置
CN111339531B (zh) 恶意代码的检测方法、装置、存储介质及电子设备
CN107819748B (zh) 一种抗破解的验证码实现方法及装置
CN113506045A (zh) 基于移动设备的风险用户识别方法、装置、设备及介质
WO2018121464A1 (zh) 一种病毒检测方法及装置、存储介质
Bayazit et al. Neural network based Android malware detection with different IP coding methods
Bai et al. N-gram, semantic-based neural network for mobile malware network traffic detection
WO2020019520A1 (zh) 应用程序获取方法及装置
CN109413450B (zh) 一种弹幕数据的完整性校验方法、装置、终端及存储介质
CN108256327B (zh) 一种文件检测方法及装置
US20220272125A1 (en) Systems and methods for malicious url pattern detection
CN114416806A (zh) 电力安全知识数据的采集方法、装置及计算机设备
CN113806204A (zh) 一种报文字段相关性的评估方法、装置、系统及存储介质
US10671505B2 (en) System and method for monitoring service

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 14759642

Country of ref document: US

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14884485

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14884485

Country of ref document: EP

Kind code of ref document: A1