comparison target-utils/tf-breakin/mkembed.c @ 983:7166c8311b0d

tfc139 reworked to support both ARM and Thumb entry
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 08:07:47 +0000
parents 22c6e39e1789
children
comparison
equal deleted inserted replaced
982:461f7ee5f254 983:7166c8311b0d
3 #include <sys/stat.h> 3 #include <sys/stat.h>
4 #include <stdio.h> 4 #include <stdio.h>
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <unistd.h> 6 #include <unistd.h>
7 7
8 #define PAYLOAD_SIZE 112 8 #define PAYLOAD_SIZE 116
9 u_char payload_buf[PAYLOAD_SIZE]; 9 u_char payload_buf[PAYLOAD_SIZE];
10 10
11 read_binary(filename) 11 read_binary(filename)
12 char *filename; 12 char *filename;
13 { 13 {
44 of = fopen(filename, "w"); 44 of = fopen(filename, "w");
45 if (!of) { 45 if (!of) {
46 perror(filename); 46 perror(filename);
47 exit(1); 47 exit(1);
48 } 48 }
49 fprintf(of, "u_char payload[%d] = {\n", PAYLOAD_SIZE); 49 fprintf(of, "u_char shellcode[%d] = {\n", PAYLOAD_SIZE);
50 idx = 0; 50 idx = 0;
51 for (i = 0; i < 14; i++) { 51 for (i = 0; i < 15; i++) {
52 for (j = 0; j < 8; j++) { 52 for (j = 0; j < 8; j++) {
53 if (j) 53 if (j)
54 putc(' ', of); 54 putc(' ', of);
55 else 55 else
56 putc('\t', of); 56 putc('\t', of);
57 fprintf(of, "0x%02X,", payload_buf[idx++]); 57 fprintf(of, "0x%02X,", payload_buf[idx++]);
58 if (idx >= PAYLOAD_SIZE)
59 break;
58 } 60 }
59 putc('\n', of); 61 putc('\n', of);
60 } 62 }
61 fputs("};\n", of); 63 fputs("};\n", of);
62 fclose(of); 64 fclose(of);