-
-
Save halos/15d48a46556645ae7ff2ecb3dfc95d73 to your computer and use it in GitHub Desktop.
Angr example bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
// Type | |
#define T_FILESYSTEM 0x64bbe900 | |
#define T_CMD 0xee697065 | |
// File System Order | |
#define FSO_CREATE 0xaff80c17 | |
#define FSO_WRITE 0xc6e6ef6b | |
#define FSO_DELETE 0x1f01d4d4 | |
#define FSO_READ 0x14c47592 | |
// Object Type | |
#define OT_FILE 0x6e0978af | |
#define OT_FOLDER 0x690c6b0e | |
// Cmd order | |
#define CO_BASH 0x698b87a6 | |
#define CO_NEW_USER 0xc678c002 | |
// User | |
#define U_CURRENT 0xe8723ad9 | |
#define U_ROOT 0xfe42ed2b | |
typedef struct { | |
int type; | |
int fs_order; | |
int object_type; | |
int cmd_order; | |
int user; | |
char args[256]; | |
} c2_order; | |
c2_order c2_resp; | |
void call_home(){ | |
// Create foder | |
c2_resp.type = T_FILESYSTEM; | |
c2_resp.fs_order = FSO_CREATE; | |
c2_resp.object_type = OT_FOLDER; | |
strcpy(c2_resp.args, "/home/931/._ssh"); | |
} | |
void exec_order() | |
{ | |
if (c2_resp.type == T_FILESYSTEM) { | |
if (c2_resp.fs_order == FSO_CREATE) { | |
if (c2_resp.object_type == OT_FILE) { | |
printf("Creando fichero: %s\n", c2_resp.args); | |
} else if (c2_resp.object_type == OT_FOLDER) { | |
printf("Creando carpeta: %s\n", c2_resp.args); | |
} | |
} else if (c2_resp.fs_order == FSO_WRITE) { | |
printf("Escribiendo fichero: %s\n", c2_resp.args); | |
} else if (c2_resp.fs_order == FSO_DELETE) { | |
if (c2_resp.object_type == OT_FILE) { | |
printf("Borrando fichero: %s\n", c2_resp.args); | |
} else if (c2_resp.object_type == OT_FOLDER) { | |
printf("Borrando carpeta: %s\n", c2_resp.args); | |
} | |
} else if (c2_resp.fs_order == FSO_READ) { | |
if (c2_resp.object_type == OT_FILE) { | |
printf("Leyendo fichero: %s\n", c2_resp.args); | |
} else if (c2_resp.object_type == OT_FOLDER) { | |
printf("Leyendo carpeta: %s\n", c2_resp.args); | |
} | |
} | |
} else if (c2_resp.type == T_CMD) { | |
if (c2_resp.cmd_order == CO_BASH) { | |
if (c2_resp.user == U_CURRENT) { | |
printf("Ejecutando bash como usuario actual: %s\n", c2_resp.args); | |
} else if (c2_resp.user == U_ROOT) { | |
printf("Ejecutando bash como root: %s\n", c2_resp.args); | |
} | |
} else if (c2_resp.cmd_order == CO_NEW_USER) { | |
printf("Creando usuario: %s\n", c2_resp.args); | |
} | |
} | |
} | |
int main(int argc, char *argv[]) | |
{ | |
call_home(); | |
exec_order(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment