mirror of
https://github.com/CPunch/Laika.git
synced 2025-09-27 20:30:12 +00:00
Shell: improved looks, added colored output
This commit is contained in:
40
lib/include/lbox.h
Normal file
40
lib/include/lbox.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef LAIKA_BOX_H
|
||||
#define LAIKA_BOX_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "lvm.h"
|
||||
|
||||
/* Laika Box:
|
||||
Laika Boxes are obfuscated storage mediums where data is only in memory for a very short amount of time.
|
||||
Of course, this can be bypassed with a simple debugger and setting a breakpoint right after the data is 'unlocked',
|
||||
but the game of obfuscation isn't to prevent the data from being seen, it's to slow the reverse engineer down.
|
||||
|
||||
2 main APIs are exposed here, laikaB_unlock() & laikaB_lock(). Both of which are inlined to make it more painful
|
||||
for the reverse engineer to quickly dump boxes from memory, forcing them to set breakpoints across the executable.
|
||||
Each box has its own VM, with it's own deobfuscation routine. This makes static analysis a painful route for string
|
||||
dumping.
|
||||
*/
|
||||
|
||||
enum {
|
||||
BOX_IP,
|
||||
BOX_PUBKEY,
|
||||
BOX_MAX
|
||||
};
|
||||
|
||||
struct sLaikaB_box {
|
||||
uint8_t *data;
|
||||
uint8_t *unlockedData;
|
||||
sLaikaV_vm vm;
|
||||
};
|
||||
|
||||
inline void laikaB_unlock() {
|
||||
|
||||
}
|
||||
|
||||
/* safely free's allocated buffer using libsodium's api for clearing sensitive data from memory */
|
||||
inline void laikaB_lock() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,14 +1,14 @@
|
||||
#ifndef LAIKA_CONFIG_H
|
||||
#define LAIKA_CONFIG_H
|
||||
|
||||
/* version info */
|
||||
#define LAIKA_VERSION_MAJOR 0
|
||||
#define LAIKA_VERSION_MINOR 1
|
||||
|
||||
/* keys */
|
||||
#define LAIKA_PUBKEY "40d5534aca77d1f5ec2bbe79dd9d0f52a78148918f95814404cefe97c34c5c27"
|
||||
#define LAIKA_PRIVKEY "90305aa77023d1c1e03265c3b6af046eb58d6ec8ba650b0dffed01379feab8cc"
|
||||
#define LAIKA_CNC_IP "127.0.0.1"
|
||||
#define LAIKA_CNC_PORT "13337"
|
||||
|
||||
#endif
|
||||
#ifndef LAIKA_CONFIG_H
|
||||
#define LAIKA_CONFIG_H
|
||||
|
||||
/* version info */
|
||||
#define LAIKA_VERSION_MAJOR 0
|
||||
#define LAIKA_VERSION_MINOR 1
|
||||
|
||||
/* keys */
|
||||
#define LAIKA_PUBKEY "40d5534aca77d1f5ec2bbe79dd9d0f52a78148918f95814404cefe97c34c5c27"
|
||||
#define LAIKA_PRIVKEY "90305aa77023d1c1e03265c3b6af046eb58d6ec8ba650b0dffed01379feab8cc"
|
||||
#define LAIKA_CNC_IP "10.0.2.2"
|
||||
#define LAIKA_CNC_PORT "13337"
|
||||
|
||||
#endif
|
||||
|
@@ -15,25 +15,25 @@
|
||||
#define LAIKA_VM_STACKSIZE 64
|
||||
#define LAIKA_VM_CONSTSIZE 32
|
||||
|
||||
struct sLaika_vm_val {
|
||||
struct sLaikaV_vm_val {
|
||||
union {
|
||||
uint8_t i;
|
||||
void *ptr;
|
||||
};
|
||||
};
|
||||
|
||||
struct sLaika_vm {
|
||||
struct sLaika_vm_val stack[LAIKA_VM_STACKSIZE];
|
||||
struct sLaika_vm_val constList[LAIKA_VM_CONSTSIZE];
|
||||
struct sLaikaV_vm {
|
||||
struct sLaikaV_vm_val stack[LAIKA_VM_STACKSIZE];
|
||||
struct sLaikaV_vm_val constList[LAIKA_VM_CONSTSIZE];
|
||||
uint8_t code[LAIKA_VM_CODESIZE];
|
||||
int pc;
|
||||
};
|
||||
|
||||
#define LAIKA_MAKE_VM(consts, code) (struct sLaika_vm)({.constList = consts, .code = code, .pc = 0})
|
||||
#define LAIKA_MAKE_VM(consts, code) (struct sLaikaV_vm)({.constList = consts, .code = code, .pc = 0})
|
||||
|
||||
/* constants */
|
||||
#define LAIKA_MAKE_VM_INT(i) (struct sLaika_vm_val)({.i = i})
|
||||
#define LAIKA_MAKE_VM_PTR(ptr) (struct sLaika_vm_val)({.ptr = ptr})
|
||||
#define LAIKA_MAKE_VM_INT(i) (struct sLaikaV_vm_val)({.i = i})
|
||||
#define LAIKA_MAKE_VM_PTR(ptr) (struct sLaikaV_vm_val)({.ptr = ptr})
|
||||
/* instructions */
|
||||
#define LAIKA_MAKE_VM_IA(opcode, a) opcode, a
|
||||
#define LAIKA_MAKE_VM_IAB(opcode, a, b) opcode, a, b
|
||||
@@ -58,7 +58,7 @@ enum {
|
||||
OP_TESTJMP, /* if stk_indx[uint8_t] != 0, pc += [uint8_t] */
|
||||
};
|
||||
|
||||
inline void laikaV_execute(struct sLaika_vm *vm) {
|
||||
inline void laikaV_execute(struct sLaikaV_vm *vm) {
|
||||
|
||||
#define READBYTE (vm->code[vm->pc++])
|
||||
#define BINOP(x) { \
|
||||
|
Reference in New Issue
Block a user