In this section we will learn how to use PowerShell Empire.
Let’s start by running PowerShell Empire.
sudo powershell-empire server
struct note
{
size_t body_sz;
char body[];
};
struct note* add_note(char* body, size_t body_sz) {
//cout << sizeof(struct note) << endl;
unsigned note_sz = sizeof(struct note) + body_sz;
// overflow checking
if (note_sz <= sizeof(struct note)) return NULL;
struct note *new_note = (struct note*)malloc(note_sz);
if (new_note == NULL) return NULL;
memset(new_note, 0, sizeof(struct note));
new_note->body_sz = body_sz;
strncpy(new_note->body, body, note_sz - sizeof(struct note));
return new_note;
}
void dump_note(struct note* note , char* out ) {
memcpy(out, note->body, note->body_sz);
}