计算机工程 ›› 2018, Vol. 44 ›› Issue (5): 113-118.doi: 10.19678/j.issn.1000-3428.0046314

• 安全技术 • 上一篇    下一篇

基于操作码合并的Python程序防逆转算法

王小强 1a,2,顾乃杰 1a,1b,2   

  1. 1.中国科学技术大学 a.计算机科学与技术学院; b.先进技术研究院,合肥 230027;2.安徽省计算与通信软件重点实验室,合肥 230027
  • 收稿日期:2017-03-10 出版日期:2018-05-15 发布日期:2018-05-15
  • 作者简介:王小强(1991—),男,硕士,主研方向为软件安全、软件脆弱性检测;顾乃杰,教授、博士生导师。
  • 基金项目:
    安徽省自然科学基金(1408085MKL06);高等学校学科创新引智计划项目(B07033)。

Python Program Anti-reversal Algorithm Based on Opcode Merging

WANG Xiaoqiang  1a,2,GU Naijie  1a,1b,2   

  1. 1a.School of Computer Science and Technology; 1b.Institute of Advanced Technology,University of Science and Technology of China,Hefei 230027,China;2.Anhui Province Key Laboratory of Computing and Communication Software,Hefei 230027,China
  • Received:2017-03-10 Online:2018-05-15 Published:2018-05-15

摘要: 由Python编程语言编写的程序,其编译生成的字节码是针对Python虚拟机的具有特定结构的文件,该文件很容易被逆向工具反编译,从而损害开发者的经济利益和个人隐私。传统的防逆转方法存在其处理后的字节码文件易被破解、程序运行效率低等问题。为此,提出一种新的Python字节码文件保护算法。在不影响程序执行结果的前提下,将Python字节码文件中的多个操作码合并为一个新操作码,改变操作码序列的结构和语义,最终达到防逆转的目的。实验结果表明,该算法不仅能防止Python字节码文件被反编译,而且可以减小字节码文件的存储空间,提升程序执行效率。

关键词: 字节码文件, 反编译, 防逆转, 虚拟机操作码, 操作码合并

Abstract: The program written by Python programming language is compiled and generated bytecode,which is a specific structure for Python virtual machine.The file is easily decompressed by reverse tools,thereby damaging the economic interests and personal privacy of developers.The traditional method of anti-reversal has the problems of easily deciphered bytecode files and low program efficiency after processing.To solve the above problem,a new Python bytecode file protection algorithm is proposed,which mereges multiple opcodes in the Python bytecode file into a new opcode without changing the execute result of the program,changes the opcode sequence structure and semantics,and achieves the purpose of anti-reversal finally.Experimental results show that the proposed algorithm not only prevents the bytecode files from being decompilated,but also reduces the storage space of the bytecode file and improves the efficiency of program execution.

Key words: bytecode file, decompile, anti-reversal, virtual machine opcode, opcode merging

中图分类号: