The invention belongs to the technical field of network security, and particularly relates to a program semantic confusion method and system based on natural language process.The method comprises the steps that firstly, a text sequence used for describing a program execution process is extracted from a flow description text corpus, and a confusion corpus material library with induction and fuzzy functions is constructed; secondly, vectorizing the target program code snippets, selecting text sequences irrelevant to the target program code snippets from the obfuscated corpus material library according to the semantic information as prompt output class codes, and fusing the prompt output class codes to the positions of the target program code snippets; according to the method, the semantic confusion corpus with inductivity and fuzziness is fused into the target code, the confusion code with semantic analysis resistance is generated, understanding of reverse analysts on real functions of a program can be misguided, the code understanding difficulty is increased, legal software can be effectively prevented from being pirated or maliciously tampered, and the method has good application prospects.