Skip to content

Commit

Permalink
add option for shellcode injection
Browse files Browse the repository at this point in the history
  • Loading branch information
govolution committed Feb 9, 2018
1 parent d382436 commit 50e6e0f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Binary file modified make_bfg
Binary file not shown.
27 changes: 26 additions & 1 deletion make_bfg.c
Expand Up @@ -9,6 +9,7 @@ Web: https://github.com/govolution/bfg
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

void print_start();
void print_help();
Expand All @@ -24,6 +25,7 @@ int main (int argc, char **argv)
char *dvalue = NULL;
char *evalue = NULL;
char *fvalue = NULL;
char *ivalue = NULL;
int hflag = 0;
int Fflag = 0;
int Xflag = 0;
Expand All @@ -37,7 +39,8 @@ int main (int argc, char **argv)
opterr = 0;

// compute the options
while ((c = getopt (argc, argv, "d:e:f:u:w:lphFXq")) != -1)
//deleted w,u
while ((c = getopt (argc, argv, "d:e:f:i:lphFXq")) != -1)
switch (c)
{
case 'd':
Expand All @@ -52,6 +55,9 @@ int main (int argc, char **argv)
case 'f':
fvalue = optarg;
break;
case 'i':
ivalue = optarg;
break;
case 'h':
hflag = 1;
break;
Expand All @@ -74,6 +80,8 @@ int main (int argc, char **argv)
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (optopt == 'f')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (optopt == 'i')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
Expand Down Expand Up @@ -144,6 +152,21 @@ int main (int argc, char **argv)
fclose (file_def);
}

//inject
if(ivalue)
{
if (strcmp(ivalue, "shellcode")==0)
{
printf("Write INJECT_SHELLCODE\n");
FILE *file_def;
file_def = fopen ("defs.h","a");
fprintf (file_def, "#define INJECT_SHELLCODE\n");
fclose (file_def);
}
else
printf("-i %s unknown option\n");
}

//write flags to defs.h
FILE *file_def;
file_def = fopen ("defs.h","a");
Expand All @@ -170,6 +193,8 @@ int main (int argc, char **argv)
void print_help()
{
printf("Options:\n");
printf("-i inject\n");
printf("\t-i shellcode for injecting shellcode\n");
printf("-l load and exec shellcode from given file, call is with mytrojan.exe myshellcode.txt\n");
printf("-f compile shellcode into .exe, needs filename of shellcode file\n");
printf("-X compile for 64 bit\n");
Expand Down

0 comments on commit 50e6e0f

Please sign in to comment.