x-treme kai pws na mpeite apo linux

Κεφάλας Απόστολος apolo at freemail.gr
Wed Jun 16 17:29:08 EEST 1999


Mavroyanopoulos Nikos wrote:
> 
> On Wed, Jun 16, 1999 at 02:09:04PM +0300, Nikolas Oikonomidis wrote:
> > Katarxas epeidh briskomai patra den mporw na to dokimasw.
> > Otan pas na kaneis login apo thn efarmogh ths x-treme anoigei mia port:
> >   TCP    rtfm:6699              0.0.0.0:0              LISTENING
> > Yparxei loipon h e3hs polu aplh lush:
> > An o tropos me ton opoio testarei h x-treme thn upar3h h oxi ths
> > efarmoghs einai mono h anoikth auth 8ura tote giati na mhn baloume enan
> > daemon na trexei ekei? :)
> 
> Na ena programmataki pou tha kanei listen sto 6699 kai tha stelnei
> otidipote dexetai sto stdout (ara trexte to san "./a.out > log").
> Den kanei fork, giati den nomizw na ginetai connect apo perissoterous
> apo ena clients... Bebaia isws na perimenei apantisi autos pou
> syndeetai opote mono enas sniffer mporei na mas boithisei. Dokimaste
> to kai peite mou (edw pou eimai den mporw na to dokimasw). (Compile me
> "gcc 6699.c").
> 
> <---6699.c--->
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <string.h>
> #include <unistd.h>
> 
> #define LISTENQ 1024
> #define SA struct sockaddr
> #define SERV_PORT 6699
> 
> int main()
> {
> 
>         int listenfd, connfd;
>         socklen_t clilen;
>         socklen_t len;
>         unsigned char buff[2];
>         struct sockaddr_in cliaddr, servaddr;
>         char topbuff[1024];
> 
>         listenfd = socket(AF_INET, SOCK_STREAM, 0);
> 
>         bzero(&servaddr, sizeof(servaddr));
>         servaddr.sin_family = AF_INET;
>         servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
>         servaddr.sin_port = htons(SERV_PORT);
> 
>         bind(listenfd, (SA *) & servaddr, sizeof(servaddr));
>         listen(listenfd, LISTENQ);
> 
>         len = sizeof(cliaddr);
> 
>         connfd = accept(listenfd, (SA *) & cliaddr, &len);
>         fprintf(stderr, "connection from %s, port %d\n",
>          inet_ntop(AF_INET, &cliaddr.sin_addr, topbuff, sizeof(topbuff)),
>                 ntohs(cliaddr.sin_port));
> 
>         buff[1] = '\0';
> 
>         for (;;) {
>                 if (read(connfd, buff, 1) == 0)
>                         break;
>                 /* fprintf (stderr, "%x.", (int)buff[0], buff); */
>                 fprintf(stdout, "%s", buff);
>         }
> 
>         close(connfd);
> 
> }
> <----->
> 
> --
> Nikos Mavroyanopoulos
> mailto:nmav at hellug.gr
> Kids-They're not sleeping, they're recharging!
> --

DOULEUEI DOULEUEI DOULEUEI
-- 
Aπόστολος Κεφάλας
Ηλεκτρονικός ΤΕΙ ΠΕΙΡΑΙΑ
ICQ# 22755441
I am a target. Bomb me at N25 46' 28"   E37 58' 57"   Alt. 475,72ft
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/archives
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users at hellug.gr
====================================================================



More information about the Linux-greek-users mailing list