Feature: Add menu to build and test AES encrypted shellcode

This commit is contained in:
yuanyuanxiang
2025-11-10 06:34:38 +08:00
parent ce825cffb1
commit 924aa1d7e1
5 changed files with 50 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include "aes.h"
#pragma once
class ObfsBase
@@ -100,3 +101,25 @@ public:
}
}
};
class ObfsAes : public ObfsBase {
private:
// Please change `aes_key` and `aes_iv`.
unsigned char aes_key[16] = "It is a example";
unsigned char aes_iv[16] = "It is a example";
public:
ObfsAes(bool genCArray = true) : ObfsBase(genCArray) { }
virtual void ObfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed) {
struct AES_ctx ctx;
AES_init_ctx_iv(&ctx, aes_key, aes_iv);
AES_CBC_encrypt_buffer(&ctx, buf, len);
}
virtual void DeobfuscateBuffer(uint8_t* buf, size_t len, uint32_t seed) {
struct AES_ctx ctx;
AES_init_ctx_iv(&ctx, aes_key, aes_iv);
AES_CBC_decrypt_buffer(&ctx, buf, len);
}
};