Compare commits
3 Commits
c9798f4816
...
aa1e34b7d0
Author | SHA1 | Date | |
---|---|---|---|
|
aa1e34b7d0 | ||
|
ef611dd100 | ||
|
e3efd4f5d2 |
@ -5,7 +5,7 @@ Pasticciotto is a virtual machine which can be used to obfuscate code. It was de
|
||||
|
||||
I wanted to experiment with VM obfuscation since it was a topic that caught my attention while reversing challenges for various CTFs. So, I decided to write one **from scratch** in order to understand better how instruction set architectures are implemented!
|
||||
|
||||
The design and the implementation behind Pasticciotto are not state-of-the-art but hey, it works!
|
||||
The design and the implementation behind Pasticciotto are not state-of-the-art but hey, it works! :D
|
||||
|
||||
# Why "Pasticciotto"?
|
||||
In Italian, "Pasticciotto" has two meanings!
|
||||
|
@ -105,7 +105,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
unsigned char opcode_key[] = {0x48, 0x61, 0x76, 0x65, 0x46, 0x75, 0x6e,
|
||||
0x21, 0x50, 0x6f, 0x6c, 0x69, 0x43, 0x54,
|
||||
0x46, 0x32, 0x30, 0x31, 0x37, 0x21};
|
||||
0x46, 0x32, 0x30, 0x31, 0x37, 0x21, 0x00};
|
||||
|
||||
printf("%s", banner);
|
||||
printf("\nHmmm...\n");
|
||||
|
10
vm/vm.cpp
10
vm/vm.cpp
@ -10,6 +10,7 @@ void VM::encryptOpcodes(uint8_t *key) {
|
||||
uint32_t i, j, tmp, keysize;
|
||||
keysize = strlen((char *)key);
|
||||
|
||||
DBG_INFO(("Using key: %s\n", key));
|
||||
/*
|
||||
RC4 KSA! :-D
|
||||
*/
|
||||
@ -539,7 +540,7 @@ bool VM::execDIVR(void) {
|
||||
}
|
||||
bool VM::execSHLI(void) {
|
||||
/*
|
||||
DIVI R0, 0x2 | R0 /= 2
|
||||
SHLI R0, 0x2 | R0 << 2
|
||||
*/
|
||||
uint8_t dst;
|
||||
uint16_t src;
|
||||
@ -555,7 +556,7 @@ bool VM::execSHLI(void) {
|
||||
}
|
||||
bool VM::execSHLR(void) {
|
||||
/*
|
||||
SHLR R0, R1 -> R0 /= R1
|
||||
SHLR R0, R1 -> R0 << R1
|
||||
*/
|
||||
uint8_t dst;
|
||||
uint8_t src;
|
||||
@ -571,7 +572,7 @@ bool VM::execSHLR(void) {
|
||||
}
|
||||
bool VM::execSHRI(void) {
|
||||
/*
|
||||
SHRI R0, 0x2 | R0 /= 2
|
||||
SHRI R0, 0x2 | R0 >> 2
|
||||
*/
|
||||
uint8_t dst;
|
||||
uint16_t src;
|
||||
@ -587,7 +588,7 @@ bool VM::execSHRI(void) {
|
||||
}
|
||||
bool VM::execSHRR(void) {
|
||||
/*
|
||||
SHRR R0, R1 -> R0 /= R1
|
||||
SHRR R0, R1 -> R0 >> R1
|
||||
*/
|
||||
uint8_t dst;
|
||||
uint8_t src;
|
||||
@ -897,7 +898,6 @@ void VM::run(void) {
|
||||
DBG_ERROR(("LODR FAILED.\n"));
|
||||
finished = true;
|
||||
}
|
||||
regs[IP] += LODR_SIZE;
|
||||
} else if (opcode == OPS[STRI]) {
|
||||
ret = execSTRI();
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user