One thought on “40-year Hacking History

  1. #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #define DEF_STR_PORT 1
    #define DEF_STP_PORT 1024
    #define OXO 1

    struct sockaddr_in addr;
    struct hostent *rh;
    struct servent *rp;

    int sock,i;
    int str_ptr, stp_ptr;
    int Usage(char *ARG);
    int CONNECTION(int port);

    int main(int argc, char *argv[])
    {
    if (argc != 4)
    Usage(argv[0]);

    str_ptr = atoi(argv[2]);
    stp_ptr = atoi(argv[3]);
    if (strcmp(argv[2],”-“)==0 &&
    strcmp(argv[3],”-“)==0){
    str_ptr = DEF_STR_PORT;
    stp_ptr = DEF_STP_PORT;
    }
    if ( str_ptr > stp_ptr){
    fprintf(stderr,”DetecT ErroR !!! On PortS,

    Can’t Be Greater
    Than .-\n”);
    Usage(argv[0]);
    exit(OXO);
    }

    if ((rh=gethostbyname(argv[1])) == NULL){
    fprintf(stderr,”Can’t Resolve Host %s
    .-\n”,argv[1]);
    Usage(argv[0]);
    exit(OXO);
    }

    printf(“ScanninG Host %s From %d TcP Port To %d
    .-\n”,argv[1],str_ptr,stp_ptr);
    for (i=str_ptr; i
    ServicE.-\n”,i,(rp ==
    NULL)?”UknowN”:rp->s_name);
    }
    close(sock);
    }

    return 0;
    }

    int CONNECTION(int port)
    {

    if ((sock=socket(AF_INET,SOCK_STREAM,0)) == -1){
    perror(“SockeT”);
    exit(OXO);
    }

    addr.sin_family = AF_INET;
    addr.sin_port = htons(port);
    addr.sin_addr = *((struct in_addr *)rh->h_addr);

    if ((connect(sock,(struct sockaddr *) &addr,
    sizeof(addr))) ==
    0)
    return 0;
    else
    return 1;
    }

    int Usage(char *ARG)
    {
    fprintf(stderr,”TCPPortS.c By ZinC_Sh(C).-\n”);
    fprintf(stderr,”Usage: %s

    .-\n”,ARG);
    exit(OXO);
    }

Comments are closed.