                                 Using Wingates 
                           by pbxphreak <chris@lod.com>

Using Wingates for IRC!

Wingates, Wingates, Wingates. What to do with them? Well simple. You can
either use it to bounce off IRC with. First off. You need to find a 
WinGate. There are several scanning programs out there mostly for 
windows. Since I dont use windows, I cant help you there. I have included 
a program below that verifies ip address that are wingates. It checks 
ips.in (which an ip address on a serate line) and verifies the wingate if 
its valid or not. There is a program for Linux called z0ne. What you can 
do with z0ne is tell it to scan all of a domain. For example ./z0ne 
uunet.ca > uunet.ca.log That would simply write to a file, every single 
ip address uunet.ca uses. Which is alot :) You can find z0ne somewhere on 
the net. It works with Linux, if you need it you can email me and I can 
send it to you.  I use a combination of 2 programs. I use the wingate 
checker to verify the wingate and also a scanner that scans for a  
certain port on a classb or classc (which I cant give you because its a 
private program). So from there i just verify the file with the ips, so 
its pretty easy. 

Once you found some Wingates you can use them now. If you want to use them
on IRC you have to do the following:

 - load up yer irc program. may it be ircII, ScrollZ, BX, mIRC, Pirch etc.

 do /server wingate addy 23 (this connects to the wingate on port 23)
 do /quote irc.prison.et 6667 (this connects to prison irc server)
 do /quote NICK ircboy (this sets your nick to ircboy)
 do /quote USER ircboy 0 0: ircgeek 
  - (this would set yer user  name to ircboy and real name to ircboy in 
     the night)

You now should be connected. The hard things about using wingates on irc
is,  you need to find a irc server that will let you connect :)

Below is the wingate verifier. Remember to have a file called ips.in which
contains an ip address per line and this will be verified and resule will
be stored in ips.out

 ------------------- SNIP ---------------------
/*  wgcheck.c
 *  cc -o wgcheck wgcheck.c
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <ctype.h>
#include <arpa/inet.h>
extern int hexstr;
static int sockfd2;
static int sockfd;
static int gatenum = 0;
static int toscan = 0;
#define DEF_FILE "ips.in"
#define OUT_FILE "ips.out"
#define socktimeout 10
#define longtime 3000
#define getthetime()            time((void *)0)
int sigalrm_handler(int sig)
{
    close(sockfd);
   return;
}
int main()
{
   
    FILE *in;
        FILE *server_file;
        int i;
	 time_t  ct;
        char *sockfile;
        char sockip[1024];
        sockfile = DEF_FILE;  
     printf("wgcheck\n");
     printf("\n");
      in = fopen(sockfile,"r"); 
     while(fgets(sockip,80,in))
     {
          if(sockip[0] == '\0')
{
                fclose(in);
                exit(1);
}
     sockip[strlen(sockip) -1] = '\0';
     toscan++;
}

fclose(in);
     printf("Loaded %i gates to scan\n",toscan);
     printf("\n");
     in = fopen(sockfile,"r");
     while(fgets(sockip,80,in))
     {
          if(sockip[0] == '\0')
{
                fclose(in);
                exit(1);
}
          sockip[strlen(sockip) -1] = '\0';
      signal(SIGALRM, sigalrm_handler);
      alarm(socktimeout);
     toscan--;
     printf("Scanning %s (%i more to go)\r",sockip,toscan);
      fflush(stdout);
    printf("                                                                  \r");
    wingate(sockip);
     signal(SIGALRM, sigalrm_handler);
    alarm(longtime);
}
printf("Done checking!\n");
printf("%i wingates found\n",gatenum);
fclose(in);
exit(1);
}


int wingate(char *host)
{
        int wgsock;
        int e;
        int d;
        FILE *ips;
        int numbytes;
        char buf[1024];
        struct in_addr MyHostAddr;
        struct hostent *he;
        struct sockaddr_in sin;
        fd_set gateset;
        struct timeval tv;
        sockfd = socket(AF_INET, SOCK_STREAM, 0);
        sin.sin_family = AF_INET;
        sin.sin_port = htons(23);
        sin.sin_addr.s_addr = inet_addr(host);
        if(sin.sin_addr.s_addr == INADDR_NONE)
        {
                he = gethostbyname(host);
                if(!he)
                {
                        close(sockfd);
                        return;
                }
                memcpy(&sin.sin_addr, he->h_addr, he->h_length);
        }
       e = connect(sockfd, (struct sockaddr *)&sin, sizeof(sin));
         if (e < 0)
        {
                close(sockfd);
                return;
      }
  FD_ZERO(&gateset);
  FD_SET(sockfd, &gateset);
  tv.tv_sec = 10;
  tv.tv_usec = 0;
  d = select(sockfd+4, NULL, &gateset, NULL, &tv);
   if(d == 0)
   {
     close(sockfd);
     return;
   }
        numbytes = read(sockfd, buf, sizeof(buf));
        buf[numbytes] = '\0';
         if(numbytes == 9) {
                        numbytes = read(sockfd, buf, sizeof(buf));
                        buf[numbytes] = '\0';
                               if (strcmp(buf, "WinGate>") == 0) {    
    
	        	close(sockfd);
                        gatenum++;
        	        printf("Open wingate server found on %s (gate #%i) (%i left to scan)\n",host,gatenum,toscan);
         		ips = fopen(OUT_FILE,"a");
               		fputs(host, ips);
                	fputs("\n", ips);
                	fclose(ips);
          		return;
}
}
}

Here are some gates to get you started:

dns.yoshinomasa.co.jp
ns.joban-power.co.jp
ns.sanshusha.co.jp
ns.sunshine.co.jp
uni.eltron.ee

Well, here comes the end to another one of my articles. Well hope you had
fun, try it out, and have some fun. CYA!


