当前位置:首页>Linux>给Linux程序穿“隐身衣”——ELF运行时加密器全解析(C/C++代码实现)

给Linux程序穿“隐身衣”——ELF运行时加密器全解析(C/C++代码实现)

  • 2026-07-04 05:08:26
给Linux程序穿“隐身衣”——ELF运行时加密器全解析(C/C++代码实现)

一、什么是ELF运行时加密器?通俗讲清核心含义

咱们平时在Linux系统(比如Debian、Fedora)里运行的可执行程序,不管是系统自带的date、ls命令,还是自己写的C程序,本质都是ELF格式二进制文件

正常情况下,这类程序运行时,系统会把文件从硬盘读到内存,黑客或逆向分析人员很容易通过静态分析(直接扒硬盘

里的文件)、内存分析(抓内存里的程序数据)拿到源码逻辑、敏感逻辑,甚至篡改程序。

而咱们要讲的这款运行时加密器,就是给ELF程序量身定做的“隐身防护衣”,核心作用一句话概括:把原始ELF程序加密成乱码,生成一个新的加密程序;运行这个加密程序时,它不会把解密后的原始程序写回硬盘,而是直接在内存里解密、直接运行,用完还会自动擦除内存敏感数据,让分析人员抓不到完整的原始程序,大幅提升逆向破解难度。

简单对比两种运行模式:

  • 普通程序:硬盘存明文 → 读入内存 → 运行(全程明文可抓)
  • 加密后程序:硬盘存密文 → 内存解密 → 内存直接运行 → 内存数据擦除(硬盘无明文,内存暴露时间极短)

它不是永久加密锁死程序,而是运行时动态解密、内存级隐身执行,兼顾程序正常使用和防逆向防护,常用于Linux环境下的程序版权保护、敏感功能防篡改、恶意程序分析规避(正规用途仅限合法程序防护)。

二、核心前置知识点:先搞懂基础,再看原理

这款加密器涉及多个Linux底层和密码学领域,先把核心知识点拆解开,零基础也能跟上:

  1. ELF文件:Linux系统专属的可执行文件格式,类似Windows的exe,所有Linux运行的程序、动态库都是ELF格式,是本次加密的核心对象。
  2. AES-256-CBC加密:目前主流的对称加密算法,安全性极高,需要32位密钥(KEY)和16位初始向量(IV),加密解密用同一套密钥,是本次加密的核心算法,保证原始程序被彻底打乱成乱码。
  3. Memfd内存匿名文件:Linux特有的内存文件机制,创建的文件只存在于内存中,不落地硬盘,用完即销毁,是实现“程序不落地”的核心技术。
  4. 父子进程隔离:通过fork创建子进程,把解密、运行等敏感操作放在子进程,父进程只做等待,避免敏感数据泄露,提升安全性。
  5. 安全内存擦除:程序运行完后,用随机数覆盖内存里的密钥、解密后的数据,防止内存残留被抓取,符合NIST数据安全销毁标准。
  6. OpenSSL密码库:Linux下常用的加密算法库,提供AES加密、随机数生成等功能,是加密器的依赖基础。

三、整体设计思路:从加密到运行

整个加密器的设计分为两大核心模块,全程围绕“加密原始程序→生成自解密程序→内存隐身运行”三步走,没有复杂冗余设计,每一步都服务于“隐身防护”:

核心设计代码和总流程

...
voidsecure_wipe(void *ptr, size_t size){
if (ptr == NULL || size == 0return;

volatileunsignedchar *p = (volatileunsignedchar *)ptr;

while (size--) {
        *p++ = (unsignedchar)arc4random();
    }

    __asm__ __volatile__ ("" : : : "memory");
}

intutf8_strlen(constchar *str){
int chars = 0;
while (*str) {

if ((*str & 0xC0) != 0x80) {
            chars++;
        }
        str++;
    }
return chars;
}

// Function to get terminal width
intget_terminal_width(void){
structwinsizew;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0) {
return w.ws_col;
    }
char *columns = getenv("COLUMNS");
if (columns) {
return atoi(columns);
    }
return80
}


voidprint_centered_red(constchar *text){
int term_width = get_terminal_width();
int text_chars = utf8_strlen(text);  

int padding = (term_width - text_chars) / 2;
if (padding < 0) padding = 0;

printf("\033[0;31m%*s%s\033[0m\n", padding, "", text);
}

longget_file_size_safe(FILE *f){
long current = ftell(f);
if (fseek(f, 0, SEEK_END) != 0) {
return-1;
    }
long size = ftell(f);
    fseek(f, current, SEEK_SET);
return size;
}

voidencrypt_file(constchar *input_path, constchar *output_path, 
constunsignedchar *key, constunsignedchar *iv)
{
    FILE *in = fopen(input_path, "rb");
    FILE *out = fopen(output_path, "wb");

if (!in || !out) {
        perror("File error");
exit(1);
    }

long size = get_file_size_safe(in);
if (size <= 0) {
fprintf(stderr"Invalid file size: %ld\n", size);
        fclose(in);
        fclose(out);
exit(1);
    }

if (size > MAX_BINARY_SIZE) {
fprintf(stderr"File too large: %ld bytes (max: %d)\n", size, MAX_BINARY_SIZE);
        fclose(in);
        fclose(out);
exit(1);
    }

unsignedchar *plaintext = malloc(size);
    CHECK_NULL(plaintext, "malloc failed");

size_t bytes_read = fread(plaintext, 1, size, in);
if (bytes_read != (size_t)size) {
fprintf(stderr"Read error: expected %ld, got %zu\n", size, bytes_read);
        secure_wipe(plaintext, size);
free(plaintext);
        fclose(in);
        fclose(out);
exit(1);
    }

    EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
    CHECK_NULL(ctx, "EVP_CIPHER_CTX_new failed");

if (EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv) != 1) {
        perror("EVP_EncryptInit_ex failed");
        EVP_CIPHER_CTX_free(ctx);
        secure_wipe(plaintext, size);
free(plaintext);
        fclose(in);
        fclose(out);
exit(1);
    }

size_t ciphertext_buf_size = size + EVP_CIPHER_block_size(EVP_aes_256_cbc());
unsignedchar *ciphertext = malloc(ciphertext_buf_size);
    CHECK_NULL(ciphertext, "malloc failed for ciphertext");

int len, ciphertext_len = 0;

if (EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, size) != 1) {
        perror("EVP_EncryptUpdate failed");
        EVP_CIPHER_CTX_free(ctx);
        secure_wipe(plaintext, size);
        secure_wipe(ciphertext, ciphertext_buf_size);
free(plaintext);
free(ciphertext);
        fclose(in);
        fclose(out);
exit(1);
    }
    ciphertext_len = len;

if (EVP_EncryptFinal_ex(ctx, ciphertext + ciphertext_len, &len) != 1) {
        perror("EVP_EncryptFinal_ex failed");
        EVP_CIPHER_CTX_free(ctx);
        secure_wipe(plaintext, size);
        secure_wipe(ciphertext, ciphertext_buf_size);
free(plaintext);
free(ciphertext);
        fclose(in);
        fclose(out);
exit(1);
    }
    ciphertext_len += len;

    fwrite(ciphertext, 1, ciphertext_len, out);

    EVP_CIPHER_CTX_free(ctx);

    secure_wipe(plaintext, size);
    secure_wipe(ciphertext, ciphertext_buf_size);
free(plaintext);
free(ciphertext);
    fclose(in);
    fclose(out);
}

voidcreate_self_decrypting_stub(constchar *encrypted_path, 
constunsignedchar *key,
constunsignedchar *iv)
{
    FILE *enc = fopen(encrypted_path, "rb");
if (enc == NULL) {
        perror("Failed to open encrypted file");
exit(1);
    }

    fseek(enc, 0, SEEK_END);
long enc_size = ftell(enc);
    fseek(enc, 0, SEEK_SET);

if (enc_size <= 0 || enc_size > MAX_BINARY_SIZE) {
fprintf(stderr"Invalid encrypted file size: %ld\n", enc_size);
        fclose(enc);
exit(1);
    }

unsignedchar *enc_data = malloc(enc_size);
    CHECK_NULL(enc_data, "malloc failed for enc_data");

size_t bytes_read = fread(enc_data, 1, enc_size, enc);
if (bytes_read != (size_t)enc_size) {
fprintf(stderr"Read error: expected %ld, got %zu\n", enc_size, bytes_read);
        fclose(enc);
        secure_wipe(enc_data, enc_size);
free(enc_data);
exit(1);
    }
    fclose(enc);

    FILE *out = fopen("stub.c""w");
if (!out) {
        perror("Failed to create stub.c");
        secure_wipe(enc_data, enc_size);
free(enc_data);
exit(1);
    }

fprintf(out, "
#define _GNU_SOURCE\n");
fprintf(out, "#include <stdio.h>\n");
fprintf(out, "#include <stdlib.h>\n");
fprintf(out, "#include <string.h>\n");
fprintf(out, "#include <unistd.h>\n");
fprintf(out, "#include <sys/mman.h>\n");
fprintf(out, "#include <sys/wait.h>\n");
fprintf(out, "#include <fcntl.h>\n");
fprintf(out, "#include <sys/random.h>\n");
fprintf(out, "#include <time.h>\n");
fprintf(out, "#include <openssl/evp.h>\n");
fprintf(out, "#include <elf.h>\n\n");

// Add secure_wipe function to stub
fprintf(out, "static void secure_wipe(void *ptr, size_t size) {\n");
fprintf(out, "    if (ptr == NULL || size == 0) return;\n");
fprintf(out, "    volatile unsigned char *p = (volatile unsigned char *)ptr;\n");
fprintf(out, "    while (size--) *p++ = 0;\n");
fprintf(out, "}\n\n");

// Embedded encrypted data
fprintf(out, "static const unsigned char encrypted_data[] = {\n");
for (int i = 0; i < enc_size; i++) {
fprintf(out, "0x%02x", enc_data[i]);
if (i < enc_size - 1) {
if ((i + 1) % 16 == 0fprintf(out, ",\n");
elsefprintf(out, ", ");
        }
    }
fprintf(out, "\n};\n\n");

// Embedded key
fprintf(out, "static const unsigned char key[32] = {");
for (int i = 0; i < 32; i++) {
fprintf(out, "0x%02x", key[i]);
if (i < 31fprintf(out, ", ");
    }
fprintf(out, "};\n\n");

// Embedded IV
fprintf(out, "static const unsigned char iv[16] = {");
for (int i = 0; i < 16; i++) {
fprintf(out, "0x%02x", iv[i]);
if (i < 15fprintf(out, ", ");
    }
fprintf(out, "};\n\n");
// Create stub.c    
fprintf(out, "static void fast_decrypt_execute(int argc, char **argv) {\n");
fprintf(out, "    // Create memfd for decrypted binary\n");
fprintf(out, "    int fd = memfd_create(\"decrypted_elf\", MFD_CLOEXEC);\n");
fprintf(out, "    if (fd == -1) {\n");
fprintf(out, "        perror(\"memfd_create failed\");\n");
fprintf(out, "        exit(1);\n");
fprintf(out, "    }\n");
fprintf(out, "    \n");
fprintf(out, "    // Fork first - sensitive operations happen in child only\n");
fprintf(out, "    pid_t pid = fork();\n");
fprintf(out, "    if (pid == 0) {\n");
fprintf(out, "        // CHILD PROCESS: All sensitive operations here\n");
fprintf(out, "        // Setup decryption\n");
fprintf(out, "        EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();\n");
fprintf(out, "        if (!ctx) {\n");
fprintf(out, "            perror(\"EVP_CIPHER_CTX_new failed\");\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        \n");
fprintf(out, "        if (EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv) != 1) {\n");
fprintf(out, "            perror(\"EVP_DecryptInit_ex failed\");\n");
fprintf(out, "            EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        \n");
fprintf(out, "        // Allocate buffer for decrypted data IN CHILD ONLY\n");
fprintf(out, "        size_t encrypted_size = sizeof(encrypted_data);\n");
fprintf(out, "        size_t buffer_size = encrypted_size + EVP_CIPHER_block_size(EVP_aes_256_cbc());\n");
fprintf(out, "        unsigned char *decrypted = malloc(buffer_size);\n");
fprintf(out, "        if (!decrypted) {\n");
fprintf(out, "            perror(\"malloc failed for decryption buffer\");\n");
fprintf(out, "            EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        \n");
fprintf(out, "        int total_len = 0;\n");
fprintf(out, "        \n");
fprintf(out, "        // Decrypt all at once\n");
fprintf(out, "        if (EVP_DecryptUpdate(ctx, decrypted, &total_len, encrypted_data, encrypted_size) != 1) {\n");
fprintf(out, "            perror(\"EVP_DecryptUpdate failed\");\n");
fprintf(out, "            secure_wipe(decrypted, buffer_size);\n");
fprintf(out, "            free(decrypted);\n");
fprintf(out, "            EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        \n");
fprintf(out, "        int final_len;\n");
fprintf(out, "        if (EVP_DecryptFinal_ex(ctx, decrypted + total_len, &final_len) != 1) {\n");
fprintf(out, "            perror(\"EVP_DecryptFinal_ex failed\");\n");
fprintf(out, "            secure_wipe(decrypted, buffer_size);\n");
fprintf(out, "            free(decrypted);\n");
fprintf(out, "            EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        total_len += final_len;\n");
fprintf(out, "        \n");
fprintf(out, "        // Write all at once\n");
fprintf(out, "        ssize_t written = write(fd, decrypted, total_len);\n");
fprintf(out, "        if (written != total_len) {\n");
fprintf(out, "            perror(\"write failed\");\n");
fprintf(out, "            secure_wipe(decrypted, buffer_size);\n");
fprintf(out, "            free(decrypted);\n");
fprintf(out, "            EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "            close(fd);\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "        \n");
fprintf(out, "        // Clean up decryption context IMMEDIATELY\n");
fprintf(out, "        EVP_CIPHER_CTX_free(ctx);\n");
fprintf(out, "        \n");
fprintf(out, "        // Secure wipe decrypted data from memory IMMEDIATELY\n");
fprintf(out, "        secure_wipe(decrypted, buffer_size);\n");
fprintf(out, "        free(decrypted);\n");
fprintf(out, "        \n");
fprintf(out, "        // IMMEDIATELY execute - minimal exposure window\n");
fprintf(out, "        lseek(fd, 0, SEEK_SET);\n");
fprintf(out, "        \n");
fprintf(out, "        // Child process - use fexecve (Linux 2.6.16+)\n");
fprintf(out, "        fexecve(fd, argv, environ);\n");
fprintf(out, "        \n");
fprintf(out, "        // If fexecve fails\n");
fprintf(out, "        perror(\"fexecve failed\");\n");
fprintf(out, "        close(fd);\n");
fprintf(out, "        exit(1);\n");
fprintf(out, "    } else if (pid > 0) {\n");
fprintf(out, "        // PARENT PROCESS: No sensitive data here\n");
fprintf(out, "        close(fd);  // Parent doesn't need the fd\n");
fprintf(out, "        \n");
fprintf(out, "        int status;\n");
fprintf(out, "        waitpid(pid, &status, 0);\n");
fprintf(out, "        \n");
fprintf(out, "        if (WIFEXITED(status)) {\n");
fprintf(out, "            exit(WEXITSTATUS(status));\n");
fprintf(out, "        } else {\n");
fprintf(out, "            exit(1);\n");
fprintf(out, "        }\n");
fprintf(out, "    } else {\n");
fprintf(out, "        perror(\"fork failed\");\n");
fprintf(out, "        close(fd);\n");
fprintf(out, "        exit(1);\n");
fprintf(out, "    }\n");
fprintf(out, "}\n\n");
// Main function
fprintf(out, "int main(int argc, char **argv) {\n");
fprintf(out, "    // Use the ultra-fast decryption and execution\n");
fprintf(out, "    fast_decrypt_execute(argc, argv);\n");
fprintf(out, "    \n");
fprintf(out, "    // Should not reach here\n");
fprintf(out, "    return 1;\n");
fprintf(out, "}\n");    
    fclose(out);

    secure_wipe(enc_data, enc_size);
free(enc_data);
}

intmain(int argc, char *argv[]){
if (argc != 3) {
printf("\nUsage: %s <input_binary> <output_encrypted>\n", argv[0]);
return1;
    }
else {
printf("Trying all the things...\n");
    }

if (access(argv[1], R_OK) != 0) {
        perror("Cannot access input file");
return1;
    }

// Generate random key and IV
unsignedchar key[KEY_SIZE];
unsignedchar iv[IV_SIZE];

if (RAND_bytes(key, KEY_SIZE) != 1) {
fprintf(stderr"Failed to generate random key\n");
return1;
    }

if (RAND_bytes(iv, IV_SIZE) != 1) {
fprintf(stderr"Failed to generate random IV\n");
return1;
    }

printf("Encrypting %s...", argv[1]); 
    encrypt_file(argv[1], "encrypted.bin", key, iv);    
    create_self_decrypting_stub("encrypted.bin", key, iv);

char cmd[512];
snprintf(cmd, sizeof(cmd), 
"gcc -o \"%s\" stub.c -lssl -lcrypto -fPIC -pie "
"-Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack "
"-fstack-protector-strong -Os -D_FORTIFY_SOURCE=2 ",
             argv[2]);

if (system(cmd) != 0) {
fprintf(stderr"Compilation failed\n");

        remove("encrypted.bin");
        remove("stub.c");
exit(1);
    }


if (remove("encrypted.bin") != 0) {
        perror("Warning: Could not remove encrypted.bin");
    }

if (remove("stub.c") != 0) {
        perror("Warning: Could not remove stub.c");
    }

    FILE *keyfile = fopen("key.bin""wb");
if (keyfile) {
        fwrite(key, 1, KEY_SIZE, keyfile);
        fwrite(iv, 1, IV_SIZE, keyfile);
        fclose(keyfile);
        chmod("key.bin"0600);
    }

...

return0;
}


If you need the complete source code, please add the WeChat number (c17865354792)

原始ELF程序 → 【加密模块】AES-256-CBC加密 → 生成临时密文文件
→ 【自解密桩生成模块】把密文、密钥、IV打包成C代码(stub.c)
→ 编译stub.c → 生成最终加密可执行程序
→ 运行加密程序 → 子进程内存解密 → Memfd创建内存文件 → 直接运行内存程序 → 擦除内存数据 → 程序结束

分模块设计思路详解

1. 加密模块:给原始程序“上锁”

核心目标:把明文ELF程序变成不可读的密文,同时生成唯一的密钥和IV。

  • 限制文件大小:最大支持100MB,避免大文件内存溢出、加密效率过低;
  • 真随机密钥生成:用OpenSSL的真随机数函数生成32位密钥和16位IV,每次加密都不一样,杜绝密钥被预测;
  • 分段加密:采用64KB分块加密,适配内存读写效率,避免一次性加载大文件卡顿;
  • 安全兜底:所有文件操作、内存操作都加错误校验,失败立即退出,同时擦除内存敏感数据。

2. 自解密桩模块:打造“自带钥匙的隐身壳”

核心目标:把密文、密钥、解密逻辑打包成一个独立程序,实现“运行即解密、解密即运行”,全程不落地。

  • 代码嵌入:把加密后的密文、密钥、IV直接写成C语言数组,嵌入到自动生成的stub.c代码里,不需要额外依赖密钥文件;
  • 进程隔离:敏感解密操作全放在子进程,父进程不接触任何密钥、明文数据,防止父进程被劫持导致泄露;
  • 内存运行:用memfd_create创建匿名内存文件,解密后的原始程序直接写入内存,不生成硬盘临时文件,彻底杜绝硬盘痕迹;
  • 极速擦除:解密完成、程序写入内存后,立即擦除内存里的密钥、明文数据,缩短敏感数据暴露窗口;
  • 直接执行:用fexecve直接运行内存文件,不需要读取硬盘,执行完子进程退出,内存文件自动销毁。

3. 安全清理模块:不留任何痕迹

核心目标:加密完成、程序运行结束后,彻底清理所有临时文件和内存数据,避免残留。

  • 加密端:删除临时密文文件、自动生成的stub.c源码;
  • 运行端:子进程运行完后,自动擦除内存里的解密数据、密钥,父进程退出后释放所有资源;
  • 密钥保护:密钥仅临时存于栈内存,使用完毕立即用随机数覆盖,不持久化保存(仅可选生成权限严格的密钥备份文件)。

四、代码核心逻辑拆解:挑重点讲

结合你提供的完整代码,避开逐行枯燥讲解,只拆解最核心、最能体现设计思路的代码片段,讲清“代码做什么、为什么这么做”:

1. 基础宏定义与安全函数

#define KEY_SIZE 32    // AES-256要求的32位密钥
#define IV_SIZE 16     // CBC模式要求的16位初始向量
#define MAX_BINARY_SIZE (100 * 1024 * 1024) // 最大支持100MB程序

// 安全内存擦除:用随机数覆盖内存,防止数据残留
voidsecure_wipe(void *ptr, size_t size){
volatileunsignedchar *p = (volatileunsignedchar *)ptr;
while (size--) {
        *p++ = (unsignedchar)arc4random(); // 随机数覆盖,不可恢复
    }
    __asm__ __volatile__ ("" : : : "memory"); // 内存屏障,确保擦除执行
}

解析:这部分是安全基础,KEY和IV的长度是AES-256-CBC的硬性要求,改了就无法正常解密;secure_wipe函数是核心防护,不用简单的0覆盖,而是用随机数覆盖,符合专业数据销毁标准,彻底杜绝内存残留。

2. 加密核心函数:encrypt_file

// 初始化AES加密上下文,指定加密算法
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv);
// 执行加密,生成密文
EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, size);
EVP_EncryptFinal_ex(ctx, ciphertext + ciphertext_len, &len);

解析:这是加密的核心代码,先创建加密“工具箱”(上下文),指定用AES-256-CBC算法,传入密钥和IV;然后分两步完成加密,先处理主体数据,再处理末尾补齐数据,确保密文完整。加密完成后,立即擦除内存里的原始程序和密文,不留下临时数据。

3. 自解密核心函数:create_self_decrypting_stub

这部分是“隐身衣”的灵魂,代码会自动生成一个名为stub.c的C语言文件,里面包含:

  • 嵌入的加密后程序数组;
  • 固定的密钥和IV数组;
  • 子进程解密、内存运行的完整逻辑。

核心代码片段:

// 创建内存匿名文件,不落地硬盘
int fd = memfd_create("decrypted_elf", MFD_CLOEXEC);
// 创建子进程,子进程负责解密运行
pid_t pid = fork();
if (pid == 0) {
// 子进程:初始化解密,解密密文
    EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv);
    EVP_DecryptUpdate(ctx, decrypted, &total_len, encrypted_data, encrypted_size);
// 解密后写入内存文件
    write(fd, decrypted, total_len);
// 立即擦除解密数据
    secure_wipe(decrypted, buffer_size);
// 直接运行内存里的程序
    fexecve(fd, argv, environ);
}

解析:memfd_create是实现“不落地”的关键,生成的文件只有文件描述符,没有硬盘路径;fork隔离父子进程,子进程做完所有敏感操作,父进程只等待;fexecve直接执行内存文件,全程不碰硬盘,解密完成后立刻擦除数据,敏感数据在内存里只存在几毫秒,根本来不及被抓取。

4. 主函数:串联全流程

主函数负责接收用户输入(原始程序路径、输出加密程序路径),生成密钥和IV,调用加密函数生成密文,再调用自解密函数生成stub.c,最后编译成最终的加密程序,同时清理临时文件,打印密钥和IV方便备份。


五、准备测试目标

编译成功后会生成 ./crypter

找一个系统自带的 ELF 程序做测试,比如 date

cp /bin/date ./date_test

# 先看看原始程序长啥样
file ./date_test
strings ./date_test | head -20

strings 能看到一堆可读字符串,说明原始程序是"裸奔"的。


六、运行加密器

./crypter ./date_test ./date_enc

你会看到类似这样的输出:

Trying all the things...
Encrypting ./date_test...
Created: ./date_enc
Key (hex): 8ab5f658808ed30c068433965f4ab788cb4987e102e38218f5362e0126a040e7
IV  (hex): d3dcd288435bb59b93216f40f090e733

同时目录下会多出两个文件:

  • ./date_enc —— 加密后的可执行文件(自解密存根)
  • ./key.bin —— 密钥文件(权限 0600,只有你能读)

七、测试加密后的程序

7.1 基本功能测试

# 运行加密后的程序,看功能是否正常
./date_enc

# 带参数试试
./date_enc +%Y-%m-%d
./date_enc -u

如果输出和原版的 ./date_test 一模一样,说明解密+执行链路通顺

7.2 对比文件特征

# 看文件类型
file ./date_test
file ./date_enc

# 扫字符串
strings ./date_test | head -10
strings ./date_enc | head -10

你会发现:

  • date_testELF 64-bit LSB executable...strings 能扫出大量英文
  • date_enc:虽然也是 ELF,但 strings 几乎扫不出有意义的内容(只有 OpenSSL 和 libc 的导入表字符串)

7.3 检查是否落盘

这是最关键的特性验证——解密后的程序是否写到了磁盘上

# 方法1:运行期间另开一个终端,搜索临时文件
sudo find /tmp /dev/shm /var/tmp -type f -mmin -1 2>/dev/null

# 方法2:用 lsof 跟踪文件打开情况
./crypter ./date_test ./date_enc   # 先准备好
./date_enc &                       # 后台运行
PID=$!
sudo lsof -p $PID | grep REG       # 看打开了哪些普通文件
kill$PID

你会发现 ./date_enc 运行时没有任何临时文件落到磁盘,所有操作都在内存里完成。

7.4 检查进程树

# 运行加密程序
./date_enc &

# 看进程关系
pstree -p | grep date_enc

# 或者直接看
ps aux | grep date

你会看到类似这样的结构:

crypter(父进程)───date_enc(子进程)───date(原始程序)

实际上因为 fexecve 会替换子进程映像,最终看到的应该是:

  • 一个父进程(Stub 的父进程,在 waitpid
  • 一个子进程(已经被替换成了原始的 date 程序)

7.5 内存残留检查(进阶)

想验证 secure_wipe 是否真的擦了内存,可以用 gdb  attach:

# 终端1:运行加密程序,加个 sleep 方便 attach
# 修改测试程序,或者用一个会暂停的程序
cp /bin/sleep ./sleep_test
./crypter ./sleep_test ./sleep_enc

# 终端2:在 sleep_enc 运行时 attach
pgrep -f sleep_enc
sudo gdb -p <PID>

# 在 gdb 里搜索内存中是否还有原始 ELF 的 magic 头 \x7fELF
find /proc/<PID>/mem, +0x10000000, "\x7fELF"

不过因为 fexecve 替换得非常快,这个窗口期极短,很难抓。这也侧面证明了设计的有效性。


总结

这款Linux ELF运行时加密器,没有复杂的底层黑魔法,而是把Linux内存机制、密码学、进程安全三大核心知识点巧妙结合,用最简单的逻辑实现了高效的程序隐身防护。

它的核心价值不在于“加密”本身,而在于“内存运行、不留痕迹”的设计思路,彻底切断了逆向分析的核心路径,不管是个人程序版权保护,还是企业敏感程序防护,都能低成本实现高效防护。

读懂它的原理,不仅能学会给Linux程序做基础防护,更能吃透Linux底层内存和进程的核心逻辑,对Linux编程和系统安全学习都有很大帮助。

Welcome to follow WeChat official account【程序猿编码

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 09:37:31 HTTP/2.0 GET : https://f.mffb.com.cn/a/488517.html
  2. 运行时间 : 0.094978s [ 吞吐率:10.53req/s ] 内存消耗:5,388.10kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e198a3ed19e11159a4a3c2afb235c00f
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000685s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000842s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000325s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000282s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000471s ]
  6. SELECT * FROM `set` [ RunTime:0.000198s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000599s ]
  8. SELECT * FROM `article` WHERE `id` = 488517 LIMIT 1 [ RunTime:0.000708s ]
  9. UPDATE `article` SET `lasttime` = 1783129051 WHERE `id` = 488517 [ RunTime:0.007085s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000319s ]
  11. SELECT * FROM `article` WHERE `id` < 488517 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.002571s ]
  12. SELECT * FROM `article` WHERE `id` > 488517 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000735s ]
  13. SELECT * FROM `article` WHERE `id` < 488517 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001146s ]
  14. SELECT * FROM `article` WHERE `id` < 488517 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002549s ]
  15. SELECT * FROM `article` WHERE `id` < 488517 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.008403s ]
0.096563s